ANE from getting started to mastering---accessing resources using r*

Source: Internet
Author: User

Prior to the AIR4.0 version, r* could not be used within ANE, and operation Resources could use only Getresourceid (). This is especially frustrating for the SDK.

However, after 4.0, you can use r* to access resources directly by specifying platform.xml at the time of packaging.

Adobe website RELATED links

A video of the stick

One of the two points to note

1 ' Android Project works to be set as library

2 ' shot jar Package Delete r* related class One-click Script see: Ane from Getting started to mastering---One-click Package ane

Actual combat:

STEP1 Create an Android project, note that select Application, do not select the library because the library does not generate the corresponding file structure and Androidmanifest.xml

STEP2 Change Project for library

Step3 adds or changes a fun to access a resource through r*, which is accessed R.string.hello

 Packagecom.testzone.t2;Importandroid.content.Intent;ImportAndroid.widget.Toast;ImportCom.adobe.fre.FREContext;Importcom.adobe.fre.FREFunction;ImportCom.adobe.fre.FREObject; Public classT1anefunImplementsfrefunction {@Override PublicFreobject Call (Frecontext frecontext, freobject[] freobjects) {Toast.maketext (Frecontext.getactivity (),"Call T1", Toast.length_short). Show (); Try{String Hello=frecontext.getactivity (). getString (R.string.hello); Toast.maketext (Frecontext.getactivity (),"Hello is:" +Hello, Toast.length_short). Show (); } Catch(Exception e) {toast.maketext (Frecontext.getactivity (),"Error is:" +e.tostring (), Toast.length_short). Show (); }return NULL; }}

STEP4 Compiling the jar package

This operation is described in the---simple whatever of the ANE from getting started to mastering

STEP5 Delete all the parts of the jar package about r*

STEP6 Copy the jar package to the ANE build directory

Create Platform.xml under the STEP7 Ane build directory

<Platformxmlns= "http://ns.adobe.com/air/extension/19.0">    <packagedresources>        <Packagedresource>            <PackageName>Com.testzone.t2</PackageName>            <FolderName>Res</FolderName>        </Packagedresource>    </packagedresources></Platform>

Please refer to the Adobe website for the specific meanings of these links

STEP8 Modifying package parameters Join

-platformoptions Platform.xml

For details, refer to the ane from getting started to mastering---One-click Package ane

ANE from getting started to mastering---Accessing resources using r*

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.