[osflash] Class definitions
Niels Wolf
niels.wolf at mediacatalyst.com
Mon May 12 23:40:25 PDT 2008
filt3r at free.fr is right.. Your child¹ class definition gets skipped not the
parent¹ one overwritten..
\n
On 5/12/08 5:00 PM, "Jonathan Valliere" <sybersnake at gmail.com> wrote:
> Duno, pretty sure i've seen that behavior in some version of flash. I've seen
> that behavior in Java.
>
> On Mon, May 12, 2008 at 9:00 AM, <filt3r at free.fr> wrote:
>> IMHO, there is no way to override a class like that, the last loaded instance
>> of C will be skipped.
>> The previous one will be used.
>> ----- Mail Original -----
>> De: "Jonathan Valliere" <sybersnake at gmail.com>
>> À: "Open Source Flash Mailing List" <osflash at osflash.org>
>> Envoyé: Lundi 12 Mai 2008 14:32:48 GMT +01:00 Amsterdam / Berlin / Berne /
>> Rome / Stockholm / Vienne
>> Objet: Re: [osflash] Class definitions
>>
>> The last loaded instance of Class C within a applicationDomain will override
>> the previous one. So you can specify a new applicationDomain or expect the
>> over-ride behavior
>>
>> On Fri, May 9, 2008 at 11:50 AM, Niels Wolf <niels.wolf at mediacatalyst.com>
>> 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
>>> > osflash at osflash.org
>>> > http://osflash.org/mailman/listinfo/osflash_osflash.org
>>> >
>>
>> _______________________________________________
>> osflash mailing list
>> osflash at osflash.org
>> http://osflash.org/mailman/listinfo/osflash_osflash.org
>>
>> _______________________________________________
>> osflash mailing list
>> osflash at osflash.org
>> http://osflash.org/mailman/listinfo/osflash_osflash.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/osflash_osflash.org/attachments/20080513/9b57df78/attachment.html
More information about the osflash
mailing list