flex : How to import .fla file into the flex application
I have one .fla file sent by some one. I want to import this file into my actionscript project using flex builder and I need to work on frames of the fla file . How to do this. I am very new to flex . I am searching this in internet with of no results. plea开发者_如何学Cse help me.
You cannot edit a flash file directly within the Flash Builder (i.e. Flex) IDE. You can however access the published swf from within Flex.
A common use is to access assets from a library swf - http://www.bit-101.com/blog/?p=853. But I assume you are interested in accessing specific frames in the interactive. Different options are possible :
- use localConnection - http://fbflex.wordpress.com/2008/06/12/passing-data-from-flash-to-flex-and-back/
- load the resulting swf into a loader object and navigate to frame - SWFLoader starts to play SWF without the loading being complete
- load the resulting swf into a loader object and communicate via events
<mx:SWFLoader id="embeddedFlash" source="path/to/file.swf" complete="onLoaderComplete(event)"/>
<mx:Script>
<![CDATA[
private function onLoaderComplete(event:Event)
{
// the swf file needs to be fully loaded before these calls are made
if(embeddedFlash.content)
{
// 2 - navigate to frame
var mc:MovieClip = MovieClip(embeddedFlash.content);
mc.gotoAndPlay(0);
// 3 - communicate via events
embeddedFlash.content.addEventListener("nextButtonClick", onNextClick);
embeddedFlash.content.dispatchEvent(new Event("changeOptions", {/* pass on data */}));
}
}
]]>
</mx:Script>
精彩评论