Skip to main content
September 5, 2008
Question

Not sure how to explain this.......

  • September 5, 2008
  • 4 replies
  • 696 views
I am trying to make a software sim for my company.
I have multiple ways to get to a specific screen (Timeline frame)
But I want the ability to link back to the frame from prevous. and there are multiple ways to get to this.

ok let me try to show by example.
i am on frame 1 and i click on a button that take me to frame 10.
I also have a button on frame 5 that take me to frame 10.
what i want to do is have a button on frame 10 that goes back to the correct frame that was clicked on from before.

so if i was on frame 1 and went to frame 10 and i cleck the button to go back to frame 1.

is there an action script that will know what to redirect back???

Any help would be great..
Thanks

This topic has been closed for replies.

4 replies

Participating Frequently
September 5, 2008
I'm not sure what part you don't understand. Create a variable, on the event handler that gets called when you click the button, update that variable.

If you are new to Flash (and need to know more about navigate to frames, handling button click events, ect.) you may want to look through the Help files that come with Flash (Help->Flash Help).
September 5, 2008
jpsoul, people come here for help because they don't understand things. Many of them have attempted to understand Adobe's arcane documentation, some have not. Just because the answer is obvious to you, doesn't mean it's obvious to the poster, so directing them to search through the forums or the help documentation is akin to saying "go help yourself", which is the opposite of the reason they came here in the first place. Your best bet is to post a code example, or explain things in simpler terms (maybe they don't know what event handler means?) regardless if you've heard the question a thousand times.

Cheers,
FlashTastic
Participating Frequently
September 5, 2008
FlashTastic, I'm not sure how I offended you. Generally, I try to gauge my responses based on the level of experience that I interpret from the question. This is why I wanted to know what part ACOUSTIFIED did not understand in my response. I'm not sure what was confusing. If I knew specifically, I could answer specifically. If it was a general question about how to use Flash, which is how I interpreted the post, a good place to start would be the help manual. I often find that offering code samples before understanding the needs of the poster leads to further confusion.

In the past when I have directed people to search the forum, I have advised what to search for (key words and such). This is because often I have answered the question several times and pointing to the answer is often more effecient than repeating it.

Perhaps you misunderstood the phrasing of my post. I think if you read through my posts you will find that I do put a lot of thought and effort into answering peoples questions. I apologize if that did not come across in this thread.
Damon Edwards
Inspiring
September 5, 2008
create a layer above all layers that extends the timeline, this is where you can put your frame variable, that way it can be access from anywhere. Then on each frame you can have something like this:

Top most frame with the variable:
var returnFrame:uint = 1;

Frame 1:
btn.addEventListener(MouseEvent.CLICK, clicked);
function clicked(e:MouseEvent):void{
returnFrame = 1;
gotoAndStop(10);
};

Frame 5;
anotherBtn.addEventListener(MouseEvent.CLICK, clicked);
function clicked(e:MouseEvent):void{
returnFrame = 5;
gotoAndStop(10);
};

Frame 10:
backBtn.addEventListener(MouseEvent.CLICK, clicked);
function clicked(e:MouseEvent):void{
gotoAndStop(returnFrame);
};
September 5, 2008
awesome thanks,
Do you know if there are instructions on how to do that?
Participating Frequently
September 5, 2008
Create a variable to hold the value of the last frame you were on. Update it when you leave that frame?