【发布时间】:2014-07-11 22:02:58
【问题描述】:
我正在使用 Flash Builder 4.6 和 AIR 构建一个移动应用程序。
我的 Main.mxml 类——一个 ViewNavigatorApplication——引用了一个设置为最少 6 秒时间的启动屏幕。启动画面消失后,有几秒钟的时间,屏幕的内容区域只是空白的白色——这就是我需要出现忙碌指示器的时候。
编辑:根据要求附加代码:
在 Main.mxml 类中:
protected function viewnavigatorAppInitializeHandler(event:FlexEvent):void
{
//checks various criteria to determine which data to load, ie which service call
// to make. When that is determined, code calls setUpModel().
}
private function setUpModel():void {
Model.Instance.initialize(); //adds listeners in the model,
//makes service call. Data is returned and parsed in the event handler.
//APPLICATION_MODEL_LOADED event is then dispatched, and handled here
Model.Instance.addEventListener( Model.APPLICATION_MODEL_LOADED, modelReadyHandler );
}
private function modelReadyHandler(e:Event):void
{
//Busy Indicator only appears *after* the HomeListView is loaded.
//I need it to appear *while* these calls are being made.
navigator.pushView(HomeListView); //this is my First View
}
所以我认为问题是:在 HomeListView 之前显示的是什么?如果是 Main.mxml——ViewNavigatorApplication——那么我该如何避免“不可分配”错误?
在 HomeListView 中:
[Bindable] private var categoryList:ArrayCollection = new ArrayCollection();
private function viewActivateHandler():void
{
//the service call has been made, and data is ready to be loaded into the control
categories = Model.Instance.Categories;
我在 HomeListView 中试过这个:
<s:Group width="100%" height="100%">
<s:BusyIndicator
id="busy"
visible="true" symbolColor="blue"
horizontalCenter="0" verticalCenter="0"
rotationInterval="100" />
</s:Group>
它有效。但问题是它只在 HomeListView 加载后出现。我认为空白的白色是 HomeListView,就在列表出现之前。但事实并非如此。
然后我尝试将上述代码放入 Main.mxml 文件中。但我收到以下错误:
'spark.components.Group' is not assignable to the default property, 'navigationStack', of type 'spark.components.supportClasses.NavigationStack'.
那么我可以把这个 BusyIndicator 放在哪里,以便它在 HomeListView 出现之前覆盖空白区域?
【问题讨论】:
-
你能发布更多 HomeListView 的代码吗?当您说繁忙指示器仅在 homeListView 加载后显示时,您的意思是它仅在服务调用完成后显示?
-
可以使用 CursorManager.setBusyCursor() 和 CursorManager.removeBusyCursor() help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/…
标签: actionscript-3 apache-flex air flash-builder