Copy link to clipboard
Copied
I am having problems doing button navigation between frames. I have followed a few tutorials and am 99.9% sure I am doing what is shown. I can get the button to move forward to an other frame but the button I creat there that I would like to go back to frame 1 gives me an error.
"Scene 1, Layer 'Layer_4', Frame 2, Line 9, Column 1 1120: Access of undefined property back_bt."
back_bt is the instance name of the button.
Here is the code from a simple mock up that I am just trying to get to work.
On Frame one with my play_bt buttion(I am even using the code snippet generated code)
stop()
play_bt.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame);
function fl_ClickToGoToAndStopAtFrame(event:MouseEvent):void
{
gotoAndStop(2);
}
On Frame two with my back_bt button (Again I am using the code snippet generated code)
stop()
back_bt.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_2);
function fl_ClickToGoToAndStopAtFrame_2(event:MouseEvent):void
{
gotoAndStop(1);
}
I know the first button works(all I have to do is comment out the button on frame two). I also know I could do this on frame one and hide the different backgrounds and buttons. I did that with this code.
yes_but.addEventListener(MouseEvent.CLICK, clickListner);
no_but.addEventListener(MouseEvent.CLICK, clickListner2);
back.addEventListener(MouseEvent.CLICK, clickListner4);
var startGame:int = 0
leave.visible = false
back.visible = false
//no_but.addEventListener(MouseEvent.CLICK, ClickListner2);
//stop()
function clickListner(event:MouseEvent): void
{
trace("Yes Button")
startGame = 1
}
function clickListner2(event:MouseEvent):void
{
trace("No Button")
//gotoAndStop(5);
start_up.visible = false
no_but.visible = false
yes_but.visible = false
back.visible = true
leave.visible = true
}
function clickListner4(event:MouseEvent): void
{
start_up.visible = true
no_but.visible = true
yes_but.visible = true
leave.visible = false
back.visible = false
}
But I want to be able to go back and forth to different parts of the timeline. Is this no longer possible in ActionScript 3.0? Like you can't pass data back and forth to a symbol action script, I believe you use to be able to use _root.(variable name) to access a variable on the main time line. This no longer works. I am hoping there is a way to create buttons on different frames on the time line. Any help in this matter ill be much appreciated. Thanks
1 Correct answer
Hi.
Go to the Document Settings (Ctrl/Cmd + J) and uncheck "Use Advanced Layers".
Regards,
JC
Copy link to clipboard
Copied
Hi.
Go to the Document Settings (Ctrl/Cmd + J) and uncheck "Use Advanced Layers".
Regards,
JC
Copy link to clipboard
Copied
Thank you so much. Here's a follow up question, what and when do we need "Advanced Layers"?
Copy link to clipboard
Copied
You're welcome!
Advanced layers are necessary when you need to work with some of Animate's newest features.
In Animate CC, with Advanced Layers mode, all layers in timeline are published as symbols. Advanced layers mode allows you to access the following features:
Create timeline layers with Animate CC
To accesss instances with advanced layers you may have to target the layer that is automatically turned into a symbol by Animate before trying to access the instance itself.
var layer:MovieClip = getChildByName("Layer_1") as MovieClip;
var char:MovieClip = layer.getChildByName("hero") as MovieClip;
Regards,
JC

