List Info

Thread: Re: Class definitions




Re: Class definitions
user name
2008-05-09 13:44:23
I tried it.. It worked though.


On 5/9/08 7:34 PM, "Rich Rodecker&quot; <flashape2gmail.com&gt; wrote:

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 <niels.wolfmediacatalyst.com> wrote:
Thanks for the comments. I guess I have enough right now.

Niels

On 5/9/08 6:10 PM, "Ian Thomas&quot; <ianeirias.net> wrote:

> The simplest answer - use packages.
>
&gt; 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,
>;  &nbsp;Ian
>;
>
> On Fri, May 9, 2008 at 4:50 PM, Niels Wolf <niels.wolfmediacatalyst.com>
> wrote:
&gt;> Hey.
>;>
>;>  I am looking into following scenario:
>>
>>  SWF A loads other SWF B.
>&gt;
>&gt;  A defines class C.
>&gt;  B defines class C.
>&gt;
>&gt;  If B calls on C it gets C from A!
>&gt;
>&gt;  example:
>>
>>  B.swf
>>;  package{
>>  &nbsp; &nbsp;import flash.text.TextField;
>>  &nbsp; &nbsp;import flash.display.Sprite;
>>  &nbsp; &nbsp;import flash.display.Loader;
>>  &nbsp; &nbsp;import flash.net.URLRequest;
>>
>>  &nbsp; &nbsp;public class C extends Sprite{
>>  &nbsp; &nbsp; &nbsp; &nbsp;private var variable:String = "I am C from B";
>>
>>  &nbsp; &nbsp; &nbsp; &nbsp;public function C(){
>;>  &nbsp; &nbsp; &nbsp; &nbsp;   ; trace(variable);
>>;  &nbsp; &nbsp; &nbsp; &nbsp;   ; var txt:TextField = new TextField();
>&gt;  &nbsp; &nbsp; &nbsp; &nbsp;   ; txt.text = variable;
>>  &nbsp; &nbsp; &nbsp; &nbsp;   ; addChild(txt);
>>  &nbsp; &nbsp; &nbsp; &nbsp;}
&gt;>
&gt;>  &nbsp; &nbsp;}
>>  }
>>
>>  A.swf
>>;  package{
>>  &nbsp; &nbsp;import flash.text.TextField;
>>  &nbsp; &nbsp;import flash.display.Sprite;
>>  &nbsp; &nbsp;import flash.display.Loader;
>>  &nbsp; &nbsp;import flash.net.URLRequest;
>>
>>  &nbsp; &nbsp;public class C extends Sprite{
>>  &nbsp; &nbsp; &nbsp; &nbsp;private var variable:String = "I am C from A";
>>
>>  &nbsp; &nbsp; &nbsp; &nbsp;public function C(){
>;>  &nbsp; &nbsp; &nbsp; &nbsp;   ; trace(variable);
>>;  &nbsp; &nbsp; &nbsp; &nbsp;   ; var txt:TextField = new TextField();
>&gt;  &nbsp; &nbsp; &nbsp; &nbsp;   ; txt.text = variable;
>>  &nbsp; &nbsp; &nbsp; &nbsp;   ; addChild(txt);
>>
>>  &nbsp; &nbsp; &nbsp; &nbsp;   ; var loader:Loader = new Loader();
>>  &nbsp; &nbsp; &nbsp; &nbsp;   ; loader.load(new URLRequest("B.swf"));
>>  &nbsp; &nbsp; &nbsp; &nbsp;}
&gt;>
&gt;>  &nbsp; &nbsp;}
>>  }
>>
>>  RUN A.swf outputs:
>>  I am C from A
>&gt;  I am C from A
>&gt;  I am C from A
>&gt;  I am C from A
>&gt;  ...
>>
>>
>>  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
>&gt;  an awkward answer).
>>
>>  Comments are welcome.
>>
>>  Thanks
>&gt;
>&gt;  n
>>
>>
>>  _______________________________________________
>>  osflash mailing list
>;>  osflashosflash.org
>>;  http://osflash.org/mailman/listinfo/osflash_osflash.org
>&gt;
>
> _______________________________________________
> osflash mailing list
>; osflashosflash.org
> http://osflash.org/mailman/listinfo/osflash_osflash.org


_______________________________________________
osflash mailing list
osflashosflash.org
http://osflash.org/mailman/listinfo/osflash_osflash.org


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )