Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Back button to previous scenes within SWF?? 1

Status
Not open for further replies.

theKeyper

Technical User
Joined
Jun 11, 2003
Messages
79
Location
AU
Hi guys,
I was just wondering if there is a nice simple way to return to the previous scene a user has visited. I was going to use a variable, giving it a different value on every scene and then using a massive else..if statement on the back button, but I was wondering if there was an automated way to do this in Flash MX. Maybe Named Anchors?? However, as I understand it Named anchors are for exploiting the Back button in IE, where as this is going to be published as an .exe and not as a website. Is there a way to use named anchors for a flash button? or else is there an easier way to do this and perhaps store multiple previous scenes instead of just the scene visited immeadtley before and then back to current scene? Thanks alot in advance.
-Keyper.

P.S. I'm not loading any ex. SWF's on other levels, only moving between scenes in the same SWF.
 
Wow, Thanks a lot Old,
I've never used arrays before so this is pretty much new territory for me, And I'm Loving IT! I studied your code for a while and it all makes sense so I pretty much got it down, just a couple questions. You wrote:

_root.currentlabel = "one";
_root.display = "";
and later on your buttons:
_root.previouslabel = _root.currentlabel;
These didn't seem to do anything or make any sense. Could you please explain these labels and what they do to me?

The other thing I noticed is that you always write _root. before everything. It seems a pretty safe way to go, but I was wondering if that is just kind of your style, to avoid ambiguity, or if it is necessary when working with scenes?

Thanks alot for all the help you give so genourusly to us new-newbies.
-Keyper
 
That was done quite some time ago, I'll have to look into it when I have some time.

As for _root tagged to variables names, it's just that they can be set and retreived from anywhere (with that syntax), as opposed to a local variable in a function or a clip. In fact I now use _level0 or even _global, in the same manner and for the same reason.
 
Just one more question,
the code you put on the buttons going to another scene goes pretty much like this.

on (release) {
_root.arrayindex += 1;
history[_root.arrayindex] = "three_one";
_root.gotoAndPlay(history[_root.arrayindex]);
}

This works like a charm for buttons on the main timeline, but I also have some buttons that are inside a movie clip, which is inside another movie clip which sits on the main timeline (My drop-down menu). On these buttons the above code does nothing. The following code however does work:

on (release) {
_root.gotoAndPlay("three_one");
}

But obviously now the back button doesn't work. To me this doesn't make sense as both of the above portions of code seem to be acheiving the same result of going to the frame label "three_one". Thanks a lot for taking the time to shed some light on this for me.
-Keyper.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top