Loading external SWF
The purpose is to create a main swf which 'll load other swf in containers when buttons heve been clicked. This example uses some tiny scripts.
I suppose you know well how to create objects, thus I wont insist on.
⇒ animation ⇐
First, download a zipfile with 2 imagesUnzip in a directory.
Main clip
1 - Set up movie sizes 640x480 and background color #330066. Prenez un Frame Rate 35.2 - Draw a rectangle (background for buttons). Set up a linear color gradient. Follow images :
3 - Creating 3 containers :
Draw a square 240x240. Place it where you want.
Convert to Sprite : Menu Modify / Convert / Convert to Sprite.
Name : container1 Target toggled.
Do the same for container2, container3. Place squares at different coordinates.
4 - Creating 4 buttons :
The 1st one 'll permit loading clip swf1 in container 1.
The 2nd one 'll permit loading clip swf2 in container 1.
The 3rd one 'll permit loading clip swf3 in container 2.
The 4th one 'll permit loading clip swf4 in container 3.
Insert a text : Load 1. Convert to button. Place it as shown.
Proceed in the same way for the 3 others.
For each button, enter scripts !
Button 1 : on (release) { container1.loadMovie("swf1.swf"); }
Button 2 : on (release) { container1.loadMovie("swf2.swf"); }
Button 3 : on (release) { container2.loadMovie("swf3.swf"); }
Button 4 : on (release) { container3.loadMovie("swf4.swf"); }
External clips swf1, 2, 3, 4
1 - Set up movie sizes 240x240
(As a matter of fact, same dimensions as for host container)
Any background color. Frame Rate 35.
2 - Enter a static text which fits into stage. Choose a light color.
3 - Do the same for the others, either text or image.
Script to get objects dragable.
In each external clip swf1, 2, 3, 4, enter script :
onSelfEvent (press) { startDragUnLocked(); }
onSelfEvent (release) { stopDrag(); }
You 'd drag objects with the mouse. Export each clip.
This example is quite simple.
Remarks :
- Whether you set container1.loadMovieNum("swf1.swf",0); then swf1.swf takes place of the main clip.
- Whether you set container1.loadMovieNum("swf1.swf",1); then swf1 is loaded in level 1 but its origin is 0,0 of the scene.
- loadMovie puts swf1 in container you have defined its position.