9 Replies Latest reply on Feb 21, 2013 2:45 PM by kglad

    Conditional statement to improve navigation bar functions


      AS2 Question:


      I have created a four button navigation bar with normal state in frame 1, and hover states in frame 10, 20, 30 and 40.


      The hover states are done by adding a mask on each button to reveal a differetly colored layer on frame 10, 20, 30 and 40


      I have scripted the buttons like this:


      on (rollOver) {gotoAndPlay(10);



      on (rollOut) {gotoAndStop(1);




      on (press) {gotoAndPlay(1);



      on (release) {gotoAndPlay(9)



      On the four frames there are also a action that says:



      import flash.external.ExternalInterface;







      This all works well. The button triggers a javascript function on the page.



      Can I make the buttons stay in their over states when a button is clicked, so it serves like a clear marker which page the viewer has selected and is looking at?


      On release the page loads, but as soon as the pointer leaves the button,  the on rollout command puts the playhead at frame 1 again (with the normal state)


      1) Is the following possible:


      Put a conditional statement on frame 1 saying:


      If the playhead came from frame 10 then go to frame 10 and stop.

      If the playhead came from frame 20 then go to frame 20 and stop.

      If the playhead came from frame 30 then go to frame 30 and stop.

      If the playhead came from frame 40 then go to frame 40 and stop.

      else: stay on frame 1.




      2) Or is there another workaround I have not thought about?


      It would often be valuable to be able to track where the playhead just came from for example with sideways scrollers and other advanced layouts.


      Is that possible, and if so how?


      Thank you on beforehand.