Hi,
I had recently headacke with external loaded classes and that's what I found :
-loading an external swf without specifing the loaderContext, by default, you 
get your classes merged (or skipped if exist in parent swf) into the same root 
domain (is the same as new LoaderContext( false, 
flash.system.ApplicationDomain.currentDomain ) )
-loading an external swf with a loaderContext that has a new 
flash.system.ApplicationDomain( null ), you get your classes completly 
separated into different domains
-then you can merge some external classes with another external classes, by 
loading them into a same created domain "new flash.system.ApplicationDomain( 
null )" (you can imagine a list of domains so...)
I hope I haven't forgot anything :p


----- Mail Original -----
De: "Rich Rodecker" <[EMAIL PROTECTED]>
À: "Open Source Flash Mailing List" <[email protected]>
Envoyé: Vendredi 9 Mai 2008 19:34:47 GMT +01:00 Amsterdam / Berlin / Berne / 
Rome / Stockholm / Vienne
Objet: Re: [osflash] Class definitions


Only using packges is not enough in this case, since when a swf is loaded into 
another swf, the loaded swf's classes are partitioned into a separate 
applicationDomain by default, and Niels specifically wishes to use swf A's 
version of class C. 




On Fri, May 9, 2008 at 9:46 AM, Niels Wolf < [EMAIL PROTECTED] > wrote: 


Thanks for the comments. I guess I have enough right now. 

Niels 




On 5/9/08 6:10 PM, "Ian Thomas" < [EMAIL PROTECTED] > wrote: 

> The simplest answer - use packages. 
> 
> e.g. 
> Classes for SWF A should be in package com.mediacatalyst.a 
> Classes for SWF B should be in package com.mediacatalyst.b 
> 
> Without using packages - In AS3/AVM2, you can use different 
> applicationDomains to separate that sort of thing, but then if you do 
> so it's difficult to talk between the movies at all. 
> 
> HTH, 
> Ian 
> 
> 
> On Fri, May 9, 2008 at 4:50 PM, Niels Wolf < [EMAIL PROTECTED] > 
> wrote: 
>> Hey. 
>> 
>> I am looking into following scenario: 
>> 
>> SWF A loads other SWF B. 
>> 
>> A defines class C. 
>> B defines class C. 
>> 
>> If B calls on C it gets C from A! 
>> 
>> example: 
>> 
>> B.swf 
>> package{ 
>> import flash.text.TextField; 
>> import flash.display.Sprite; 
>> import flash.display.Loader; 
>> import flash.net.URLRequest; 
>> 
>> public class C extends Sprite{ 
>> private var variable:String = "I am C from B"; 
>> 
>> public function C(){ 
>> trace(variable); 
>> var txt:TextField = new TextField(); 
>> txt.text = variable; 
>> addChild(txt); 
>> } 
>> 
>> } 
>> } 
>> 
>> A.swf 
>> package{ 
>> import flash.text.TextField; 
>> import flash.display.Sprite; 
>> import flash.display.Loader; 
>> import flash.net.URLRequest; 
>> 
>> public class C extends Sprite{ 
>> private var variable:String = "I am C from A"; 
>> 
>> public function C(){ 
>> trace(variable); 
>> var txt:TextField = new TextField(); 
>> txt.text = variable; 
>> addChild(txt); 
>> 
>> var loader:Loader = new Loader(); 
>> loader.load(new URLRequest("B.swf")); 
>> } 
>> 
>> } 
>> } 
>> 
>> RUN A.swf outputs: 
>> I am C from A 
>> I am C from A 
>> I am C from A 
>> I am C from A 
>> ... 
>> 
>> 
>> Even as it sounds natural it implies mayor restrictions if your project 
>> requires nested swf loading. 
>> 
>> Is there a way to seal class definitions from each other but not objects (as 
>> the nested swfs have to talk to each other.. Though localconnection could be 
>> an awkward answer). 
>> 
>> Comments are welcome. 
>> 
>> Thanks 
>> 
>> \n 
>> 
>> 
>> _______________________________________________ 
>> osflash mailing list 
>> [email protected] 
>> http://osflash.org/mailman/listinfo/osflash_osflash.org 
>> 
> 
> _______________________________________________ 
> osflash mailing list 
> [email protected] 
> http://osflash.org/mailman/listinfo/osflash_osflash.org 


_______________________________________________ 
osflash mailing list 
[email protected] 
http://osflash.org/mailman/listinfo/osflash_osflash.org 


_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

Reply via email to