[Flashcoders] AS3 - loading external classes?
I'm wondering if anyone can help. I have an application I'm writing where, depending on user response, I need it to load an externally stored class and then be able to access that class from within the calling swf. I.e., I have a standard interface that I want to use to load various game classes without having to store the classes (games) directly in the interface. Can I store that external class as an .as, or do I have to compile it in to a .swf? Likewise, how do I go about loading it and accessing the defined class and methods then? Thanks to anyone that can help! Marty ___ 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] AS3 - loading external classes?
You must store the classes as compiled SWFs. The Flash Player cannot compile raw code on the fly. Once you load the SWF you will be able to access the classes it contains. However, make sure you aren't loading a classes with the same package/classname as a class that is already loaded. A previously loaded class with the same name will not be overwritten by the newly loaded class. There is also the concept of Runtime Shared Libraries (RSLs). I've only used these with Flex, so someone else would have to comment on CS3's ability (or lack thereof) to use RSLs. Derek Vadneau http://tracethis.com - Original Message - From: Martin Scott Goldberg [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Wednesday, September 05, 2007 11:10 AM Subject: [Flashcoders] AS3 - loading external classes? I'm wondering if anyone can help. I have an application I'm writing where, depending on user response, I need it to load an externally stored class and then be able to access that class from within the calling swf. I.e., I have a standard interface that I want to use to load various game classes without having to store the classes (games) directly in the interface. Can I store that external class as an .as, or do I have to compile it in to a .swf? Likewise, how do I go about loading it and accessing the defined class and methods then? Thanks to anyone that can help! Marty ___ 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] AS3 - loading external classes?
Everything that Derek is spot on. Specifically you will want to look at the ApplicationDomian class and it's getDefinition method. On 9/5/07, Derek Vadneau [EMAIL PROTECTED] wrote: You must store the classes as compiled SWFs. The Flash Player cannot compile raw code on the fly. Once you load the SWF you will be able to access the classes it contains. However, make sure you aren't loading a classes with the same package/classname as a class that is already loaded. A previously loaded class with the same name will not be overwritten by the newly loaded class. There is also the concept of Runtime Shared Libraries (RSLs). I've only used these with Flex, so someone else would have to comment on CS3's ability (or lack thereof) to use RSLs. Derek Vadneau http://tracethis.com - Original Message - From: Martin Scott Goldberg [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Wednesday, September 05, 2007 11:10 AM Subject: [Flashcoders] AS3 - loading external classes? I'm wondering if anyone can help. I have an application I'm writing where, depending on user response, I need it to load an externally stored class and then be able to access that class from within the calling swf. I.e., I have a standard interface that I want to use to load various game classes without having to store the classes (games) directly in the interface. Can I store that external class as an .as, or do I have to compile it in to a .swf? Likewise, how do I go about loading it and accessing the defined class and methods then? Thanks to anyone that can help! Marty ___ 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