Copy link to clipboard
Copied
Im a beginner at action script and some of the buttons work but as soon as it reaches another page/frame, all of the buttons seem to not work.
TypeError: Error #1010: A term is undefined and has no properties.
at Interactive_storyboard_group_project_fla::MainTimeline/frame11()[Interactive_storyboard_group_project_fla.MainTimeline::frame11:3]
at flash.display::MovieClip/gotoAndPlay()
at Interactive_storyboard_group_project_fla::MainTimeline/fl_ClickToGoToAndPlayFromFrame_5()[Interactive_storyboard_group_project_fla.MainTimeline::frame1:182]
This was the highlight:
scene_2_story.prevBTN.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_18);
YES. unless absolutely essential. disable it and make that your default setting when starting new fla's.
Copy link to clipboard
Copied
Hi.
Either scene_2_story button or the function fl_ClickToGoToAndPlayFromFrame_18 is not present in frame 11.
Can you verify this?
Regards,
JC
Copy link to clipboard
Copied
Both of these exist, first hand I've had the issue of prevBTN being undefined, but after adding scene_2_story since it's my layer name and I'm working with advanced layers seems to bring up this issue.
Copy link to clipboard
Copied
To use layers in AS3 in recent versions of Animate, make sure all conditions below are true:
- The advanced layers mode is on (Cmd/Ctrl + J > Use Advanced Layers);
- The virtual camera is on the stage;
- The layer you want to target is on the main timeline;
- The layer you want to target is not empty.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
copy and paste here your frame 11 code.
are you using any advanced layers benefit?
Copy link to clipboard
Copied
scene_2_story.prevBTN.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_18);
function fl_ClickToGoToAndPlayFromFrame_18(event:MouseEvent):void
{
prevBTN.gotoAndPlay("homepage");
}
The scene_2story doesn't have any impact, just seems to move the undefined error from the Compiler tab to the Output tab
Copy link to clipboard
Copied
the first line of code isn't line 3. do you have 2 blank lines above it?
or what version of animate are you using and upload your fla somewhere and post a link.
Copy link to clipboard
Copied
Here is the.fla file
Copy link to clipboard
Copied
https://drive.google.com/drive/folders/16rWaTqY12an_ZhNQvEIVaSJh2SdKpg_X?usp=share_link
Here is the fla file, apologies for the other reply since it doesn't allow me to attach it directly
Copy link to clipboard
Copied
turn off advanced layers and stop referencing any layers in code.
Copy link to clipboard
Copied
Forgot to add, I'm only using the camera at the moment but no heavy movement, I've heard there are bugs with using advanced layers. Do you advise me to disable it ?
Copy link to clipboard
Copied
YES. unless absolutely essential. disable it and make that your default setting when starting new fla's.
Copy link to clipboard
Copied
Also your layers end before each script frames. Make sure the instances you need are available.
Copy link to clipboard
Copied
I got an error in which the compiler doesn't know what prevBTN is. So I added the corresponding layer name like this:
stop();
scene_2_story.prevBTN.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_18);
function fl_ClickToGoToAndPlayFromFrame_18(event:MouseEvent):void
{
scene_2_story.prevBTN.gotoAndPlay("homepage");
}
Copy link to clipboard
Copied
the solution is easy enough. disable advanced layers and remove references to layers in the code, or use advanced layers and use object layers in all the code.
but that doesn't explain why, with advanced layers enabled, the error is on line 3 in the op's posted code when the error on line 7.
i don't think we can determine much from the fla because the op change somethings after posting the error message.
Copy link to clipboard
Copied
I only removed the scene_2_story part on both instances of prevBTN in the code, adding it makes no difference like I mentioned, sorry for any inconvenience.
I'll take the path of disabling the advanced layer since I'm not very good at the concept of coding.
Copy link to clipboard
Copied
what about the code in frame 1? there's no reference to a layer there and in frame 11, one reference contains a layer and another doesn't. i think you're confused over something simple.
again,
either use advanced layers and use those layer names in all object references or
disable advanced layers and use no layer names in object references.
to make this simpler. which do you want? advanced layers or not?
Copy link to clipboard
Copied
I've decided to have it without Advanced layers and it's now working fine.
I've tried referencing the layer which gave me that output text in the post's error highlight, which is smth I assumed I did wrong, a guide or pointer would be very helpful in case I need to use advanced layers in the future.
Thank you very much!
Copy link to clipboard
Copied
if you needed to use advanced layer, you would use the layer names. (though that looks optional in the first frame for some reason.)
Copy link to clipboard
Copied
Which is another reason that got me super confused and the layer names not working, I'll do some more research after and see what I did wrong, thanks again
Copy link to clipboard
Copied
that frame 1 exception, i do not understand.