/************************************************************************* * * Copyright 2008 FlashMobileBlog * All Rights Reserved. * **************************************************************************/ /** * This is the base class for data provider classes that retrieve their data from the * Device using DataRequests. *
* The DeviceDataProvider class is to be used with components, both UI components and other
* ActionScript classes.
* It responds to data requests and dispatches events to notify of data changes.
* This base class allows for only reading of device data. You can extend this class to provide
* extra functionality to interact with items on the device.
*
* This is only valid after the DeviceDataProvider.OPEN event is received.
*
onLoad calls from the open list data request.
*
* This method is run in the context of the DeviceDataProvider class.
*
onLoad calls from the open list data request.
*
* This method is run in the context of the open list data request not the DeviceDataProvider class.
*
DeviceDataProvider object list data request to the parameter given.
*
* If the DeviceDataProvider was previously initialized, then all outstanding
* requests will be cancelled and deleted.
* When the list has completed its first stage of opening and initialization, this event is dispatched.
* The list's Id is available once the open event has been received.
*
onData() and onLoad() will be overwritten.
*
* @see DataRequest
*
* @category Method
* @langversion 2.0
* @playerversion Lite 2.1
*/
public function open(filter:Object, sortOrder:Number, returnFields:Object):Void
{
if (list!=null)
{
close();
}
list = new DataRequest("plugin", "openList", filter, sortOrder, returnFields);
list.owner = this;
list.onLoad = doHandleOpenList;
list.request();
}
/**
*
*
* Closes the DataProvider's open list data request.
*
* This method cancels all outstanding data requests on the list and
* allows them to be garbage collected. It is safe to call this function
* even if the data provider is already closed.
* Once the list is canceled, the DeviceDataProvider.CLOSE event is dispatched.
*