From: Guru on
hi guys, im having some trouble with displaying either a preloader,
dosent matter if its eiter indefinite or definite.


This is the code i have for my webservice, and Mxml.



PageEditor.mxml :



/
*******************************************************************************
********************************************************************************
****/

<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://
ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo"
width="100%" height="100%"
initialize="init();">
<s:layout>
<s:BasicLayout/>
</s:layout>

<fx:Script source="mainPageEditorScript.as" />
<mx:HDividedBox width="100%" height="100%">
<mx:DataGrid id="pageList" height="100%" width="200"
dataProvider="{modules.PageEditor.pageEditor.pageListData}"
itemClick="{modules.PageEditor.pageEditor.getPageInfo
(pageList.selectedItem.Key )}">
<mx:columns>
<mx:DataGridColumn dataField="Value" />
</mx:columns>
</mx:DataGrid>

<mx:VBox width="100%" height="100%">
<mx:Accordion id="theAccordion" width="100%"
height="100%">

.......

.......

</mx:Accordion>
</mx:VBox>
</mx:HDividedBox>
</s:Group>



/
*******************************************************************************
********************************************************************************
****/



inside my pageEditor class i have

pageEditor.as





// ActionScript file
package modules.PageEditor{
import flash.display.Loader;

import mainScript.mainList;

import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;

import services.pages.*;



// import services.main.*;



[Bindable] public class pageEditor{
// variables
public static var pageListData:ArrayCollection;
public static var pageInfo:Object;
public static var pageService:Pages = new Pages();
public static var pageDetails:Pages = new Pages();

public static var loading:Loader = new Loader();

public static var isUpdated:Boolean = false;

public static function init():void{
pageService.addEventListener(ResultEvent.RESULT,
resultReturn);
pageService.showBusyCursor = true;
pageService.addEventListener(FaultEvent.FAULT,
faultEvent);
pageService.GetSitePages(mainScript.mainList.siteId);
//Alert.show("here");
}
public static function resultReturn(event:ResultEvent):void{
pageListData = event.result as ArrayCollection;
isUpdated = false;
}
public static function faultEvent(event:FaultEvent):void{
Alert.show(event.fault.faultCode);
Alert.show(event.fault.faultString);
}
public static function getPageInfo(id:int):void{
pageDetails.addEventListener(ResultEvent.RESULT,
returnPageDetails);
pageDetails.addEventListener(FaultEvent.FAULT,
faultEvent);
pageDetails.showBusyCursor = true;
pageDetails.GetPage(id);
}
public static function returnPageDetails
(event:ResultEvent):void{
//pageDetails.showBusyCursor = false;
pageInfo = event.result;
}
}

}

/
*******************************************************************************
********************************************************************************
****/





I just want a preloader to pop up once the DataGrid with Id :
pageList is clicked.because once the item is clicked, it calls
another webservice.









ive spent over a week trying ot figure this out, but with no avail!!


ive had an idea, where i could just start an in-determinant loader as
soon as the datagrid item is clicked, and disable the loader once i
get to the result function... but i have no idea how to pop up a
loader bar...



please help, and thanks a lot in advance :)