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

Button control Movie clip

Community Beginner ,
May 18, 2015 May 18, 2015

Hi,

I have a script that work well: (No problems..)

Buth_CathRed.addEventListener(MouseEvent.CLICK, fl_ClickToGoToNextFrame_2);

function fl_ClickToGoToNextFrame_2(event:MouseEvent):void

{

  nextFrame();

}

This script controa simple timline (Just jump from one keyframe to another and back..  - Only 2 keyFrames at this movie)

I want to add another script that will work when i will press on the same button (Buth_CathRed).

This is the script that want to add:

this.Pannel_m.gotoAndStop(2);


The button suppose to control also another movie clip that is outside the button movieclip.


I dont understand how and were do I add that script  ( this.Pannel_m.gotoAndStop(2);  )


I cant put them on the same timeline becouse one has animation and one is static..



also: what is the simplest way to creat simple scrip the button that control movie clip (The button is outside the MC)?..


Thanks alot!!!

and hope I wrote it right.. (:

TOPICS
ActionScript
298
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 ,
May 18, 2015 May 18, 2015

It is not clear from your description where the different object reside relative to the main timeline.  One way to approach a design is to keep all of the code in the main timeline to make it simpler to determine the path to targeting different objects.

If the button is inside a movieclip and Pannel_m is also in the timeline that the movieclip is in then you would have to use a Movieclip(parent) reference to target back to the parent timeline.  But if you place all the code in the main timeline it becomes easier to manage the targeting because everything has the same reference basis.

The following works if Pannel_m is in the same timeline as the Buth_CathRed

Buth_CathRed.addEventListener(MouseEvent.CLICK, fl_ClickToGoToNextFrame_2);

function fl_ClickToGoToNextFrame_2(event:MouseEvent):void

{

     nextFrame();

     Pannel_m.gotoAndStop(2);

}

The following works if Pannel_m is in the same timeline as the movieclip that contains Buth_CathRed

Buth_CathRed.addEventListener(MouseEvent.CLICK, fl_ClickToGoToNextFrame_2);

function fl_ClickToGoToNextFrame_2(event:MouseEvent):void

{

     nextFrame();

     Movieclip(parent).Pannel_m.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
Community Beginner ,
May 19, 2015 May 19, 2015

Thanks!!

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 ,
May 19, 2015 May 19, 2015
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