SWFLoader will load any SWF from any URL.  What problems did you run
into?

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of anewgene
Sent: Friday, October 19, 2007 9:43 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Can not add a "Loader" object to a container

 

Thanks for the reply. 
I have tried "SWFLoader" solution, but it seems only loading local 
swf file, not an external one referred by an URL.

For the "rawChildren" solution, I can add loader object indeed, but 
how should I handle sizing issue? For example, I want to add this 
loader into a titleWindow and make it resizable together with its 
container? It seems not a easy thing.

Anyway, my project requires to load external swf into the main 
canvas, as an way for user to add their own "plug-ins". What is the 
best way for this?

Thanks again.

lei

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> Or use SWFLoader
> 
> 
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>

[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of Arpit Mathur
> Sent: Friday, October 19, 2007 3:57 PM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: Re: [flexcoders] Can not add a "Loader" object to a 
container
> 
> 
> 
> this.rawchildren.addChild(loader)
> 
> 
> 
> Containers can only add Flex components to the displaylist. Loader 
is a
> low level actionscript object.
> 
> 
> 
> Using rawchildren, u can add the loader but you have to be 
responsible
> for the sizing etc.
> 
> 
> 
> 
> 
> 
> 
> On 10/19/07, anewgene <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >
> wrote: 
> 
> Hi,
> I am trying to add external swf into my app. Based on the doc at:
> 
> http://livedocs.adobe.com/labs/flex3/html/help.html?
<http://livedocs.adobe.com/labs/flex3/html/help.html?> 
> <http://livedocs.adobe.com/labs/flex3/html/help.html?
<http://livedocs.adobe.com/labs/flex3/html/help.html?> > 
> content=Working_with_MovieClips_8.html
> 
> I created this minimal test code (as below). But I can not make it 
> work (Type Coercion error). The code and the error are pasted here. 
I 
> have tested on both flex3beta2 and flex2hotfix3. 
> 
> Can someone help me out? Thanks.
> 
> Lei
> 
> Code:
> =================================================
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> 
> <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > " 
> layout="absolute" creationComplete="init()" > 
> 
> <mx:Script>
> <![CDATA[
> import flash.display.*;
> import flash.net.URLRequest;
> 
> private function init():void
> {
> var request:URLRequest = new 
> URLRequest(" http://flex.org/blogs/FlexOrgRSSApplication.swf
<http://flex.org/blogs/FlexOrgRSSApplication.swf> 
> <http://flex.org/blogs/FlexOrgRSSApplication.swf
<http://flex.org/blogs/FlexOrgRSSApplication.swf> > ");
> var ldr:Loader = new Loader()
> ldr.load(request);
> addChild(ldr);
> }
> ]]>
> </mx:Script>
> 
> </mx:Application>
> 
> ========================================= 
> Error:
> 
> [SWF] X:\cvs\test2\bin\loadertest.swf - 516,787 bytes after 
> decompression
> TypeError: Error #1034: Type Coercion failed: cannot convert 
> flash.display::[EMAIL PROTECTED] to mx.core.IUIComponent.
> at 
> 
mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::addingC
<http://www.adobe.com/2006/flex/mx/internal::addingC> 
> <http://www.adobe.com/2006/flex/mx/internal::addingC
<http://www.adobe.com/2006/flex/mx/internal::addingC> > 
> hild()[E:\dev\flex_3_beta2 
> \sdk\frameworks\projects\framework\src\mx\core\Container.as:3288]
> at mx.core::Container/addChildAt()[E:\dev\flex_3_beta2
> \sdk\frameworks\projects\framework\src\mx\core\Container.as:2248]
> at mx.core::Container/addChild ()[E:\dev\flex_3_beta2
> \sdk\frameworks\projects\framework\src\mx\core\Container.as:2188]
> at loadertest/init()[X:\cvs\test2\src\loadertest.mxml:14]
> at loadertest/___loadertest_Application1_creationComplete()
> [X:\cvs\test2\src\loadertest.mxml:2] 
> at flash.events::EventDispatcher/dispatchEventFunction()
> at flash.events::EventDispatcher/dispatchEvent()
> at mx.core::UIComponent/dispatchEvent()[E:\dev\flex_3_beta2
> \sdk\frameworks\projects\framework\src\mx\core\UIComponent.as:8915] 
> at mx.core::UIComponent/set initialized()[E:\dev\flex_3_beta2
> \sdk\frameworks\projects\framework\src\mx\core\UIComponent.as:1118]
> at mx.managers::LayoutManager/doPhasedInstantiation()
> [E:\dev\flex_3_beta2
> 
\sdk\frameworks\projects\framework\src\mx\managers\LayoutManager.as:69
> 6]
> at Function/http://adobe.com/AS3/2006/builtin::apply
<http://adobe.com/AS3/2006/builtin::apply> 
> <http://adobe.com/AS3/2006/builtin::apply
<http://adobe.com/AS3/2006/builtin::apply> > ()
> at mx.core::UIComponent/callLaterDispatcher2()
> [E:\dev\flex_3_beta2
> \sdk\frameworks\projects\framework\src\mx\core\UIComponent.as:8338]
> at mx.core::UIComponent/callLaterDispatcher()
> [E:\dev\flex_3_beta2 
> \sdk\frameworks\projects\framework\src\mx\core\UIComponent.as:8281]
> 
> 
> 
> 
> -- 
> Arpit Mathur
> Lead Software Engineer, 
> Comcast Interactive Media
> ---------------------------------------
> post your flex tips on 
> http://flextips.corank.com <http://flextips.corank.com>
<http://flextips.corank.com <http://flextips.corank.com> >
>

 

Reply via email to