Over 10 years of community discussion and knowledge are maintained here as a read-only archive.
ISQLiteErrorResponder extends NotificationISQLiteResultResponder extends Notificationfunction doQuery(queryString , ISQLiteErrorResponder , ISQLiteResultResponder):void{//do stuff and listen to the sql callback using flash eventlisteners to fire the responders//only how to remove listeners, without having both responder know about each other}
Rhysyngsun, does one put constants in a UML scheme? I am new to UML, but want to learn. Allready in this thread it has proven me that it is a nice way to communicate code concepts Jiri
public class PageDataProxy extends Proxy implements IProxy, IDelegateResponder{.....// service IDsprivate static const _LOAD_PAGE:String = "loadPage";.....public function loadPage( id:int ):void{ // accessing a remote service new RemoteDelegate( "GetPageDocument", [id, ""], this, _LOAD_PAGE ).execute(); // or optional // accessing a local database // new LocalDBDelegate( "SELECT * FROM....", LocalDBDelegate.MODE_SYNC, this, _LOAD_PAGE ).execute();} public function onDelegateResult( serviceid:String, data:Object ):void{ switch( serviceid ) { case _LOAD_PAGE: // parse xml page data to PageVO parsePageData( data as XML ); // send notification sendNotification( ApplicationFacade.PROXY_PAGE_LOADED ); break; }} public function onDelegateFault( serviceid:String, data:Object ):void{ sendNotification( ApplicationFacade.PROXY_ERROR, serviceid );}.....
public function loadPage( id:int ):void{ new LocalDBDelegate( "CREATE TABLE 'users' .... ", LocalDBDelegate.MODE_SYNC, this, null ).execute();}public function onDelegateResult( serviceid:String, data:Object ):void{ // this method is called by the Delegate after the query has been sucessfully executed}public function onDelegateFault( serviceid:String, data:Object ):void{ // this method is called by the Delegate, if the query has caused an error}
var file:File = File.applicationStorageDirectory;LocalDBDelegate.init( file );
public function LocalDBDelegate( query:String, mode:String = MODE_SYNC, responder:IDelegateResponder = null, serviceid:String = "" ) { super( serviceid, responder ); m_query = query; m_mode = mode; }
public interface IDelegateResponder { function onDelegateResult( serviceid:String, data:Object ):void; function onDelegateFault( serviceid:String, data:Object ):void; }