flash - AS3 Tracing a Class extended from the Event Class -


i have created class (extends event class) use in 1 of projects. if trace custom event object in called function 'event' type, if trace timerevent, or mouseevent, etc, timerevent or mouseevent... let me demonstrate:

var c:customobject = new customobject(); c.addeventlistener(customevent.on_send_message,fnc);  function fnc(e:customevent) {     trace(e); } 

this traces:

[event type="onsendmessage" bubbles=false cancelable=false eventphase=2] 

while code:

var f:timer = new timer(2000); f.addeventlistener(timerevent.timer,th); f.start();  function th(e:timerevent):void {     trace(e); } 

traces this:

[timerevent type="timer" bubbles=false cancelable=false eventphase=2] 

why custom event class not trace [customevent ...]

you need override tostring() method:

public override function tostring(): string {    return "[customevent]"; } 

disclaimer: haven't used flash/flex in while. think correct.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -