[osflash] Class definitions
Jonathan Valliere
sybersnake at gmail.com
Mon May 12 08:00:14 PDT 2008
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/20080512/e7d7c914/attachment.html
More information about the osflash
mailing list