![](/img/trans.png)
[英]Embed an SWF file in Flex and interact with ExternalInterface functions
[英]Embed images from swf file in flex
如何在Flash中創建矢量圖像swf文件,以及如何使用swf文件在flex中獲取圖像。
您能幫我一個忙嗎?
提前致謝。
如果我對您的理解正確,則您有一個希望在Flex項目中使用的Flash CS6(或類似版本)中創建的swf文件。 這個對嗎?
如果是,那么您將使用swfloader將您的SWF文件加載到Flex應用程序中。
例:
<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>
然后在您的組件/應用程序/模塊等中放置swfloader標簽,並根據需要填寫。 在這里,我將源綁定到了一個名為“ loadModHome”的變量,這使swfloader具有動態性,因為我可以為變量分配一個新值,並讓其卸載和加載不同的swf文件。 我通過使用兩個按鈕的click事件來執行此操作,這使我可以即時切換SWF文件
<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"/>
要查看工作示例,請訪問http://www.myfirerules.net 。 該網站正在進行中。 主頁具有as:SWFLoader標記,以加載Flash創建的swf文件,其他頁面具有as:ModuleLoader標記,而不是加載flex創建的swf文件。
希望這可以幫助
吉姆
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.