issue: complex LoadMovie sample using pull down boxes and targeting scenes on higher levels

 

this is to help out someone who tried to create the sample below. what was needed is a menu from which you can jump to different scenes. since the overall project is rather big, it seemed useful to break the whole thing apart into smaller swf files but it proofs not so simple to have a button that lets you jump into a specific scene of another movie.

there are several pitfalls to be aware of:

1) don't use GetURL:

the simplest idea seems to put the follow-up swf files on new HTML pages and use GetURL to load them. this is fine as long as you simply want to load another swf file. but there is no simple way to tell this swf file, which is not even loaded yet, to jump to a specific frame. it is theoretically possible to use either clientside JavaScript or serverside ASP or CGI script or anything similar that can output dynamically created HTML to append a set of variables to the URL of the swf file and then define in the Flash file what to do depending on the values.

the JavaScript control for Flash 4 or Generator files on this site works like that. but this seems a very complicated way to achieve the given task when Flash offers the great tools of LoadMovie and TellTarget.

2) you cannot target scenes with TellTarget

there is simply no option to select scenes of files in the GoTo command dialog when it is sandwiched in a TellTarget bracket. the very simple workaround here is to use framelabels instead. (in this case i called the frames "one", "two" and "three" in all target files).

3) you have to split LoadMovie and TellTarget

before you can target a timeline it has to be loaded first. you cannot use a command like the following:

On (Release)
  Load Movie ("target1.swf", 1)
  Begin Tell Target ("_level1/")
    Go to and Stop ("one")
  End Tell Target
End On

the trick i used for the first version of the sample (= the file menu.fla in the download package) is to split the commands the following way:

On (Press)
  Load Movie ("target1.swf", 1)
End On
On (Release)
  Begin Tell Target ("_level1/")
    Go to and Stop ("one")
  End Tell Target
End On

therefore you give Flash a little bit of time to load the movie before you send a command to the timeline in level 1. however, as you can test with sample 1: it works very well when you leave a little time between pressing the mouse button and releasing it. if you press and release it very quickly it might fail.

it has the advantage however that the last selected scene stays visible until another selection is clicked on.

the way i worked in sample 2 (= menu2.fla) is to put the LoadMovie command into the action for the button that opens the popup (= the little active area over the arrow on the "Show Button" layer). this has the advantage that there is guaranteed enough time between LoadMovie and TellTarget. but, as soon as anyone of the arrow buttons is hit, the currently visible scene is unloaded.

it is up to you which version you prefer.

4) don't cover the level 0 buttons with content in a higher level

one of the mistakes that were made in attempts to get this to work was that a large image was inserted into the background of the movie loaded onto the higher level. then the menu buttons were repeated etc. therefore the buttons in level 0 are covered and might not receive mousevents anymore. there would be more complications to synchronize the actions with the newly loaded buttons etc. and in short: there is just no need to do this. it would mean having to download the buttons and the background 4 times instead of only once, etc.

as far as the background is concerned: put it into the level 0 movie. if you need different backgrounds for the different target movies you could still create frames with different background in level 0 and navigate within this movie. only put the additional content into the target movies and use the background of level 0 which is still accessible since the background of movies on higher levels will always be transparent.

to be certain that no content is shown when the movie is first loaded i used an absolutely empty keyframe with a stop action in frame 1 of the target movies. therefore nothing is visible until the TellTarget is issued.

 

5) change the hide button around the comboboxes

the button from the library simply uses one big "hide button" (on the layer "Hide Button") to close the popups with on(Press,Release). this works well as long as you have only one menu. but if you have more than one you might get into conflict with the other hide buttons.

therefore i resized the button and created 3 more copies of it which i positioned around the whole menu. then i added Rollover to the actions (theoretically i could have even deleted the Press and Release). therefore the popups close as soon as you roll out of them. have a look at the sample and compare it with a button taken straight out of the Buttons Advanced library to see the difference.

 

click here to download the samples.

sample 1:

back to top

 

sample 2:

 

back to top
1