hon
hon

Reputation: 135

actionscript3 custom event in flash

I want to dispatch a custom event at the end of my movieclip. I wrote the code on the last frame:

stop();

import flash.events.Event;

var evt:Event = new Event('finishedWriting', true); this.dispatchEvent(evt);

this.addEventListener("finishedWriting", evtHandler);

function evtHandler(evt:Event):void{ trace('finished'); }

but this does not work. Any suggestions? Thank you very much.

Upvotes: 0

Views: 67

Answers (1)

shanethehat
shanethehat

Reputation: 15570

You're dispatching the event before the listener is set up.

Upvotes: 1

Related Questions