Skip to main content
January 12, 2011
Answered

Back to the previous swf

  • January 12, 2011
  • 1 reply
  • 362 views

I'm not sure if Flash is capable of doing this directly or not, but I was wondering if there was any way to code a button to go back to a previous swf. The setup here is that we have a Flash app with about 40 different swfs that load into the same level through navigation and each page has 1 button (among many others) which loads a diagram that is the same for all these pages. On our older version of this app, we had a separate swf for each of these diagram swfs so the user could simply go back to the previous swf. This is by no means a sophisticated way of achieving this, but it does work. Obviously it is a nightmare if we ever have to make any change to the diagram swf because that involves changing 40 files which isn't something we want to do. One thing we considered is having this swf load onto the level above, but the problem with that is some of these swfs run pretty heavy and we really don't want to have too many of these swfs opened at the same time. So, is there any way to have Flash be aware of what swfs were loaded using a loadMovie command so you could simply click a button to load the previously loaded movie (swf)?

This topic has been closed for replies.
Correct answer Ned Murphy

Say you have a currentSWF variable and a prevSWF variable (both null to start with).  When you load an swf, you assign the value of currentSWF to prevSWF and the name of file that is being loaded to the currentSWF variable.  Repeating this for each loading, you end up always having the name of the previous swf available.

1 reply

Ned Murphy
Legend
January 12, 2011

You can have a variable (or variables) that you assign the name of the last file loaded and the current, which you assign when you are loading a new one.

January 12, 2011

That sounds good but how do you grab the swf name dynamically? Or would that just be entered in as the variable manually on each swf before navigating away?

Ned Murphy
Ned MurphyCorrect answer
Legend
January 12, 2011

Say you have a currentSWF variable and a prevSWF variable (both null to start with).  When you load an swf, you assign the value of currentSWF to prevSWF and the name of file that is being loaded to the currentSWF variable.  Repeating this for each loading, you end up always having the name of the previous swf available.