[Flashcoders] Constructors in AS2 SWFs not being called when loaded by AS3
I've got an AS 2.0 (Flash 8) SWF that creates a class, and traces a property on that class... Something like this: foo = new Thingy(); trace(foo.test); All the class does is initialize that property; something like this: class Thingy { public var test:String; public function Thingy() { test = hello; } } This is pretty basic stuff -- and it works as expected. When run, it simply traces hello. I then create an AS3 / Flash 9 app that loads the aforementioned SWF... Something like this: As2thing = new Loader(); addChild(As2thing); As2thing.load(new URLRequest(as2thing.swf)); Then suddenly, as2thing.swf doesn't quite behave the same; the Thingy's constructor doesn't get called -- it traces undefined instead. Any idea why? - Kipp ___ 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] Constructors in AS2 SWFs not being called when loaded by AS3
Hello :) In the FP9 you can find 2 virtual machines, one for the AS3 and one for the AS1/2 .. you can use AS1/2 or AS3 code but not the AS3 and the AS1/2 in the same time :) If you want communicate between your SWFs running in AVM1 and AVM2.. you must use the LocalConnection class :) a french article about this : http://www.envrac.org/index.php/2006/07/07/98-as3-avm1-et-avm2 You can too read the article about the ApplicationDomain : http://livedocs.adobe.com/flex/2/langref/flash/system/ApplicationDomain.html EKA+ :) 2007/4/7, Michael Mudge [EMAIL PROTECTED]: I've got an AS 2.0 (Flash 8) SWF that creates a class, and traces a property on that class... Something like this: foo = new Thingy(); trace(foo.test); All the class does is initialize that property; something like this: class Thingy { public var test:String; public function Thingy() { test = hello; } } This is pretty basic stuff -- and it works as expected. When run, it simply traces hello. I then create an AS3 / Flash 9 app that loads the aforementioned SWF... Something like this: As2thing = new Loader(); addChild(As2thing); As2thing.load(new URLRequest(as2thing.swf)); Then suddenly, as2thing.swf doesn't quite behave the same; the Thingy's constructor doesn't get called -- it traces undefined instead. Any idea why? - Kipp ___ 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] Constructors in AS2 SWFs not being called when loaded by AS3
Is there any reason why you aren't porting over the Thingy class from AS2 to AS3? It might be easier to rewrite the class using AS3. Nick On 4/6/07, Michael Mudge [EMAIL PROTECTED] wrote: I've got an AS 2.0 (Flash 8) SWF that creates a class, and traces a property on that class... Something like this: foo = new Thingy(); trace(foo.test); All the class does is initialize that property; something like this: class Thingy { public var test:String; public function Thingy() { test = hello; } } This is pretty basic stuff -- and it works as expected. When run, it simply traces hello. I then create an AS3 / Flash 9 app that loads the aforementioned SWF... Something like this: As2thing = new Loader(); addChild(As2thing); As2thing.load(new URLRequest(as2thing.swf)); Then suddenly, as2thing.swf doesn't quite behave the same; the Thingy's constructor doesn't get called -- it traces undefined instead. Any idea why? - Kipp ___ 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