سؤال

I have a class called "airport" which extends movieclip. I have, successfully, managed to add a mouseclick-eventlistener for every object of the class that i create.

When I click on one of the objects, I am supposed to enter frame 2 on the main timeline.

I've tried to use the following code inside the class:

this.addEventListener(MouseEvent.CLICK, clickHandler);

private function clickHandler(evt:MouseEvent):void
    {
        MovieClip(parent).nextFrame();
    }

When I click on one of the objects, I don't enter frame 2, but the whole screen goes blank. Any ideas? Thanks for advice.

PS: If you request more of my code to provide an answer, I would be happy to provide it.

هل كانت مفيدة؟

المحلول 2

Oh..I just found the error. In my code I used the line

this.parent.visible = false

to hide the objects when I entered next frame.

What I did not know was that this also would hide every other movieclip, which results in the screen beeing totally white.

نصائح أخرى

Whatever 'this' is isn't a direct child of the main timeline. Try this:

private function clickHandler(evt:MouseEvent):void {
    MovieClip(root).nextFrame();
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top