View Full Version : targeting with actionscript question

08-22-2001, 12:06 PM

let me explain:
i have a very small movie (c.50k) but still with a preloader. this gives you the menu (get them in and get them interested before making them sit through the download). from here you choose to go to for example section a. this loads as a separate url/movie in the same browser. now, once this movie has loaded, how do i jump back to the menu without having to have the preloader go through the motions of getting to the frame where it goes on to the next scene. in other words, how do i skip the preloader on the second visit to the menu movie?

see what i mean? any help would be great thanks!

08-22-2001, 01:45 PM
well, why don't you just simply label the frame after the preloader that you want to go back to with a unique name and then instruct flash to jump you back to that exact frame when required?

08-22-2001, 02:47 PM
sounds good, but, what is the script for targeting this label - remember, i am targeting this frame from a button in a different movie, in a different url.


08-23-2001, 09:57 AM
Um, I'm afraid I'm not quite sure what you mean when you say that each section loads into a separate url/movie as if that is the case I don't really understand why you have the preloader.
I've had a play and the only way that occurred to me to do it is to keep the entire site within one swf file and load each section into a container movie which can then be used to target the loaded swfs.

so, you have your main swf:

"completemovie.swf" which initially loads the preloader into an empty container movie on the main timeline, (lets call that "container") code is on first frame:

loadMovie ("preloader.swf", "_root.container");

to go to another section you then load the new section into the container, say on a button action:

on (release) {
loadMovie ("section1.swf", "_root.container");

and then from here you want to go back to the index, but without showing the preloader, so you need to add an if action on the first frame of the "preloader.swf" :

if (_root:x ==2) {
gotoAndStop ("indexframe");
} else {
play ();

this tells the preloader movie to go straight to the frame labelled "indexframe" if variable "x" = 2, which of course it won't the first time the movie runs. However, the second time you call the movie you will make x = 2 by setting the variable in the button (within completemovie.swf) you use to call the "preloader.swf" to replay:

on (release) {
loadMovie ("preloader.swf", "_root.container");
_root:x = 2;

thus the "preloader.swf" should skip the preload and go straight to the index. phew.

NOTE that when using variable "x" I have quoted the full path to the variable (_root:x) as unless you do that flash won't be able to find it. Especially important because you are checking variables from within loaded movies.

Of course, this also goes for any path addressing and you would have to make sure that all addressing in your loaded movies takes into account _root.container as else paths won't be readable.

Hope that is of some help anyway.

Anyone else got any ideas?

Good luck


08-23-2001, 09:13 PM
Pinkaboo's idea would work the best....you don't want to switch URL's, it would be too messy. Keep it all in the same URL and just load different SWF's into it.