Skip to main content
Participant
July 16, 2015
Answered

How to Navigate to a frame in a movieclip type symbol?

  • July 16, 2015
  • 1 reply
  • 238 views

What I mean is, like to pick up an item in-game and then use it. for example a pair of tweezers, when you click they shut, and when you click again, they open. I am unsure on how to do this.

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

The commands you would use would be along the lines of....

tweezer.gotoAndStop("shut");

tweezer.gotoAndStop("open");

where you have assigned an instance name of "tweezer" and you create those labels in the tweezer instance's timeline.

For the clicking part you could do something like the following to incorporate them...

var tweezerShut:Boolean = false; // assuming they start off open

tweezer.addEventListener(MouseEvent.CLICK, useTweezer);

function useTweezer(evt"MouseEvent):void {

     if(tweezerShut){

           tweezer.gotoAndStop("open");

     } else {

           tweezer.gotoAndStop("shut");

     }

     tweezerShut = !tweezerShut;   // update the status to its opposite

}

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
July 16, 2015

The commands you would use would be along the lines of....

tweezer.gotoAndStop("shut");

tweezer.gotoAndStop("open");

where you have assigned an instance name of "tweezer" and you create those labels in the tweezer instance's timeline.

For the clicking part you could do something like the following to incorporate them...

var tweezerShut:Boolean = false; // assuming they start off open

tweezer.addEventListener(MouseEvent.CLICK, useTweezer);

function useTweezer(evt"MouseEvent):void {

     if(tweezerShut){

           tweezer.gotoAndStop("open");

     } else {

           tweezer.gotoAndStop("shut");

     }

     tweezerShut = !tweezerShut;   // update the status to its opposite

}