简体   繁体   中英

Embed images from swf file in flex

How to create vector images swf file in flash, and how can i use the swf file to get images in flex.

Could you please some one help me on this.

Thanks in Advance.

If I understand you correctly, you have a swf file created in Flash CS6 (or similar) that you wish to use in a flex project. Is this correct?

If it is, then you would use swfloader to load your swf file in a flex app.

example:

<fx:Script>
<![CDATA[
import mx.managers.CursorManager;
[Bindable]
public var loadModHome:String = "assets/flashFiles/home_trusted.swf"; 

protected function analyticsBtn_clickHandler(event:MouseEvent):void
{   
loadModHome="assets/flashFiles/home_trusted.swf";   
}

protected function integratedBtn_clickHandler(event:MouseEvent):void
{
loadModHome="assets/flashFiles/home_integrated.swf";    
}

]]>
</fx:Script>

Then in your component/app/module etc place the swfloader tag and fill it in as needed. Here I have bound the source to a variable called "loadModHome" this makes the swfloader dynamic in that I can assign a new value to my variable and have it unload and load different swf files. I do this by using the click event of two buttons, this allows me to toggle the swf files on the fly

<mx:LinkButton id="analyticsBtn"  label="Trusted Analytics" textDecoration="underline"
color="blue" click="analyticsBtn_clickHandler(event)"/>
<mx:LinkButton id="integratedBtn" label="Integrated Billing" textDecoration="underline"
color="blue" click="integratedBtn_clickHandler(event)"/>

<s:SWFLoader id="homeMainSL" x="127" y="10" width="600" height="800" 
source="{loadModHome}" click="homeMainSL_clickHandler(event)" 
useHandCursor="true" buttonMode="true"/>    

To see a working example check out http://www.myfirerules.net . The site is a work in progress. The home page has as:SWFLoader tag to load the Flash created swf files, the other pages use as:ModuleLoader tag instead to load swf files created by flex.

Hope this helps

Jim

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM