Created
April 4, 2010 00:57
-
-
Save swiz/354980 to your computer and use it in GitHub Desktop.
Code samples for Service Layer wiki page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Inject( "userService" )] | |
public var ro:RemoteObject; | |
[Inject] | |
public var sh:ServiceHelper; | |
public function fetchUserRoles( user:User ):void | |
{ | |
sh.executeServiceCall( ro.fetchUserRoles( user.id ), fetchUserRoles_result, fetchUserRoles_fault, [ user ] ); | |
} | |
protected function fetchUserRoles_result( data:Object, user:User ):void | |
{ | |
user.roles = data.result; | |
} | |
protected function fetchUserRoles_fault( info:Object ):void | |
{ | |
// handle service fault | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Inject] | |
public var urh:URLRequestHelper; | |
public function loadConfig( user:User ):void | |
{ | |
urh.executeURLRequest( new URLRequest( "config.xml" ), loadConfig_result, loadConfig_fault, | |
loadConfig_progress, loadConfig_httpStatus, [ user ] ); | |
} | |
protected function loadConfig_result( event:Event, user:User ):void | |
{ | |
user.config = XML( URLLoader( event.target ).data ); | |
} | |
protected function loadConfig_fault( event:Event ):void | |
{ | |
// will be called in response to an IOErrorEvent.IO_ERROR or SecurityErrorEvent.SECURITY_ERROR | |
} | |
protected function loadConfig_progress( event:Event ):void | |
{ | |
// will be called in response to ProgressEvent.PROGRESS | |
} | |
protected function loadConfig_httpStatus event:Event ):void | |
{ | |
// will be called in response to HTTPStatusEvent.HTTP_STATUS | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment