public void Close() { try { instance.Dispose(); document.Dispose(); } catch (Exception) { } finally { document = null; instance = null; } }
public bool Open(string file) { try { using (var fs = new FileStream(file, FileMode.Open)) document = new FlashDocument("document", new XnaFlash.Swf.SwfStream(fs), this); instance = new Flash(gameServiceContainer, document, Math.Min(GraphicsDevice.Adapter.CurrentDisplayMode.Width, VectorDevice.MaxTextureSize), Math.Min(GraphicsDevice.Adapter.CurrentDisplayMode.Height, VectorDevice.MaxTextureSize)); instance.Visible = true; instance.IsTransparent = false; instance.Root.HighQuality = quality; instance.Root.DontLoop = !looping; instance.Enabled = !paused; instance.Root.NextFrame(); lastDraw = startTime = DateTime.Now; return true; } catch (Exception e) { MessageBox.Show("Soubor se nepodařilo načíst!\n\n" + e.Message); return false; } }