| Create Movie Documents with C1FlashMovie > Creating Movie Documents |
Creating an Adobe Flash movie documents using C1FlashMovie requires the three following steps:
For more information on how to create movie documents, see the C1FlashMovie Tasks topic.
The following graphic represents the oval object, frame by frame, created by the Flash movie:
| Frame 0 | Frame 1 | Frame 2 | Frame 3 |
![]() |
![]() |
![]() |
![]() |
| Create a FOval object, add it to Frame 0 | Remove the object from Frame 1, rotate 45 degrees, and add it to Frame 1 | Remove the object from Frame 2, rotate 90 degrees, and add it to Frame 2 | Remove the object from Frame 3, rotate 135 degrees, and add it to Frame 3 |
The following example shows how to create a movie with a rotating oval as demonstrated in the above picture:
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
' Step 1: create the C1FlashMovie object
Dim movie As New C1FlashMovie()
' Step 2: add/remove graphical object to/from frames
' create an oval object
Dim rect As New Rectangle(100 * Constants.TWIPS, 100 * Constants.TWIPS, 200 * Constants.TWIPS, 100 * Constants.TWIPS)
Dim oval As New FOval(rect)
' set its out line color and width
oval.LineColor = Color.Red
oval.LineWidth = 2 * Constants.TWIPS
oval.Depth = System.Convert.ToUInt16(1)
' add to frame 0
movie.Frames(0).AddObject(oval)
' remove from frame 1, rotate 45 degrees, add it back
movie.Frames(1).RemoveObject(oval)
oval.Rotate(45F)
movie.Frames(1).AddObject(oval)
' remove from frame 2, rotate 90 degrees, add it back
movie.Frames(2).RemoveObject(oval)
oval.Rotate(90F)
movie.Frames(2).AddObject(oval)
' remove from frame 3, rotate 135 degrees, add it back
movie.Frames(3).RemoveObject(oval)
oval.Rotate(135F)
movie.Frames(3).AddObject(oval)
' Step 3: render to file
movie.RenderToFile("c:\temp\movie.swf")
LaunchViewer("c:\temp\movie.swf")
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
// Step 1: create the C1FlashMovie object C1FlashMovie movie = new C1FlashMovie(); // Step 2: add/remove graphical object to/from frames // create an oval object Rectangle rect = new Rectangle( 100 * Constants.TWIPS, 100 * Constants.TWIPS, 200 * Constants.TWIPS, 100 * Constants.TWIPS ); FOval oval = new FOval( rect ); // set its out line color and width oval.LineColor = Color.Red; oval.LineWidth = 2 * Constants.TWIPS; oval.Depth = System.Convert.ToUInt16(1); // add to frame 0 movie.Frames(0).AddObject( oval ); // remove from frame 1, rotate 45 degrees, add it back movie.Frames(1).RemoveObject( oval ); oval.Rotate(45F); movie.Frames(1).AddObject( oval ); // remove from frame 2, rotate 90 degrees, add it back movie.Frames(2).RemoveObject( oval ); oval.Rotate(90F); movie.Frames(2).AddObject( oval ); // remove from frame 3, rotate 135 degrees, add it back movie.Frames(3).RemoveObject( oval ); oval.Rotate(135F); movie.Frames(3).AddObject( oval ); // Step 3: render to file movie.RenderToFile(@"c:\temp\movie.swf") LaunchViewer(@"c:\temp\movie.swf"); |
|
One important thing to remember is that C1FlashMovie uses a twip coordinate system with the origin at the top-left corner of the page. This is different from the system used in the C1FlashCanvas, which is similar to what is used in the .NET framework. The Constant class defines the constant of twip per logical pixel, which is 20.