重新加载AIR应用程序在flex中删除外观和背景图像

时间:2015-03-12 05:40:59

标签: actionscript-3 flex air flex4.6

我正在研究AIR应用程序。其中我把刷新按钮刷新应用程序。当用户在代码刷新我的应用程序后单击“刷新按钮”时。

protected function onRefreshClickHandler(event:MouseEvent):void
{
var app:WindowedApplication =
WindowedApplication(FlexGlobals.topLevelApplication);

var mgr:ProductManager =
new ProductManager("airappinstaller");

mgr.launch("-launch " +
                        app.nativeApplication.applicationID + " " +
                        app.nativeApplication.publisherID);

app.close();
}

上面的代码很好用。
现在,再次当应用程序启动时,borderConatiner的按钮和backgroundImage的skinclass不起作用。

<s:Button click="onRefreshClickHandler(event)" 
                  buttonMode="true" skinClass="skins.ButtonRefresh"/>

<s:BorderContainer width="100%" borderVisible="false" 
                       backgroundImage="@Embed('assets/images/back.png')">

我不知道为什么会发生这种奇怪的事情。

有没有解决方法呢?
当我重新启动应用程序时,如何恢复我的皮肤?

感谢。

1 个答案:

答案 0 :(得分:0)

现在,我得到了我的问题的解决方案。
我通过在skinclass上的运行时给backgroundImagecreationComplete来解决它,如:

borderContainer.setStyle("backgroundImage","assets/images/back.png");
btnRefresh.setStyle("skinClass",CustomButtonRefreshSkin);

希望,它会帮助别人。