守望者--AIR技术交流

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
热搜: ANE FlasCC 炼金术
查看: 1343|回复: 0

[打包发布] 提升ANE创建效率的一个小工具

[复制链接]
  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

    Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18

    威望
    562
    贡献
    29
    金币
    52688
    钢镚
    1422

    开源英雄守望者

    发表于 2015-2-20 20:17:13 | 显示全部楼层 |阅读模式
    本帖最后由 破晓 于 2015-2-20 20:20 编辑

    ANEBridgeCreator

    A little tool to simplify the startup of a ANE project.

    It lets you generate a "startup iOS ANE" project from a "bridge as3 class".

    I know it is not perfect but is really a good starting point.

    I have not provided the source code as is not very well done, but works!!

    Maybe if I have time i will do a cleanup and post it.


    Usage1.
    Pseudo Interface Class Creation

    Imagine you need an ANE that lets you start/stop the iphone torch, load a html page in a webview and dispatch a complete event when page is loaded.

    To do this you need to create a simple as3 class like:

    1. package es.xperiments.ane.torch
    2. {
    3.     [ANEConfig(autor="Pedro Casaubon", processAllMethods="true")]
    4.     [ANEvent(name="complete")]
    5.     public class Torch
    6.     {
    7.         [ANEmbed(arguments="mode")]
    8.         public function setTorchEnabled( mode:Boolean ):Boolean
    9.         {
    10.             return true;
    11.         }

    12.         [ANEmbed(arguments="url dispatchEventOnComplete")]
    13.         public function loadHtmlPage( url:String, dispatchEventOnComplete:Boolean ):void{}

    14.     }
    15. }
    复制代码


    2. Compile your "bridge" class to a swf
    You need to compile your class by preserving the metadata tags

    3. Open ANEBridgeCreator.swf

    4. Select your generated swf file

    5. Set the full class package class name.(ie: es.xperiments.ane.torch.Torch )

    6. Select the target AIR SDK

    7. Save the resulting zip file and decompress it

    8. Locate ANTBUILD/local.properties and change the FLEX_HOME path

    9. Start coding!!!

    10. Use the build script inside ANTBUILD to generate your ANE

    Metadata

    ANEBridgeCreator uses metadata to know some aspects of your interface


    [ANEConfig]

    It has 2 parameters   

    autor               ==> The name you like to be shown at yoour generated code   
    processAllMethods   ==> By default ANEBridgeCreator will only generate code for
                                the methods that have the [ANEmbed]
                                Set it to true to process all the methods of the class

    [ANEvent(name="xxx")]

    This metadata lets you define the name of the events your ANE will use.
    In the obj-c side, include the generated {{classname}}EventMessages.h and dispatchthe events with the provided "util" DISPATCH_STATUS_EVENT as:   

    DISPATCH_STATUS_EVENT( context, nameoftheevent, eventdata );

    [ANEmbed(arguments="argName1 argName2")]

    Use this metadata tag to specify wich methods to generate when processAllMethodsof ANEConfig tag is set to false(default).
    You can also "name" your method params to be the same in as3 and in obj-c.
    If you have by a example a method:
        [ANEmbed(arguments="name password")]
         public function login( name:String, password:String )

    It will generate the code with the "name" or "password" param names, otherwiseit will name your params "stringArg0" and "stringArg1





    相关链接:


    https://github.com/xperiments/ANEBridgeCreator

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有帐号?立即注册

    x
    守望者AIR技术交流社区(www.airmyth.com)
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    
    关闭

    站长推荐上一条 /4 下一条

    QQ|手机版|Archiver|网站地图|小黑屋|守望者 ( 京ICP备14061876号

    GMT+8, 2024-4-18 12:35 , Processed in 0.044278 second(s), 34 queries .

    守望者AIR

    守望者AIR技术交流社区

    本站成立于 2014年12月31日

    快速回复 返回顶部 返回列表