Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Next frame for only ONE layer, not the entire scene?

New Here ,
Jul 22, 2014 Jul 22, 2014

Hi,

I am new to Flash and am trying to create a button (button1_btn) that will change the color of an object (object1). I couldn't find any answers on how to go about this, so I've colored object1 black in Frame 1 and pink in Frame 2. In Frame 1 of object1, I've given the action below. However, this makes the WHOLE scene go from Frame 1 to Frame 2 and I only want object1 to switch to Frame 2. How do I specify that I only want object1 to change frames? Hopefully this makes some sense.

If there is an simpler way to change the color of an object by clicking on a button, please let me know!  Thank you for your help.

button1_btn.addEventListener (MouseEvent.CLICK, Shoot_2);

function Shoot_2 (event:MouseEvent) :void

{

     gotoAndStop(1);

}

TOPICS
ActionScript
372
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jul 22, 2014 Jul 22, 2014

change gotoAndStop(1) to

object1.nextFrame();

or

object1.gotoAndStop(2);

Note that I'm nearly sure that frames are 1 based, not zero based, so gotoAndStop(1) should actually put you on the first frame, not the second.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 22, 2014 Jul 22, 2014

Thank you so much for your reply.

I tried both of your recommendations (code for gotoAndStop option is below), but I get the same error message for both:

1061: Call to a possibly undefined method gotoAndStop through a reference with static type flash.display:SimpleButton.

Have I done something wrong, again? Thank you .


stop();

button1_btn.addEventListener (MouseEvent.CLICK, Shoot_2);

function Shoot_2 (event:MouseEvent) :void

{

  object1.gotoAndStop(2);

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 23, 2014 Jul 23, 2014

It appears you created object1 as a button symbol instead of as a movieclip symbol.  When you first create the symbol be sure that Movieclip is selected in the drop down.

You might be able to fix this as is by changing it to be a Movieclip symbol in two places... 1) select the object on the stage and in the Properties specify it as being a Movieclip  2) Right click the symbol in the library and choose the Properties option and change it to be a Movieclip there also.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jul 23, 2014 Jul 23, 2014

I think you only need to change it on the Timeline/Stage

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 25, 2014 Jul 25, 2014

That worked . Thank you for all of your help!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 25, 2014 Jul 25, 2014
LATEST

You're welcome

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines