Search code examples
actionscript-3apache-flex

How to Switch to a Frame Visually, Without Running its Actionscript?


I've run to a problem. I've got a SWF that is divided into frames. What I'm trying to do, is switch to one of my frames which has actionscript code, but I just want the visual elements to be displayed, without executing the actionscript code it contains.

I am trying to switch to this frame using gotoAndStop("frame-name");

I've tried to add a boolean value to the code in this frame, that decides whether or not it gets executed, I set the value the first time that frame's actionscript is executed, but this value is ignored as if using gotoAndStop creates a new instance of that frame's actionscript code, so it doesn't retain the boolean value I set.

Is there any way to not allow actionscript execution of this frame?


Solution

  • Nope, not really, at least not given how the solution 'seems' to work!

    What you can do is to create another keyframe (f6 in editor I think) that looks identical and then do gotoAndStop("other_frame").

    As long as that keyframe doesn't have any code you're good to go :)

    The most common solution for flash-development is to not have code inside your fla-file and instead have it in AS-files and only have visual elements inside the fla. That way you have full control of what is happening and when etc...