calling iOS functions and arguments from as
Extcontex is an instance of Extensioncontext, called by call. The first parameter is the corresponding function of iOS, after which all the parameters become an array of incoming iOS. This means that the function name can be followed by a mutable array. For example:
Extcontex.call ("setvolume", parameter 1, parameter 2, parameter 3);
In iOS
void* funcdata, uint32_t argc, Freobject argv[]) { //argv[] The received is the parameters of the as passed over //
argv[0] corresponding parameter 1,argv[1] corresponding parameter 2,argv[2] corresponding to parameter 3return NULL;}
from iOS to as dump event is this
Fredispatchstatuseventasync (Eventcontext, EventCode, Datacode);
Eventcontext: As the frecontext.
EventCode: Corresponds to the code in the Statusevent in as
Datacode: Corresponds to the level in the statusevent in as
EventCode we can use to send an identifier of a string type, and after receiving the Statusevent.status event in as, use it to determine what to do with it, for example:
protectedfunction Onstatus (Event: statusevent):void{Switch(Event. Code) { Case "Assi.": Trace ("He's talking Korean birds."); Break; Case "Grass Mud Horse": Trace ("This is the Chinese God Beast"); Break; }}
Datacode can be used to carry data returned from the native, such as XML data, JSON data, or a delimited string "a|b|c|d". A delimited string can eventually be used with the Splite ("|") to an array. So we can complete the callback and data transfer from native to as.