It contains the kind of complex, cell-based animation that
is easy in Flash but difficult in Flex.
1. Pull out a SWFLoader component from the Controls folder in the Components panel and place
it next to the Button and Panel that were created earlier (Figure 6-18). Give the SWFLoader an ID
of octo.
Figure 6-18. SWFLoader on MXML
127
FLEX BUILDER AND FLASH
You are going to want the SWF file to be kept with the rest
of your files for the project.
2. Drag the octo.swf file from the location where you
saved it into the File Navigator panel in the src folder
(Figure 6-19).
3. Enter the name of the file in the Source field in the
SWFLoader properties.
4. Run the project (Figure 6-20).
You will notice that the Flash file has been loaded into the
SWFLoader and scaled to fit. You can turn the scaling off
by setting the Scale content property to false. You can also
see that the animation of the Flash file is brought in but
not the background. This lets your animation fit more
effectively with the Flex application.
Figure 6-19. Copying octo.swf into our
project
Figure 6-20. Flash animation playing in our Flex project
128
CHAPTER 6
The buttons in the Flash file also still work to affect the content in the Flash file. So the Do It Again!
button in octo.swf still replays the animation if it is inside Flex. But there is little interaction between
the Flash animation and Flex. Using this method, we cannot, for example, use a Flex Button to set a
property in the Flash animation.
Pages:
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99