来源:http://bbs.9ria.com/thread-102038-1-1.html

上一章,我已经介绍了如果创建IOS库文件,并定义了两个方法ShowIconBadageNumber和InitNativeCode。好了。这一篇,我们主要来学习一下,如果创建Flex库项目。
(小提示,要安装Flash Builder4.6的时候,要把以前的Flash BUilder4.5卸载,不然会造成安装不成功的。)
1,打开安装好的Flash Builder 4.6 Prelease,创建一个Flex库项目。(小提示,这里建议用SDK4.5.1.不要用4.6.因为本人在发展用4.6的时候打包ANE有点问题。)
     (在配置一项确保选中的是通用库(适用于Web,桌面和手机项目),Flash SDK选4.5.1.如果安装好后没有。请去opensource.adobe.com下载一下该SDK)

2,OK,创建好之后,新建一个类文件,用来供后面的测试ANE可用。我们这里为了测试之前在Xcode定义的两个方法,内容如下:

  1. package com.coolexp
  2. {
  3. import flash.external.ExtensionContext;
  4. public class ANELibUtils
  5. {
  6. private static var extContext:ExtensionContext = null;
  7. public function ANELibUtils()
  8. {
  9. if (!extContext)
  10. {
  11. initExtension();
  12. }
  13. }
  14. public static function showBadageNum(num:int):int{
  15. if (!extContext)
  16. {
  17. initExtension();
  18. }
  19. return int(extContext.call("ShowIconBadageNumber",num));
  20. }
  21. //Initialize the extension by calling our "initNativeCode" ANE function
  22. private static function initExtension():void
  23. {
  24. trace ("Vibration Constructor: Create an extension context");
  25. // The extension context's context type  is NULL, because this extension
  26. // has only one context type.
  27. extContext = ExtensionContext.createExtensionContext("com.coolexp.ANELib", null);
  28. //com.coolexp.ANELib这里我们用这个ExtensionID,确保后面在打包ANE文件的时候一致就可以了。
  29. extContext.call("initNativeCode");
  30. }
  31. }
  32. }

复制代码

3,OK,Build项目,会生成一个SWC后缀后的文件,复制一份出来,把SWC改成ZIP,解压,里面有一个XML文件,一个SWF文件,复制出来。各用。再把SWC文件也复制出来,备用。

4.新建一个extension.xml的文件,内容如下:
(如果下面的com.coolexp.ANELib,要跟上面的AS类文件里一致,libCoolExpLibANEIOS.a. 就是我们第一篇文章里得到文件)

  1. <extension xmlns="http://ns.adobe.com/air/extension/2.5">
  2. <id>com.coolexp.ANELib</id>
  3. <versionNumber>1</versionNumber>
  4. <platforms>
  5. <platform name="iPhone-ARM">
  6. <applicationDeployment>
  7. <nativeLibrary>libCoolExpLibANEIOS.a</nativeLibrary>
  8. <initializer>ExtInitializer</initializer>
  9. <finalizer>ExtFinalizer</finalizer>
  10. </applicationDeployment>
  11. </platform>
  12. </platforms>
  13. </extension>

复制代码

5.OK,这部分到此就OK了。

下面是Actionscript Library的项目下载地址:   <ignore_js_op> CoolExpANELib.fxpl.zip (2.22 KB, 下载次数: 194)

最新文章

  1. Parameter index out of range (2 &gt; number of parameters, which is 1)
  2. WIN2008 R2 安装SQLSERVER2008笔记
  3. WCF安全2-非对称加密
  4. Git代码管理心得
  5. shell 中grep命令详解
  6. Android ListView内容变化后的动态刷新
  7. .bash_profile 加载
  8. IDEA2017.3.4破解方式
  9. Stackoverflow热门问题
  10. Luminar 3 for Mac(照片编辑工具)v3.1.0中文特别版
  11. Centos7 linux下通过源码安装redis以及使用
  12. 坑人的 Javascript 模块化编程 sea.js
  13. WORD文档中插入页码的问题
  14. 给1~3年iOS开发 经验朋友们的一些建议(附BAT面试题)
  15. 【详解】ThreadPoolExecutor源码阅读(二)
  16. ios开发之--UIViewContentMode详解
  17. bean的实例化
  18. Scrapy:创建爬虫程序的方式
  19. log4j 输出到 数据库
  20. Verilog笔记.6.FIFO

热门文章

  1. https://www.cnblogs.com/LBSer/p/3310455.html
  2. CEF 访问需要认证网页或接口(在Request的Headers中添加认证Token)
  3. Sword libcurl库CURLE_COULDNT_CONNECT错误
  4. Laya自定义组件
  5. FormsAuthentication使用指南,实现登录
  6. 使用Fiddler工具发送post请求(带有json数据)以及get请求(Header方式传参)
  7. Jenkins - 构建项目
  8. Component &#39;TABCTL32.OCX&#39;错误的处理方法
  9. 面试之leetcode分治-求众数,x幂等
  10. JAVA克隆对象报错:The method clone() from the type Object is not visible