448
Working with Text and Strings
8.
Click a blank frame between Frame 1 and 20, and set the tween type to Shape in the
Property inspector.
9.
Save the current document as
animation.fla
.
10.
Select Control > Test Movie to preview the animation.
The SWF file is created in the same directory as the FLA. For this exercise to work
correctly, you need the SWF file to generate so that you can load it into a separate
FLA file.
11.
Create a new FLA file and save it as
animationholder.fla
.
Save the file in the same folder as the animation.fla file you created previously.
12.
Add the following ActionScript code to Frame 1 of the main Timeline:
this.createTextField("textField_txt", 10, 0, 0, 300, 200);
textField_txt.html = true;
textField_txt.htmlText = "Here's an interesting animation: <img
src='animation.swf' id='animation_mc'>";
In this case, the fully qualified path to the newly created movie clip is
textField_txt.animation_mc
.
13.
Save your changes to the Flash document and then select Control > Test Movie to preview
the animation within the text field.
To control the SWF file as it plays in a text field, complete the next exercise.
To control a SWF file that plays in a text field:
1.
Follow the steps in the first procedure under
“Controlling embedded media with
ActionScript” on page 447
.
2.
Create a button instance on the Stage and give it the instance name
stop_btn
in the
Property inspector.
3.
Add the following ActionScript code beneath the existing code in Frame 1 of the
main Timeline:
stop_btn.onRelease = function() {
textField_txt.animation_mc.stop();
};
4.
Select Control > Test Movie to test the application.
Now, whenever you click the
stop_btn
button instance, the timeline of the animation
nested within the text field stops.
For information on making your embedded media into a hyperlink, see
“About making
hypertext links out of embedded media” on page 449
.
Summary of Contents for FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Page 1: ...Learning ActionScript 2 0 in Flash...
Page 8: ...8 Contents...
Page 18: ...18 Introduction...
Page 30: ...30 What s New in Flash 8 ActionScript...
Page 66: ...66 Writing and Editing ActionScript 2 0...
Page 328: ...328 Interfaces...
Page 350: ...350 Handling Events...
Page 590: ...590 Creating Interaction with ActionScript...
Page 710: ...710 Understanding Security...
Page 730: ...730 Debugging Applications...
Page 780: ...780 Deprecated Flash 4 operators...
Page 830: ...830 Index...