假設你SWFComponent
你有你的SWFLoader
:
<s:SWFLoader id="btnRepr" source="@Embed('ButtonReport.swf')" visible="false"/>
,你有另一個組件調用BTNComponent
,你有一個簡單的按鈕,它會顯示在名爲swf_component
的SWFComponent
的情況下加載的SWF,所以你可以這樣做:
<s:Button click="button_clickHandler(event)"/>
和
protected function button_clickHandler(event:MouseEvent):void
{
mx.core.FlexGlobals.topLevelApplication.swf_component.btnRepr.visible = true;
}
當然這只是一個非常簡單和有限的例子,如果你如何做你正在尋找的東西,你應該根據你的具體需求來改進它...
編輯:
假設我的兩個組件都在MyComponents
包,然後創建自己的實例我做:
import MyComponents.*;
public var swf_component:SWFComponent;
public var btn_component:BTNComponent;
,那麼應用程序的創建完整的事件處理中,比如,我說:
swf_component = new SWFComponent();
addElement(swf_component);
btn_component = new BTNComponent();
addElement(btn_component);
然後當點擊btn_component
中的按鈕時,swf_component`內的SWF被設置爲可見。
希望能有所幫助。
你在哪裏使用過'btnRepr.visible = true;'? – akmozo
我在上面提到的第二個組件中調用它。這兩行屬於兩個不同的組件/'mxml'文件。 – coner
在這種情況下,請嘗試:'component_instance.btnRepr.visible = true;'。 – akmozo