Skip to main content
Participant
December 5, 2019
Question

ActionScript 3.0 - Advanced Layers and buttons not getting along

  • December 5, 2019
  • 1 reply
  • 229 views

I've been struggling with this for a while now. I have a multi-scene file that utilizes Advanced Layers (namely the Virtual Camera tool), and buttons - said buttons were coded by means of Code Snippets. When the Advanced Layers are used within a scene, the buttons in that scene don't function. I turn them off, and they do. Problem is, I have to have the camera in this one scene that uses it, the multiple scenes and the buttons, so I'm a tad stuck. I've seen other threads floating around but they didn't yield the answer I was looking for.

 

I can attach the button's name directly to the code snippet and it won't load the SWF with compiler errors, but the buttons don't function beyond their u/o/d frames; their actual code assigned doesn't run.

 

I don't have any coding experience, so you might have to point some things out directly, but it shouldn't be too much of an issue.

 

Code:

stop();

internal var myLayer:MovieClip
internal var myLayer2:MovieClip

var myLayer = MovieClip(getChildByName("main_menu_button"))
myLayer.button_3

button_3.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_5);

function fl_ClickToGoToScene_5(event:MouseEvent):void
{
MovieClip(this.root).gotoAndPlay(1, "menu");
}

var myLayer2 = MovieClip(getChildByName("replay_button"))
myLayer2.button_4

button_4.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_2);

function fl_ClickToGoToAndPlayFromFrame_2(event:MouseEvent):void
{
gotoAndPlay(1);
}

This topic has been closed for replies.

1 reply

830293Author
Participant
December 9, 2019

I have since tried layer_name.button_name.code (which compiles without error), but then the buttons don't actually do anything.