Re: [Flashcoders] dispatching events at creation time?
if you subclass movieclip then you have access to the onLoad method. Just overload that and put your dispatch in there public function onLoad():Void { dispatchEvent({type:'onload', target:this}); } [EMAIL PROTECTED] wrote: A little late in the (reply) game, but you could try: MovieClip.prototype.onConstruct = function() { trace("created") } This will be called anytime a new clip is created. You could, however, weed out the unwanted dispatching of events, by dispatching based upon the name of the clip created, i.e.: MovieClip.prototype.onConstruct = function() { if(this._name == "myMC"){ trace("created") } } Hope that helps. ---Original Message- From: flashcoders-bounces at chattyfig.figleaf.com [mailto:flashcoders-bounces at chattyfig.figleaf.com] On Behalf Of Luca Candela Sent: donderdag 16 februari 2006 16:01 To: flashcoders at chattyfig.figleaf.com Subject: [Flashcoders] dispatching events at creation time? -- class tryOut { public var addEventListener:Function; public var removeEventListener:Function; private var dispatchEvent:Function; function tryOut() { mx.events.EventDispatcher.initialize(this); trace("I am Here 1"); dispatchEvent({type:"created", target:this}); } public function callMe():Void { dispatchEvent({type:"created", target:this}); } } -- when I instantiate this class everything works except the dispatchEvent in the constructor of the class. Why and how can I do to force an object to call me back when he is created? ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE:[Flashcoders] dispatching events at creation time?
A little late in the (reply) game, but you could try: MovieClip.prototype.onConstruct = function() { trace("created") } This will be called anytime a new clip is created. You could, however, weed out the unwanted dispatching of events, by dispatching based upon the name of the clip created, i.e.: MovieClip.prototype.onConstruct = function() { if(this._name == "myMC"){ trace("created") } } Hope that helps. ---Original Message- From: flashcoders-bounces at chattyfig.figleaf.com [mailto:flashcoders-bounces at chattyfig.figleaf.com] On Behalf Of Luca Candela Sent: donderdag 16 februari 2006 16:01 To: flashcoders at chattyfig.figleaf.com Subject: [Flashcoders] dispatching events at creation time? -- class tryOut { public var addEventListener:Function; public var removeEventListener:Function; private var dispatchEvent:Function; function tryOut() { mx.events.EventDispatcher.initialize(this); trace("I am Here 1"); dispatchEvent({type:"created", target:this}); } public function callMe():Void { dispatchEvent({type:"created", target:this}); } } -- when I instantiate this class everything works except the dispatchEvent in the constructor of the class. Why and how can I do to force an object to call me back when he is created? ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] dispatching events at creation time?
I resolved this issue with a callback to a function defined outside the class that sends the Event. anyone can tell me anything about my other problem of the day? On 2/16/06, John Giotta <[EMAIL PROTECTED]> wrote: > > > You can dispatch a Event at creation time, but no listener can listen to > > this event at creation time ;-) > > Yeah that would help. > > ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] dispatching events at creation time?
Just a quicky, but why would you want to know when an object is created? If you don't give anything back (like throwing an exception) you van assume the contructing worked can't you? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Luca Candela Sent: donderdag 16 februari 2006 16:01 To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] dispatching events at creation time? -- class tryOut { public var addEventListener:Function; public var removeEventListener:Function; private var dispatchEvent:Function; function tryOut() { mx.events.EventDispatcher.initialize(this); trace("I am Here 1"); dispatchEvent({type:"created", target:this}); } public function callMe():Void { dispatchEvent({type:"created", target:this}); } } -- when I instantiate this class everything works except the dispatchEvent in the constructor of the class. Why and how can I do to force an object to call me back when he is created? ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] dispatching events at creation time?
> You can dispatch a Event at creation time, but no listener can listen to > this event at creation time ;-) Yeah that would help. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] dispatching events at creation time?
You can dispatch a Event at creation time, but no listener can listen to this event at creation time ;-) What came firstThe chicken or the egg? ;-) Luca Candela schrieb: > -- > class tryOut { > > public var addEventListener:Function; > public var removeEventListener:Function; > private var dispatchEvent:Function; > > function tryOut() { > mx.events.EventDispatcher.initialize(this); > trace("I am Here 1"); > dispatchEvent({type:"created", target:this}); > > } > > public function callMe():Void { > dispatchEvent({type:"created", target:this}); > } > } > -- > when I instantiate this class everything works except the dispatchEvent in > the constructor of the class. Why and how can I do to force an object to > call me back when he is created? > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] dispatching events at creation time?
I've done it the same you have, but it only worked correctly in IE. Basically, I was replacing the MovieClip.onLoad, but when I tested in Firefox it never happened. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] dispatching events at creation time?
-- class tryOut { public var addEventListener:Function; public var removeEventListener:Function; private var dispatchEvent:Function; function tryOut() { mx.events.EventDispatcher.initialize(this); trace("I am Here 1"); dispatchEvent({type:"created", target:this}); } public function callMe():Void { dispatchEvent({type:"created", target:this}); } } -- when I instantiate this class everything works except the dispatchEvent in the constructor of the class. Why and how can I do to force an object to call me back when he is created? ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com