| Package | SmsHttp |
| Class | public class SmsHttpConnection |
| Implements | flash.events.IEventDispatcher |
SmsHttpEvent.
...
private var SmsCon:SmsHttpConnection;
public function Main():void
{
SmsCon = new SmsHttpConnection("0012345678", "password");
SmsCon.addEventListener(SmsHttpEvent.SENDSMS, this.OnSmsHttpResult);
SmsCon.SendSMS("00133787654321", "Hello!");
}
private function OnSmsHttpResult(event:SmsHttpEvent):void {
trace(event);
}
...
Event dispatched, at response from server:[SmsHttpEvent type="SendSMS" bubbles=false cancelable=false eventPhase=2 Result=[SMSHttpResult CreditsLeftToday=2 CreditsLeft=100 ErrorDescription="OK" Tel="0087654321" ErrorCode=200]]
See also
| Property | Defined by | ||
|---|---|---|---|
| CurrentPassword : String [static][read-only]
Global variable to access the credentials that is kept for the lifetime of the application.
| SmsHttpConnection | ||
| CurrentUserTel : String [static][read-only]
Global variable to access the credentials that is kept for the lifetime of the application.
| SmsHttpConnection | ||
| GetInstance : SmsHttpConnection
[static][read-only]
Gets the instance first created, as a singelton.
| SmsHttpConnection | ||
| Method | Defined by | ||
|---|---|---|---|
|
SmsHttpConnection(UserTel:String = null, Password:String = null)
Session-state handler with methods for services and connectivity towards to the server.
| SmsHttpConnection | ||
|
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
| SmsHttpConnection | ||
|
CreateContact(ContactTel:String, ContactName:String):void
Sends a request to the server for creating a new contact.
| SmsHttpConnection | ||
|
DeleteContact(ContactTel:String):void
Sends a request to the server to delete a contact.
| SmsHttpConnection | ||
|
DeleteSMS(MsgID:int):void
Send a request to the server to delete an SMS.
| SmsHttpConnection | ||
|
dispatchEvent(evt:Event):Boolean
| SmsHttpConnection | ||
|
GetBalance():void
Sends a request to the server to get the current balance for account that this session belongs to.
| SmsHttpConnection | ||
|
GetContacts():void
Sends a request to the server to get all the contacts.
| SmsHttpConnection | ||
|
GetDeliveries():void
Sends a request to the server to get any waiting deliveryreports for previously messages sent for the account that this session belongs to.
| SmsHttpConnection | ||
|
GetMsgCreditCost(Tel:String, Msg:String):void
Sends a request to the server to check price for a message for its destiation.
| SmsHttpConnection | ||
|
hasEventListener(type:String):Boolean
| SmsHttpConnection | ||
|
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
| SmsHttpConnection | ||
|
SendSms(Tel:String, Msg:String):void
Sends a request to the server to submit a message, the account that this session belongs will be adjusted for each message sent.
| SmsHttpConnection | ||
|
willTrigger(type:String):Boolean
| SmsHttpConnection | ||
| Constant | Defined by | ||
|---|---|---|---|
| APPID : int = 0123456789 [static]
Identifies this unique application, this should remain constant and not be changed.
| SmsHttpConnection | ||
| CurrentPassword | property |
CurrentPassword:String [read-only]Global variable to access the credentials that is kept for the lifetime of the application.
Implementation public static function get CurrentPassword():String
| CurrentUserTel | property |
CurrentUserTel:String [read-only]Global variable to access the credentials that is kept for the lifetime of the application.
Implementation public static function get CurrentUserTel():String
| GetInstance | property |
GetInstance:SmsHttpConnection [read-only]Gets the instance first created, as a singelton.
Implementation public static function get GetInstance():SmsHttpConnection
| SmsHttpConnection | () | constructor |
public function SmsHttpConnection(UserTel:String = null, Password:String = null)Session-state handler with methods for services and connectivity towards to the server. The username and password is static and kept for the lifetime of the application. When using the Flash IDE, create new instance with no arguments to reuse previous credentials when creating UI at different frames.
ParametersUserTel:String (default = null) — Phonenumber used as identification for using the services.
|
|
Password:String (default = null) — The password corresponding to the account using for teh services.
|
| addEventListener | () | method |
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):voidParameters
type:String |
|
listener:Function |
|
useCapture:Boolean (default = false) |
|
priority:int (default = 0) |
|
useWeakReference:Boolean (default = false) |
| CreateContact | () | method |
public function CreateContact(ContactTel:String, ContactName:String):voidSends a request to the server for creating a new contact.
ParametersContactTel:String — Phonenumber of the new contact.
|
|
ContactName:String — Displayname of the corresponding number to the new contact.
|
| DeleteContact | () | method |
public function DeleteContact(ContactTel:String):voidSends a request to the server to delete a contact.
ParametersContactTel:String — Phonenumber for a contact.
|
| DeleteSMS | () | method |
public function DeleteSMS(MsgID:int):voidSend a request to the server to delete an SMS.
ParametersMsgID:int — Unique ID of an existing message.
|
| dispatchEvent | () | method |
public function dispatchEvent(evt:Event):BooleanParameters
evt:Event |
Boolean |
| GetBalance | () | method |
public function GetBalance():void
Sends a request to the server to get the current balance for account that this session belongs to. An event of type ONGETBALANCERESULT will be dispatched when the response is received.
| GetContacts | () | method |
public function GetContacts():voidSends a request to the server to get all the contacts.
| GetDeliveries | () | method |
public function GetDeliveries():void
Sends a request to the server to get any waiting deliveryreports for previously messages sent for the account that this session belongs to. An event of type OnGetDeliveryResult will be dispatched when the response is received.
| GetMsgCreditCost | () | method |
public function GetMsgCreditCost(Tel:String, Msg:String):void
Sends a request to the server to check price for a message for its destiation. An event of type OnGetBalanceResult will be dispatched when the response is received.
Tel:String |
|
Msg:String |
| hasEventListener | () | method |
public function hasEventListener(type:String):BooleanParameters
type:String |
Boolean |
| removeEventListener | () | method |
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):voidParameters
type:String |
|
listener:Function |
|
useCapture:Boolean (default = false) |
| SendSms | () | method |
public function SendSms(Tel:String, Msg:String):void
Sends a request to the server to submit a message, the account that this session belongs will be adjusted for each message sent. An event of type OnSendSmsResult will be dispatched when the response is received.
Tel:String — Receipent of the message, in international format.
|
|
Msg:String — The message body to send.
|
| willTrigger | () | method |
public function willTrigger(type:String):BooleanParameters
type:String |
Boolean |
| APPID | constant |
public static const APPID:int = 0123456789Identifies this unique application, this should remain constant and not be changed.