Copy link to clipboard
Copied
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.. (:
Copy link to clipboard
Copied
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);
}
Copy link to clipboard
Copied
Thanks!!
Copy link to clipboard
Copied
You're welcome
Find more inspiration, events, and resources on the new Adobe Community
Explore Now