I am really new to actionscript 3 and am having some trouble wrapping my brain around this. I have what basically amounts to a slideshow with navigation. I have a menu frame that has buttons, that when clicked, move across the timeline to a specific frame and stops.
From there the navigation has 3 buttons…“menu” (goes back to menu) and “previous” and “next” which have actions associated with it to go to next frame or previous frame. I have an actions layers that has the code in it and it works fine from the menu (attached is the menu actionscript) as long as I click on the item that is on the keyframe directly under the keyframe containing the actionscript. How can I get the frames that aren’t directly under the actionscript frame to use the actions?
Attached is the code for the menu keyframe and the slides beyond it
/////////////////////////////////////////// code for the menu keyframe on it’s own actions layer
stop();
import flash.events.MouseEvent;
btnShoulder.addEventListener(MouseEvent.CLICK, onClick);
function onClick(event:MouseEvent):void
{
gotoAndStop(41)
}
btnWrist.addEventListener(MouseEvent.CLICK, onClick2);
function onClick2(event:MouseEvent):void
{
gotoAndStop(50)
}
btnKnee.addEventListener(MouseEvent.CLICK, onClick3);
function onClick3(event:MouseEvent):void
{
gotoAndStop(44)
}
btnAdvantage.addEventListener(MouseEvent.CLICK, onClick4);
function onClick4(event:MouseEvent):void
{
gotoAndStop(52)
}
////////////////////////////////// actions for the frames beyond the menu frame
stop();
import flash.events.MouseEvent;
btnMenu.addEventListener(MouseEvent.CLICK, onClick6);
function onClick6(event:MouseEvent):void
{
gotoAndStop(40);
}
btnPrevious.addEventListener(MouseEvent.CLICK, goBack);
btnNext.addEventListener(MouseEvent.CLICK, goForward);
function goBack(event:MouseEvent):void {
if (currentFrame == 40)
{
stop();
}
else
{
this.prevFrame();
}
}
function goForward(event:MouseEvent):void {
if (currentFrame == 52)
{
stop();
}
else
{
this.nextFrame();
}
}
var lc:LocalConnection = new LocalConnection();
btnClose.addEventListener(MouseEvent.CLICK, closeMe, false, 0, true);
function closeMe(e:MouseEvent): void {
btnClose.removeEventListener(MouseEvent.CLICK, closeMe);
lc.send("lcClient","closeBio");
}