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

Reply via email to