all groups > flash actionscript > february 2006 >
You're in the

flash actionscript

group:

History with in Flash movie?



Re: History with in Flash movie? manifestinteractive NO[at]SPAM gmail.com
2/25/2006 8:12:14 PM
flash actionscript: Greetings,

You can use a global variable to achieve this.

What you would do is at the start of the movie use the following code:

if(_global.whichFrame == undefined){
_global.whichFrame = "HOME";
}

This code checks to see if _global.whichFrame is already defined, if
its not, then its the first time its been encountered and it sets it to
the home page (as that is where it is most likely to be loaded)

Next you can create frame names to easily redirect your users to a
particular screen. I have used the name "HOME" to label the main home
screen of your FLA. Then anywhere in the movie when you want to update
which page the user should be sent back to you would use the code:

_global.whichFrame = "MYFRAME";

"MYFRAME" of course being the frame you want it to go to. You can set
this on the click event since that is where it looks like your users
are commiting to accessing that page. Then on your roll out script just
have it set to do something like:

_root.gotoAndStop(_global.whichFrame);

That should take care of you. Let us know if this worked for you.

- Peter Schmalfeldt
Manifest Interactive
History with in Flash movie? rogerpoole
2/25/2006 10:16:55 PM
I have a site with 4 nav buttons on the right. This nav is the same on 5
seperate scenes.
On mouse over I would like to show a page from one of 4 destination scenes.
On click you should go to your selected scene.
On roll out, you go back to the scene and frame that you were when you rolled
over.

Right now the mouse over sends you to the scene and stops you at a particular
frame. What I need to happen next is to be able to say on mouse out, go history
back -1 (like you might do in html) but this needs to send you back in the swf
to where you had moused over.

Is there any way to easily do this in action script?
Re: History with in Flash movie? Chaos_Blader
2/25/2006 11:23:44 PM
Re: History with in Flash movie? rogerpoole
2/26/2006 7:31:33 PM
Re: History with in Flash movie? blemmo
2/26/2006 8:19:30 PM
Scenes are not exactly 'easy' to handle... e.g. you can't get the name of the
current scene and other things...

You could set a variable inside each scene to represent which scene you are
in, e.g.
_root.currentScene = 3;

Then, onRollOver, you could use other variables to store the current scene and
frame:
lastScene = _root.currentScene;
lastFrame = this._currentFrame;

and onRollOut:
switch (lastScene){
case 1: gotoAndStop("Scene 1",lastFrame); break;
case 2: gotoAndStop("Scene 2",lastFrame); break;
...
}

I didn't try that, but I think it should do the job.

hth,
blemmo
Re: History with in Flash movie? rogerpoole
2/26/2006 8:45:17 PM
Thanks, I'm going to give this a try. Let you know if it works.
AddThis Social Bookmark Button