RE: [Flashcoders] as3 namespace question
Thanks for the response Erik. Yes, I am aware that compiling the entire base class of another swf is problematic. I was just trying to simplify things for the example. If the idea works I will to use an interface as a public api to the loaded swf. Anyway, I am very interested in seeing your example files, whether in Flex or Flash. However, I don't seem to receive attachments sent through this list. Can you send me the attachment off list? Thanks Dave -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of EECOLOR Sent: Tuesday, May 13, 2008 5:38 PM To: Flash Coders List Subject: Re: [Flashcoders] as3 namespace question And now the attachment, hehe. Greetz Erik On 5/13/08, EECOLOR <[EMAIL PROTECTED]> wrote: > > >I posted about this before and didn't receive and answer but it is > >still > causing > >me issues so I am trying again. > > There were some concrete answers posted to your question. Anyway, > let's see if we can solve it again. > > Before I will try and help with your problem, I want to point out > something about your code. I am not sure if you are using (in your > real > application) an interface which you will cast your class to: > > *var _lm:ILoadMe = ILoadMe(_ldr.content);* > > If you are using the actual class, the problem is that the whole class > and it's dependencies are compiled into you main swf, defeating a big > part of the purpose of loading the swf into it. > > In my previous reply to your earlier email I posted a Flex version of > the answer. This time I created a Flash example. It is added as attachment. > > The attached zip file contains 2 directories. Make sure you have your > webserver point to to these directories, the virtual hosts in apache: > > * > ServerName domain1 > DocumentRoot "E:\Projects\domain1" > > > > ServerName domain2 > DocumentRoot "E:\Projects\domain2" > * > > In the hosts file (if you are on windows) you need these 2 entries: > > *127.0.0.1 domain1 > 127.0.0.1 domain2* > > In order to test the example, call this url: > *http://domain1/domain1.html* > > You should see this appear on your screen: > > *domain1.swf > domain2.swf loaded > Domain2Base* > > I hope this will solve your problem. > > > Greetz Erik > > > > > > > > > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] as3 namespace question
And now the attachment, hehe. Greetz Erik On 5/13/08, EECOLOR <[EMAIL PROTECTED]> wrote: > > >I posted about this before and didn't receive and answer but it is still > causing > >me issues so I am trying again. > > There were some concrete answers posted to your question. Anyway, let's > see if we can solve it again. > > Before I will try and help with your problem, I want to point out > something about your code. I am not sure if you are using (in your real > application) an interface which you will cast your class to: > > *var _lm:ILoadMe = ILoadMe(_ldr.content);* > > If you are using the actual class, the problem is that the whole class and > it's dependencies are compiled into you main swf, defeating a big part of > the purpose of loading the swf into it. > > In my previous reply to your earlier email I posted a Flex version of the > answer. This time I created a Flash example. It is added as attachment. > > The attached zip file contains 2 directories. Make sure you have your > webserver point to to these directories, the virtual hosts in apache: > > * > ServerName domain1 > DocumentRoot "E:\Projects\domain1" > > > > ServerName domain2 > DocumentRoot "E:\Projects\domain2" > * > > In the hosts file (if you are on windows) you need these 2 entries: > > *127.0.0.1 domain1 > 127.0.0.1 domain2* > > In order to test the example, call this url: *http://domain1/domain1.html* > > You should see this appear on your screen: > > *domain1.swf > domain2.swf loaded > Domain2Base* > > I hope this will solve your problem. > > > Greetz Erik > > > > > > > > > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] as3 namespace question
>I posted about this before and didn't receive and answer but it is still causing >me issues so I am trying again. There were some concrete answers posted to your question. Anyway, let's see if we can solve it again. Before I will try and help with your problem, I want to point out something about your code. I am not sure if you are using (in your real application) an interface which you will cast your class to: *var _lm:ILoadMe = ILoadMe(_ldr.content);* If you are using the actual class, the problem is that the whole class and it's dependencies are compiled into you main swf, defeating a big part of the purpose of loading the swf into it. In my previous reply to your earlier email I posted a Flex version of the answer. This time I created a Flash example. It is added as attachment. The attached zip file contains 2 directories. Make sure you have your webserver point to to these directories, the virtual hosts in apache: * ServerName domain1 DocumentRoot "E:\Projects\domain1" ServerName domain2 DocumentRoot "E:\Projects\domain2" * In the hosts file (if you are on windows) you need these 2 entries: *127.0.0.1 domain1 127.0.0.1 domain2* In order to test the example, call this url: *http://domain1/domain1.html* You should see this appear on your screen: *domain1.swf domain2.swf loaded Domain2Base* I hope this will solve your problem. Greetz Erik ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] as3 namespace question
I have not tryed this, but check this: http://livedocs.adobe.com/flex/201/langref/flash/display/LoaderInfo.html "Because the instance of the main class of the SWF file has no Loader object, the loaderInfo property is the only way to access the LoaderInfo for the instance of the main class of the SWF file." Perhaps this means you have to do something like: private function initHandler($event:Event) () { var _lm:LoadMe = LoadMe(_ldr.loaderInfo.content); } Cheers Juan Pablo Califano 2008/5/9, Dave Segal <[EMAIL PROTECTED]>: > > I posted about this before and didn't receive and answer but it is still > causing me issues so I am trying again. I need to load an swf from one > server that is a member of some class. For example: > > > > http://server1.mydomain.com/load_me.swf that uses the Document class > "com.mydomain.componet.LoadMe.as". > > > > I want to be able to load this swf from a different server, say > http://server2.mydomain.com/load_stuff.swf, and cast it to a LoadMe when > it is done loading. Should this work? I keep getting errors when trying to > cast in the init handler. > > > > > > import com.mydomain.componet.LoadMe; > > > > var _req:URLRequest = new > URLRequest("http://server1.mydomain.com/load_me.swf";); > > var _ldr:Loader = new Loader(); > > var _context:LoaderContext = new LoaderContext(); > > _context.securityDomain = SecurityDomain.currentDomain; > > _context.applicationDomain = ApplicationDomain.currentDomain; > > _ldr.contentLoaderInfo.addEventListener(Event.INIT, initHandler, false, 0, > true); > > _ldr.load(_req, _context); > > > > > > private function initHandler($event:Event) () { > >var _lm:LoadMe = LoadMe(_ldr.content); > > } > > > > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] as3 namespace question
I posted about this before and didn't receive and answer but it is still causing me issues so I am trying again. I need to load an swf from one server that is a member of some class. For example: http://server1.mydomain.com/load_me.swf that uses the Document class "com.mydomain.componet.LoadMe.as". I want to be able to load this swf from a different server, say http://server2.mydomain.com/load_stuff.swf, and cast it to a LoadMe when it is done loading. Should this work? I keep getting errors when trying to cast in the init handler. import com.mydomain.componet.LoadMe; var _req:URLRequest = new URLRequest("http://server1.mydomain.com/load_me.swf";); var _ldr:Loader = new Loader(); var _context:LoaderContext = new LoaderContext(); _context.securityDomain = SecurityDomain.currentDomain; _context.applicationDomain = ApplicationDomain.currentDomain; _ldr.contentLoaderInfo.addEventListener(Event.INIT, initHandler, false, 0, true); _ldr.load(_req, _context); private function initHandler($event:Event) () { var _lm:LoadMe = LoadMe(_ldr.content); } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders