Highlighted

ActionScript 3.0 - Advanced Layers and buttons not getting along

New Here ,
Dec 05, 2019

Copy link to clipboard

Copied

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);
}

TOPICS
ActionScript, Code, Timeline

Views

28

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

ActionScript 3.0 - Advanced Layers and buttons not getting along

New Here ,
Dec 05, 2019

Copy link to clipboard

Copied

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);
}

TOPICS
ActionScript, Code, Timeline

Views

29

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Dec 05, 2019 0
830293 LATEST
New Here ,
Dec 09, 2019

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 09, 2019 0