Flex: How to access movieclips within an imported swf
Posted
by squared
on Stack Overflow
See other posts from Stack Overflow
or by squared
Published on 2010-05-06T16:22:28Z
Indexed on
2010/05/06
16:28 UTC
Read the original article
Hit count: 310
Hello,
I have imported a swf (not created with Flex, i.e. non-framework) into a Flex application. Once loaded, I would like to access movieclips within that imported swf. Looking at Adobe's docs (http://livedocs.adobe.com/flex/3/html/help.html?content=controls_15.html), it seems straightforward; however, their examples are between a Flex app and an imported swf (created with Flex).
Like their example, I'm trying to use the SystemManager to access the imported swf's content; however, I receive the following error:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@58ca241 to mx.managers.SystemManager.
Is this error occurring because I'm importing a non-framework swf into a framework swf? Thanks in advance for any assistance.
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:SWFLoader source="assets/test.swf" id="loader" creationComplete="swfLoaded()" />
<mx:Script>
<![CDATA[
import mx.managers.SystemManager;
[Bindable]
public var loadedSM:SystemManager;
private function swfLoaded():void
{
loadedSM = SystemManager(loader.content);
}
]]>
</mx:Script>
</mx:Application>
© Stack Overflow or respective owner