A data tansporter class.
package engine
{
/**
* @file CTransporter.as
* @author Abhishek Kumar
*/
import engine.CCommunicator;
import engine.CTemplate;
import engine.CQuery;
import engine.CUrl;
public class CTransporter
{
private var oCommunicator:Object;
private var oTemplate:Object;
/* Ex:
* private var oTransporter:Object = new CTransporter();
*/
public function CTransporter():void
{
oCommunicator = new CCommunicator();
oTemplate = new CTemplate();
}
/* Ex:
* oTransporter.deliver('URL01', true, 'QT001', { Username:'admin', Password:'pass' }, this.receiver);
*/
public function deliver(iWebService:String, iReturn:Boolean, iQueryName:String, iQueryElement:Object, iReceiver:Function):void
{
oCommunicator.setUrl(CUrl.WebAppRoot + CUrl[iWebService]);
oCommunicator.initialize();
oCommunicator.setProceed(iReceiver);
var queryString:String = oTemplate.setInTemplate(CQuery[iQueryName], iQueryElement);
oCommunicator.sendDataToServer(iReturn, queryString);
}
}
}
package engine
{
import flash.net.navigateToURL;
import flash.net.URLRequest;
/**
* @file CUrl.as
* @author Abhishek Kumar
*/
public class CUrl
{
public static var WebAppRoot:String;
public static var UserAssetPath:String;
public static const WS01:String = "_guru.php";
public static function openUrl(iUrl:String, iWindowType:String):void
{
var request:URLRequest = new URLRequest(iUrl);
try { navigateToURL(request, iWindowType); } catch (e:Error) { };
}
}
}
Comments
Post a Comment