The interoperability of Ane-ios and as

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.