adobe flash buider (flex4): addChild() is not available in this class.

Posted by ufk on Stack Overflow See other posts from Stack Overflow or by ufk
Published on 2010-01-07T21:00:19Z Indexed on 2010/06/08 9:32 UTC
Read the original article Hit count: 382

Filed under:
|
|
|
|

Hi. I want to be able to load an swf into a flex 4 application in order to use it's classes.

var ldr:Loader=new Loader();
ldr.load(new URLRequest("file://path/to/fileswf"));
ldr.contentLoaderInfo.
 addEventListener(Event.INIT, loaded);
function loaded(evt:Event):void { addChild(ldr); }

i receive the error:

Error: addChild() is not available in this class. Instead, use addElement() or modify the skin, if you have one.

at spark.components.supportClasses::SkinnableComponent/addChild()[E:\dev\gumbo_beta2\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:966]

at main/private:init/loaded()[C:\Documents and Settings\ufk\Adobe Flash Builder Beta 2\xpogames-toolkit-test\src\main.mxml:22]

if i change addChild() to addElement() i receive the following compilation error:

1067: Implicit coercion of a value of type flash.display:Loader to an unrelated type mx.core:IVisualElement. main.mxml   path/dir line 22 Flex Problem

any ideas how to resolve the issue ?

© Stack Overflow or respective owner

Related posts about flex

Related posts about flex4