Copy link to clipboard
Copied
You know, I used to know AS2. It was fun. It was easy. And then after a break I've tried to pick up AS3 and everything is going horribly, horribly wrong. Even searching online forums I can't work out how to get the solution I need. I could revert back to AS2, but I am determined I am not going to let AS3 beat me. Someone please help!
I am trying to add Next and Back buttons that will jump users between keyframes.
I have a layer called Actions, and a layer called Buttons. The Buttons layer has two buttons of different types with Instance Names of "btn_Next" and "btn_Back" respectively.
Both layers have keyframes at frame 30 and frame 60.
The actions on frame 30 and frame 60 both say "stop();"
At present the action on frame 1 on the Actions layer says:
import flash.events.MouseEvent;
stop();
btn_Back.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler1);
function mouseDownHandler1(event:MouseEvent):void
{
prevFrame();
}
btn_Next.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler2);
function mouseDownHandler2(event:MouseEvent):void
{
nextFrame();
}
When I press Ctrl + Enter I am currently getting the error message
"TypeError: Error #1123: Filter operator not supported on type builtin.as$0.MethodClosure. at [Filename]_fla::MainTimeline/frame1()"
and the buttons do nothing.
Where am I going wrong?
The thing I get particularly confused about reading other posts is whether I need to reproduce this code on each keyframe, or only on Frame 1 of the Actions layer. I tried adding it to each keyframe, but then got errors about duplicating my functions. So I tried removing the functions from all keyframes after the first one, but that didn't work either.
I tried changing my instance names on each keyframe and changing the code on each keyframe, but that didn't seem to work either. And it seems like a really inefficient way to do things.
Someone please help me.
Mary
there's nothing in that code that would trigger that error.
create a new flash, add your two buttons, then copy and paste that code into your new fla. retest.
Copy link to clipboard
Copied
there's nothing in that code that would trigger that error.
create a new flash, add your two buttons, then copy and paste that code into your new fla. retest.
Copy link to clipboard
Copied
The code you showed has nothing to do with the error the way it is.
Most probably you have an extra dot elsewhere in the code.
For example this syntax will throw the same error - note dot between addEventListener and (
btn_Back.addEventListener.(MouseEvent.MOUSE_DOWN, mouseDownHandler1);
Copy link to clipboard
Copied
I found the rogue fullstop, so the error message is no longer coming up.
But the buttons are still not doing anything. I click the Next button, and nothing happens.
Copy link to clipboard
Copied
in frame one of the timeline that contains that code you need two buttons or movieclips (with instance names btn_Next and btn_Back) on-stage. if those buttons are clickable, that code will work.
you can use the trace function to test if you're clicking the correct buttons/movieclips.
Copy link to clipboard
Copied
A co-worker helped me resolve this issue. There were two things I was doing wrong:
Thank you for hte help kglad and Andrei1.
Copy link to clipboard
Copied
you're welcome.