Copy link to clipboard
Copied
Hey,
I hope you can help, I think its very simple but I am jsut starting.
I want to close my menu. The picture(converted into movie clip) is in the layer "Button_an" on frame 10.
therefore I created an empty keyframe on frame 10 with the following code:
menu_close.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame);
function fl_ClickToGoToAndStopAtFrame(event:MouseEvent):void
{
gotoAndStop(1);
}
I already checked the name - its correct
I already checked if the code is in the right frame action (its 10, thats correct)
however, there is an error saying, that my menu_close is not beingt defined (error: 1120:Access of undefined property error )
thanks for hleping out!
a better solution:
disable advanced layers (modify>document>untick 'use advanced layers').
info about advanced layers: https://helpx.adobe.com/animate/using/timeline-layers.html#advanced-layers
Copy link to clipboard
Copied
menu_close does not exist when the error message is triggered.
Copy link to clipboard
Copied
Hey, tahnks for replying.
As shown in the screenshot, it does exist - dunno why the error massage states that
Copy link to clipboard
Copied
you didn't show that it exists when the error message is triggered. you showed it exists at some point/time.
Copy link to clipboard
Copied
it exists but somehow still triggers. Any suggestions?
Copy link to clipboard
Copied
here is a better screenshot with the isntance name
Copy link to clipboard
Copied
remove that tween (which changes your menu_close reference).
Copy link to clipboard
Copied
what exactly do u mean with removing the tween?
Copy link to clipboard
Copied
right click the tween span > remove tween.
Copy link to clipboard
Copied
I dont created a "tween". I just made a picture into my timelane (Layer "Button an") and put 1 picutre over 10 frames in it (including the drop downmenu and the close button (arrow) and that arrow I converted into a movieclip and want to, by clicking, get back to frame 1
Copy link to clipboard
Copied
why is your timeline, at that layer/frame span, blue?
Copy link to clipboard
Copied
bexause i clicked on it - meaning its the selected layer, which my movieclip "menu_close" is on
Copy link to clipboard
Copied
upload your fla somewhere and post a link.
Copy link to clipboard
Copied
ok, thanks so much
Copy link to clipboard
Copied
i can't determine what you've done setting up that file to cause all the problems you're going to have.
my suggestion is to start with a new fla and careful add items and code in steps, checking for errors frequently.
if you just want to resolve the current error, click the problematic frame in the timeline (to select all items)>right click over the stage items>click distribute to layers. test.
Copy link to clipboard
Copied
I did it again very clean, still not working
somehow if I have the close button from frame 1to10 - it works, but I want the button only to appear when opening the mnu on frame 5 - any suggestions?
Copy link to clipboard
Copied
again, if you just want to resolve the current error, click the problematic frame in the timeline (to select all items)>right click over the stage items>click distribute to layers. test.
Copy link to clipboard
Copied
ok, oh mygod it worked thank you so much - can you explain why tho? I dont get it? cant there be 2 items in 1 layer in the same frame?
Copy link to clipboard
Copied
a better solution:
disable advanced layers (modify>document>untick 'use advanced layers').
info about advanced layers: https://helpx.adobe.com/animate/using/timeline-layers.html#advanced-layers
Copy link to clipboard
Copied
Sorry, I mean "exists at runtime", when the code executes. Normally, the code executes first, and then, the graphic elements. This is why, maybe, if you delay your function (using a timing event), the error is gone.
Copy link to clipboard
Copied
so what code do I include or? .. sorry I am a beginner 😕 cant quite understand
Copy link to clipboard
Copied
You need to be sure that the function run after menu_close exists. Maybe, this event can help you: www.w3schools.com/js/js_timing.asp
Copy link to clipboard
Copied
I used this function on my first frame for another movieclip, it does work, it only works in the first frame tho ..