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]> 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?
> 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";
> 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";);
> 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
> 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()
> 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

Reply via email to