These examples are written in C#.
NOTE. Before setting additional parameters for the object belonging to FlashExporterClass, determine Flash object via the FlashExporterClass.Movie property.
Executing the example requires that the file system includes the file C:/Flash.swf containing a Flash object.
static void Main(string[] args)
{
// Create a class to export Flash
IFlashExporter fe = new FlashExporterClass();
//Create an export condition: specified frame
IFrameFlashExporterCondition CommandCondition = new FrameFlashExporterCondition();
// Set parameters to export frame: frame number and timeout
CommandCondition.FrameNum = 10;
CommandCondition.Milliseconds = -1;
// Set path to exported Flash
fe.Movie = @"C:/Flash.swf";
// Set size of the image to which the Flash object is to be exported
fe.Width = 800;
fe.Height = 600;
// Export Flash to stream
Array arr = fe.Export(CommandCondition) as Array;
byte[] b = arr as byte[];
MemoryStream Ms = new MemoryStream(b);
System.Drawing.Bitmap Img = new System.Drawing.Bitmap(Ms);
// Save stream to file
Img.Save(@"C:\Flash.bmp");
}
After executing the example the tenth frame of the Flash object from the file is exported into the file C:\Flash.bmp. Timeout value is set to -1, so it is ignored in frame anticipation.
Executing the example requires that the file system includes the file C:/Flash.swf containing a Flash object with the onLoaded command.
static void Main(string[] args)
{
// Create a class to export Flash
IFlashExporter fe = new FlashExporterClass();
// Create an export condition: command of the Flash object
IFSCommandFlashExporterCondition CommandCondition = new FSCommandFlashExporterCondition();
// Set command parameters
CommandCondition.Milliseconds = 5000;
CommandCondition.Command = "onLoaded";
// Set path to exported Flash
fe.Movie = @"C:/Flash.swf";
// Set size of the image, to which the Flash object is to be exported
fe.Width = 800;
fe.Height = 600;
// Export Flash to stream
Array arr = fe.Export(CommandCondition) as Array;
byte[] b = arr as byte[];
MemoryStream Ms = new MemoryStream(b);
System.Drawing.Bitmap Img = new System.Drawing.Bitmap(Ms);
// Save stream to file
Img.Save(@"C:\Flash.bmp");
}
After executing the example the onLoaded command is executed for the Flash object, then the object is exported to the file C:\Flash.bmp.
See also: