AIRã¯åçŽã«çŽ æŽãããã¯ãã¹ãã©ãããã©ãŒã ç°å¢ã§ãã ãã©ãããã©ãŒã åºæã®ãããã䜿çšãããŸã§ã¯ã ãã©ãŠã¶ãã©ãã·ã¥ã²ãŒã ãOS Xçšã®ãã¹ã¯ããããã©ãã·ã¥ã²ãŒã ã«å€ããã¿ã¹ã¯ãäžãããããšãã«ééããã®ã¯ãã®åé¡ã§ãããAIRç°å¢ã䜿çšããããããã¹ãŠã¯ãæ°æéã§ç§ã«ãã£ãŠè¡ãããŸããããããã¯ã«ã¯æ å ±ããã£ã±ãã§ãã æãèå³æ·±ãããšã¯ãGameCenterãIn-App-Purchaseãªã©ãããŸããŸãªAppleãµãŒãã¹ãã²ãŒã ã«æ¥ç¶ããå¿ èŠãçãããšãã«å§ãŸããŸããã ãããŠãããã§ç§ã¯å°é£ã«ééããŸããã å®éã«ã¯ãç¡æã®ãã®ãå«ãæ¢è£œã®ANEããããããããšããããšã§ãã ãããåé¡ã¯ãããããã¹ãŠã®ãœãªã¥ãŒã·ã§ã³ãiOSã§ã®ã¿æ©èœããããšã§ãã OS Xã«ã¯ãæ¢è£œã®ã©ã€ãã©ãªã¯ãããŸãããããããã®ã©ã€ãã©ãªã®äœæã«é¢ããæ å ±ã§ãããäœå¹Žãåã®ããã€ãã®ã€ã³ã¿ãŒããããªãœãŒã¹ããå°ããã€åéããå¿ èŠããããåžžã«ããã€ãã®èœãšãç©Žãæ°·å±±ã«ããé¥ããŸããã
ããã§ãèç©ãããç¥èãšçµéšããã¹ãŠ1ãæã«éããå ±æããŠãã±ã·ã®ãã€ãã£ãã©ã€ãã©ãªãäœæããããšã«æ±ºããå Žåã«çµéšããèŠåŽãå°ãªããšãå°ã軜æžããããšæããŸãã OS Xçšã®4ã€ã®æ¡åŒµæ©èœãéçºããåŸãããã»ã©è€éã§æŽç·Žãããããã«ã¯èŠããŸããã
ã ããã ä»äºã®ããã«ãç§ã¯äœ¿çšããŸããïŒ
AIR 16
Flex 4.6.0;
Adobe Flash Builder 4.6ãŸãã¯IntelliJ IDEA 14ïŒã©ã€ãã©ãªã®äœæã«ã¯Flash Builderã䜿çšããŸããããIntelliJ IDEAã§ãåãããšãã§ããŸããããããç§ãIntelliJ IDEAã§éçºãããããžã§ã¯ãã§ãã奜ã¿ã®åé¡ã ãšæããŸãïŒã
Xcode 6.1.1;
OS X YosemiteïŒ10.10.1ïŒ;
ANEãäœæããããã»ã¹å šäœã3ã€ã®éšåã«åå²ããŸãã
ããŒã1 Objective-c
ã»ãšãã©ã®ãã€ãã£ãã³ãŒããèšè¿°ããŠãã€ãã£ããšã¯ã¹ãã³ã·ã§ã³ã®äœæãéå§ããæ¹ãçã«ããªã£ãŠãããšæããŸããããããã«ããŠãããã€ãã£ãã³ãŒãã®å€æŽã«äœåºŠãæ»ãå¿ èŠããããŸãã
Xcodeã§æ°ãããããžã§ã¯ããäœæããããšããå§ããŸãã ãã¡ã€ã«->æ°èŠ->ãããžã§ã¯ã...ïŒCmd + Shift + NïŒã 次ã«ãOX X->ãã¬ãŒã ã¯ãŒã¯ãšã©ã€ãã©ãª-> Cocoa FramworkãéžæããŸãã
ãã¬ãŒã ã¯ãŒã¯ã®ååãèãåºããŸãã ååã¯äœã§ãæ§ããŸããããå°æ¥çã«ã¯ãå°æ¥ã®ãã€ãã£ãã©ã€ãã©ãªã§äœ¿çšãããããšã¯ãããŸããã
ãã®åŸãããããŒãã¡ã€ã«ã1ã€ãã空ã®ãããžã§ã¯ããäœæãããŸãã
ãã€ãã£ãã©ã€ãã©ãªããObjective-Cã§äœããã®æ¹æ³ã§å®è¡ããå¿ èŠãããåçŽãªåäžã®é¢æ°ãå®è£ ããäºå®ã®å Žåãå®è£ ãã¡ã€ã«ïŒ* .mïŒã®ã¿ã䜿çšããŠããããŒãã¡ã€ã«ãªãã§å®è¡ã§ããŸãã ããããæ¬æ Œçãªã¯ã©ã¹ã§ã®äœæ¥ã«ã€ããŠèª¬æããŸãã
ã³ãŒããèšè¿°ããåã«ãAdobe AIR.frameworkã©ã€ãã©ãªããããžã§ã¯ãã«è¿œå ããå¿ èŠããããŸãã ãããžã§ã¯ããå³ã¯ãªãã¯ããããã¡ã€ã«ãã...ãã«è¿œå ããéžæããŸãã AIRã«å¿ èŠãªã©ã€ãã©ãªãä¿åãããŠãããããAIRã®æ°ããããŒãžã§ã³ãæ¢ã«ããããšãé¡ã£ãŠããŸãã ããã§èŠã€ããããšãã§ããŸãïŒ../AIR_FOLDER/runtimes/air/mac/Adobe AIR.frameworkã
ãã®åŸããããžã§ã¯ãã¯æ¬¡ã®ããã«ãªããŸãã
ãããžã§ã¯ãçšã®32ãããã¿ãŒã²ãããã©ãããã©ãŒã ïŒi386ïŒãã€ã³ã¹ããŒã«ããå¿ èŠããããŸãïŒç®çã§ã¯ãããŸããïŒã å·çæç¹ã§ã¯ãAdobe AIR.frameworkã¯32ããããã©ãããã©ãŒã ã§ã®ã¿æ©èœããŠããŸããã ãã«ãèšå®ã®åããããžã§ã¯ãèšå®ã§ãèªååç §ãæ¢ããObjective-Cã®èªååç §ã«ãŠã³ããNoã«èšå®ããŸãã
ãŸããåºåãã¡ã€ã«ã®ãã¹ãå€æŽããŠããœãŒã¹ãšåãå Žæã«é 眮ããŸãã 誰ã«ãšã£ãŠãã䟿å©ã§ãã
ãŸããã³ã³ããã¹ãã®åæååïŒã³ã³ããã¹ãïŒãšã©ã€ãã©ãªèªäœãå®çŸ©ããå¿ èŠããããŸãïŒãªãã·ã§ã³ã§ããã¡ã€ãã©ã€ã¶ãå®çŸ©ã§ããŸãïŒã
æåã«ãã³ã³ããã¹ãåæååãå®çŸ©ããŸãã å¥åŠãªããšã«ãas3éšåã®ã³ã³ããã¹ããåæåãããšãã«åŒã³åºãããŸãããããã«ã€ããŠã¯åŸã§è©³ãã説æããŸãã ãããžã§ã¯ãã§è€æ°ã®ãã€ãã£ãã©ã€ãã©ãªã䜿çšããå Žåãã€ãã·ã£ã©ã€ã¶ã®äžæã®ååãåŒã³åºãããšã¯éåžžã«éèŠã§ãã ã³ã³ããã¹ãåæååã¯ãas3ã³ãŒããã䜿çšã§ããé¢æ°ãå®çŸ©ããŸãã
ã ããã 次ã®ããã«ã³ã³ããã¹ãåæååã宣èšããŸãã
FREContext AirCtx = nil; // void MyAwesomeNativeExtensionContextInitializer(void* extData, const uint8_t* ctxType, FREContext ctx, uint32_t* numFunctionsToTest, const FRENamedFunction** functionsToSet) { NSLog(@"[MyANE.Obj-C] Entering ContextInitinalizer()"); *numFunctionsToTest = 1; // , as3 . . - . FRENamedFunction* func = (FRENamedFunction*) malloc(sizeof(FRENamedFunction) * *numFunctionsToTest); func[0].name = (const uint8_t*) "initLibrary"; // , as3. func[0].functionData = NULL; // NULL. NULL. func[0].function = &init; // FREObject() ojbective-c // // func[n].name = (const uint8_t*) "name"; // func[n].functionData = data; // func[n].function = &function; *functionsToSet = func; AirCtx = ctx; NSLog(@"[MyANE.Obj-C] Exiting ContextInitinalizer()"); }
ã³ã³ãœãŒã«ã«ã¡ãã»ãŒãžãåºåããNSLogé¢æ°ã¯ãã¡ã€ã³ãããžã§ã¯ããéçºããŠããIDEã³ã³ãœãŒã«ã§ããã¬ãŒã¹ã®åœ¢åŒã§ã¡ãã»ãŒãžãåºåããããšã«æ³šæããŠãã ããã
次ã«ãã©ã€ãã©ãªèªäœã®åæååãå®çŸ©ããŸãã ãã®äžã§ãã€ãã·ã£ã©ã€ã¶ãšã³ã³ããã¹ããã¡ã€ãã©ã€ã¶ãžã®ãªã³ã¯ã瀺ããŸãã åŸã§ã©ã€ãã©ãªã®ã¢ã»ã³ããªã§äœ¿çšããŸãã
void MyAwesomeNativeExtensionInitializer(void** extDataToSet, FREContextInitializer* ctxInitializerToSet, FREContextFinalizer* ctxFinalizerToSet ) { NSLog(@"[MyANE.Obj-C] Entering ExtInitializer()"); *extDataToSet = NULL; *ctxInitializerToSet = &MyAwesomeNativeExtensionContextInitializer; // *ctxFinalizerToSet = &MyAwesomeNativeExtensionContextFinalizer; // () NSLog(@"[MyANE.Obj-C] Exiting ExtInitializer()"); }
次ã«ãã¢ã¯ã·ã§ã³ã¹ã¯ãªããã³ãŒããã䜿çšã§ããå¯äžã®é¢æ°ã«ã€ããŠèª¬æããŸãã ãã®é¢æ°å ã§ã¯ãiOS SDKã®äœ¿çšãªã©ãããŸããŸãªãã€ãã£ãã®Objective-Cã¡ãœãããåŒã³åºãããšãã§ããŸãã
FREObject (init) (FREContext context, void* functionData, uint32_t argc, FREObject argv[]){ NSLog(@"[MyANE.Obj-C] Hello World!"); return nil; }
䟿å®äžããã£ã¬ã¯ãã£ãã䜿çšã§ããŸãã
#define DEFINE_ANE_FUNCTION(fn) FREObject (fn)(FREContext context, void* functionData, uint32_t argc, FREObject argv[])
äžèšã®ãã£ã¬ã¯ãã£ãã䜿çšãããšãã¯ããã«ç°¡åã§çãé¢æ°ãå®çŸ©ã§ããŸãã
DEFINE_ANE_FUNCTION(init){ NSLog(@"[MyANE.Obj-C] Hello World!"); return nil; }
ãã«ããäœæããŸãïŒCommand + BïŒã ãã®çµæãæåã«ç€ºãããã¹ã«ãæåã«ç€ºããååãšåãååã®ãã¬ãŒã ã¯ãŒã¯ã衚瀺ãããã¯ãã§ãã
æãåçŽãªObjective-Cã©ã€ãã©ãªãçšæãããŠããŸãã ã§ããã®ã¯ããã¬ãŒã¹ã§æååãåºåããããšã ãã§ãã ãããããã®äœæ¥ãå®èšŒããããã«ã¯ååã§ãã ããã§ãANE-AS3ã©ã€ãã©ãªã®åŸåãäœæããå¿ èŠããããŸãã
ãœãŒã¹ã³ãŒã
Myane.h
#import <Adobe AIR/Adobe AIR.h> #import <Foundation/Foundation.h> //! Project version number for MyANE. FOUNDATION_EXPORT double MyANEVersionNumber; //! Project version string for MyANE. FOUNDATION_EXPORT const unsigned char MyANEVersionString[]; @interface MyANE : NSObject @end
MyANE.m
#import "MyANE.h" #define DEFINE_ANE_FUNCTION(fn) FREObject (fn)(FREContext context, void* functionData, uint32_t argc, FREObject argv[]) @implementation MyANE @end FREContext AirCtx = nil; DEFINE_ANE_FUNCTION(init){ NSLog(@"[MyANE.Obj-C] Hello World!"); return nil; } void MyAwesomeNativeExtensionContextInitializer(void* extData, const uint8_t* ctxType, FREContext ctx, uint32_t* numFunctionsToTest, const FRENamedFunction** functionsToSet) { NSLog(@"[MyANE.Obj-C] Entering ContextInitinalizer()"); *numFunctionsToTest = 1; FRENamedFunction* func = (FRENamedFunction*) malloc(sizeof(FRENamedFunction) * *numFunctionsToTest); func[0].name = (const uint8_t*) "initLibrary"; func[0].functionData = NULL; func[0].function = &init; *functionsToSet = func; AirCtx = ctx; NSLog(@"[MyANE.Obj-C] Exiting ContextInitinalizer()"); } void MyAwesomeNativeExtensionContextFinalizer(FREContext ctx) { } void MyAwesomeNativeExtensionInitializer(void** extDataToSet, FREContextInitializer* ctxInitializerToSet, FREContextFinalizer* ctxFinalizerToSet ) { NSLog(@"[MyANE.Obj-C] Entering ExtInitializer()"); *extDataToSet = NULL; *ctxInitializerToSet = &MyAwesomeNativeExtensionContextInitializer; *ctxFinalizerToSet = &MyAwesomeNativeExtensionContextFinalizer; NSLog(@"[MyANE.Obj-C] Exiting ExtInitializer()"); } void MyAwesomeNativeExtensionFinalizer(void* extData) { }
ããŒã2 ã¢ã¯ã·ã§ã³ã¹ã¯ãªãã
ã¢ã¯ã·ã§ã³ã¹ã¯ãªããçšã®ã©ã€ãã©ãªãäœæããã«ã¯ãActionScriptã§éçºããå¯èœæ§ãããä»»æã®IDEã䜿çšã§ããŸãã ããããç§ã¯ãã®ãããªç®çã§æšæºã®IDEã䜿çšããŸãã-Flash Builderã
ã©ã€ãã©ãªã®äœæã¯éåžžã«ç°¡åã§ãããã¡ã€ã«->äœæ-> Flexã©ã€ãã©ãªãããžã§ã¯ãã
ã©ã€ãã©ãªãåŒã³åºããŠãå¿ ãAdobe AIRã©ã€ãã©ãªãæ¥ç¶ããŸãã å®éã1ã€ã®ã¯ã©ã¹ã«å¯ŸããŠãããè¡ããŸããããã«ãããã³ã³ããã¹ããæäœã§ããŸãã
æ°ããActionScriptã¯ã©ã¹ãããã«äœæãïŒããã©ã«ãããã±ãŒãžã§äœæãããšããã«äŸ¿å©ã«ãªããŸãïŒãflash.events.EventDispatcherããç¶æ¿ããŸãïŒäžè¬çã«ã¯ãäœããã§ãç¶æ¿ã§ããŸããããŸã£ããç¶æ¿ã§ããŸããããEventDispatcherã¯ã©ã¹ã§ã¯èš±å¯ãããŸãïŒã€ã³ã¹ã¿ã³ã¹ã«ã€ãã³ãããã£ã¹ãããããŸããããã¯ãèŠæ±ãããããŒã¿ã®äžéšïŒGCãã¬ã³ãã®ãªã¹ããå©çšå¯èœãªIAPã®ãªã¹ãïŒãããã«æ¥ãªãiOS SDKã§äœæ¥ãããšãã«éåžžã«äŸ¿å©ã§ãã ãããã¡ã€ã³ã¯ã©ã¹ã«ãªããã©ã€ãã©ãªãæäœãããšãã«äœ¿çšããŸãã
æåã«ãã³ã³ããã¹ãã®ã€ã³ã¹ã¿ã³ã¹ãååŸããå¿ èŠããããŸãã ããã¯æ¬¡ã®ããã«è¡ãããŸãã
var extCtx:ExtensionContext = ExtensionContext.createExtensionContext("my.awesome.native.extension", null);
éçcreateExtensionContextã¡ãœããã¯ãextensionContextã€ã³ã¹ã¿ã³ã¹ãäœæããŸãã ããã§ã¯ãæ¡åŒµæ©èœã®IDããã®å Žåã¯ãmy.awesome.native.extensionããããã³ã³ã³ããã¹ãã¿ã€ããæž¡ãå¿ èŠããããŸãã ã¿ã€ãã¯ãè€æ°ã®ã©ã€ãã©ãªå®è£ ã®å Žåã«ã®ã¿æå®ããå¿ èŠããããŸãã 1ã€ã®å®è£ ãèšç»ãããŠããå ŽåãnullãåãšããŠæž¡ãããšãã§ããŸãã
ãããžã§ã¯ãã§åæã«äœ¿çšã§ããã®ã¯ãç¹å®ã®ã¿ã€ãã®ã³ã³ããã¹ãã§ãã1ã€ã®ïŒã·ã³ã°ã«ãã³ïŒã€ã³ã¹ã¿ã³ã¹ã®ã¿ã§ãã å人çã«ã¯ãå€æ°ã®ãã€ãã£ãæ¡åŒµãäœæããåŸããã®æ¡åŒµãè€æ°å®è£ ããå¿ èŠã¯ãããŸããã§ããã ãããã£ãŠããã®å Žåã1ã€ã®å®è£ ãæã€ããšã§ãåºæ¬çã«ANEå šäœã«å¯ŸããŠ1ã€ã®ã€ã³ã¹ã¿ã³ã¹ãã§ããŸãã ãããã£ãŠãã³ã³ã¹ãã©ã¯ã¿ãŒã1ååŒã³åºãå¿ èŠããããå°æ¥ã¯æ¢ã«äœæããããªããžã§ã¯ããååŸããã ãã§ãã
å®è£ ããæãç°¡åãªãªãã·ã§ã³ã¯ããªããžã§ã¯ãã®ã€ã³ã¹ã¿ã³ã¹ãè¿ãç¹å®ã®éçé¢æ°ãåŒã³åºãããã³ã³ã¹ãã©ã¯ã¿ããªãå Žåã¯ã³ã³ã¹ãã©ã¯ã¿ãä»ããŠæ°ãããã®ãäœæããããšã§ãã
æåã«ãã³ã³ã¹ãã©ã¯ã¿ãŒã«ã€ããŠèª¬æããŸãïŒãããžã§ã¯ãããåŒã³åºãããšã¯ãããŸããïŒã
private static var _instance:MyANE; // private var extCtx:ExtensionContext; // public function MyANE(target:IEventDispatcher=null) { if (!_instance) { if (this.isSupported) { extCtx = ExtensionContext.createExtensionContext("my.awesome.native.extension", null); // if (extCtx != null) { trace('[MyANE.AS3] extCtx is okay'); } else { trace('[MyANE.AS3] extCtx is null.'); } } _instance = this; } else { throw Error('[MyANE.AS3] This is a singleton, use getInstance, do not call the constructor directly'); // , } }
ãŸããANEãMacã§å®è¡ããããšããŠããããšã確èªããå¿ èŠããããŸãã
public function get isSupported():Boolean { return Capabilities.manufacturer.indexOf('Macintosh') > -1; }
ããã§ãã©ã€ãã©ãªã®ã€ã³ã¹ã¿ã³ã¹ãååŸããå¿ èŠããããã³ã«ã¢ã¯ã»ã¹ããé¢æ°ã«ã€ããŠèª¬æããŸãã
public static function getInstance():MyANE { return _instance != null ? _instance : new MyANE(); }
ãã®æç¹ã§ãåæåãå®äºããŸããã ããã§ãObjective-Cã®ã¡ãœããã䜿çšã§ããŸãã ã³ã³ããã¹ãã€ã³ã¹ã¿ã³ã¹ã¯ã©ã¹ã¡ãœããåŒã³åºãïŒïŒã䜿çšããŠãã€ãã£ãã³ãŒãããé¢æ°ãåŒã³åºãããšãã§ããŸãããã®ã¡ãœããåŒã³åºãã¯ããã€ãã£ãã³ãŒãã®ã³ã³ããã¹ãåæååã§æå®ãããé¢æ°åã®1ã€ãšåŒæ°ãšããŠé¢æ°ãã©ã¡ãŒã¿ãŒãæž¡ãå¿ èŠããããŸãã ãã®äŸã§ã¯ããinitLibraryããšããé¢æ°ã1ã€ã ã説æããŸããã 圌女ã¯ãã©ã¡ãŒã¿ãåãå ¥ããŸããããŸããäœãæž¡ããŸããã
public function init():void { extCtx.call("initLibrary"); }
ãããžã§ã¯ããä¿åããŸãã ã©ã€ãã©ãªã¯èªåçã«ã³ã³ãã€ã«ãããããã©ã«ãã§ã¯ããããžã§ã¯ãã®ã«ãŒãã«ããbinãã£ã¬ã¯ããªã«é 眮ãããŸãã
ãããã£ãŠãæãåºæ¬çãªæ©èœãæäŸããŸããã ããã§æåŸã®éšåã«ç§»åã§ããŸãã
ãœãŒã¹ã³ãŒã
package { import flash.events.EventDispatcher; import flash.events.IEventDispatcher; import flash.external.ExtensionContext; import flash.system.Capabilities; public class MyANE extends EventDispatcher { private static var _instance:MyANE; private var extCtx:ExtensionContext; public function MyANE(target:IEventDispatcher=null) { if (!_instance) { if (this.isSupported) { extCtx = ExtensionContext.createExtensionContext("my.awesome.native.extension", null); if (extCtx != null) { trace('[MyANE.AS3] extCtx is okay'); } else { trace('[MyANE.AS3] extCtx is null.'); } } _instance = this; } else { throw Error('[MyANE.AS3] This is a singleton, use getInstance, do not call the constructor directly'); } } public function get isSupported():Boolean { return Capabilities.manufacturer.indexOf('Macintosh') > -1; } public static function getInstance():MyANE { return _instance != null ? _instance : new MyANE(); } public function init():void { extCtx.call("initLibrary"); } }
ããŒã3ã å³æžé€šéäŒ
æåŸã«ã2ã€ã®ãã€ãã£ãã©ã€ãã©ãªããããŸãã å¿ èŠãªã®ã¯ãããããå®å šãªANEã«æ¥ç¶ããããšã§ãã
æåã«ãæ¡åŒµæ©èœãèšè¿°ããèšè¿°åãå¿ èŠã§ãã 次ã®* .xmlãã¡ã€ã«ã«ãªããŸãã
<extension xmlns="http://ns.adobe.com/air/extension/3.9"> <id>my.awesome.native.extension</id> <versionNumber>1.0.0</versionNumber> <platforms> <platform name="MacOS-x86"> <applicationDeployment> <nativeLibrary>MyANE.framework</nativeLibrary> <initializer>MyAwesomeNativeExtensionInitializer</initializer> <finalizer>MyAwesomeNativeExtensionFinalizer</finalizer> </applicationDeployment> </platform> <platform name="default"> <applicationDeployment/> </platform> </platforms> </extension>
ããã«ïŒ
id-ãªãŸã«ããŒã®IDãas3éšåã§ã³ã³ããã¹ãã€ã³ã¹ã¿ã³ã¹ãäœæãããšãã«æå®ããIDãšäžèŽããå¿ èŠããããŸãã
nativeLibrary-Objective-Cããã³ã³ãã€ã«ããããã¬ãŒã ã¯ãŒã¯
åæååããã¡ã€ãã©ã€ã¶-ã©ã€ãã©ãªã®åæååãšãã¡ã€ãã©ã€ã¶ïŒã³ã³ããã¹ãã§ã¯ãªãïŒãããã¯Ojbective-CããŒãã§ã説æããŸããã
ãã€ãã£ãã³ãŒãããªãããã©ã«ããã©ãããã©ãŒã ã®å®è£ ãäœæããããšããå§ãããŸãã ããŠãæšå¥šäºé ã«åŸã£ãŠãã ãããããã¯é£ãããããŸããã
ã©ã€ãã©ãªã®æåŸã®éšåã®æºåãã§ããã®ã§ããã«ããéå§ã§ããŸãã ãããŠããããã楜ãã¿ãå§ãŸããŸãã
䟿å®äžãã¢ã»ã³ããªçšã«å¥ã®ãã©ã«ããŒãäœæããããšããå§ãããŸããããããªããšãæ··ä¹±ãšãridgeãçºçããŸãã 次ã®ãã©ã«ããŒæ§é ã䜿çšããŸãã
ã©ãã§
- _out-ã¢ã»ã³ããªã®å®éã®ãã©ã«ããŒã
- default-ãã©ãããã©ãŒã ã®ããã©ã«ãå®è£
- library.sfw-çµã¿ç«ãŠãããas3-partã解åããŠåŸãããswf
- mac-macãã©ãããã©ãŒã ã®å®è£
- library.sfw-çµã¿ç«ãŠãããas3-partã解åããŠåŸãããswf
- MyANE.framework-ã³ã³ãã€ã«ãããObjective-CããŒã
- extension.xml-æ¡åŒµèšè¿°å
- MakeANE.shã¯ãã©ã€ãã©ãªãè¿ éã«æ§ç¯ããããã®åãªãã¹ã¯ãªããã§ã
- default-ãã©ãããã©ãŒã ã®ããã©ã«ãå®è£
- ActionScript3ãšObjective-Cã¯ãã©ã€ãã©ãªã®ãããžã§ã¯ãããŒããã©ã«ããŒã§ãã
library.sfwã§åå¥ã«ã ã¯ããããã¯ã©ã€ãã©ãªã®äžéšã§ãããå¥ã ã«ããå¿ èŠããããŸãããåæã«ãçµã¿ç«ãŠãããas3ããŒã¹ãå¿ èŠã§ãã ååŸããã«ã¯ãã¢ã»ã³ãã«ãããas3ã©ã€ãã©ãªãéåžžã®zipã¢ãŒã«ã€ããšããŠè§£åããå¿ èŠããããŸãïŒãããšåãas3ã©ã€ãã©ãªãä¿æããŸãïŒã
ããšã¯ãAIRéçºããŒã«ïŒADTïŒã䜿çšããŠæ¡åŒµæ©èœãæ§ç¯ããã ãã§ãã ããã§èŠã€ããããšãã§ããŸãïŒ../AIR_FOLDER/bin/adt
ã¢ã»ã³ããªã«ã¯ã次ã®ã¹ã¯ãªããïŒ_outãã©ã«ããŒããïŒã䜿çšããŸãã
AIR_FOLDER / bin / adt -package -target ane MyANE.ane extension.xml -swc ../ActionSript3/bin/MyANE.swc -platform MacOS-x86 -C macã -platform default -C defaultã
ããã§ãã³ã³ãã€ã«æžã¿ã®ãã€ãã£ãã©ã€ãã©ãªã§ããMyANE.aneãã¡ã€ã«ãå®æããŸããã ããããããã§ããçµããã§ã¯ãããŸããã OS Xãããžã§ã¯ãã§ãã€ãã£ãã©ã€ãã©ãªã䜿çšããããšãããšãæ¬åœã®æ¥œãã¿ãå§ãŸããŸãã ç¹°ãè¿ãã«ãªããŸãããiOSã«ã¯ããããã®ãã¥ãŒããªã¢ã«ãšããŸããŸãªFAQããããŸãããå€æããããã«ãOS Xã§ã¯ã¿ã³ããªã³ã ãã§ãªãä»ã®ååŒãå®è¡ããå¿ èŠããããŸãã
æåŸã®éšåã ãããžã§ã¯ããžã®ãã€ãã£ãã©ã€ãã©ãªã®çµ±å
ãã®ãããç¬èªã®æžé¢ã©ã€ãã©ãªããããŸãã ããã«ãå®æãã* .aneãã¡ã€ã«ããããŸãã åã£ãŠäœ¿çšããŸãã ããããéããŸãã éçºäžã«OS Xã§ãã€ãã£ãã©ã€ãã©ãªã䜿çšããããã«ãããã¯å¿ èŠãããŸããã ãããããã¡ãããç§ãã¡ã®åªåã¯ç¡é§ã§ã¯ãããŸããã§ããã 次ã®ããšãè¡ãã ãã§ãïŒIntelliJ IDEAã®ããã»ã¹ã«ã€ããŠèª¬æããŸãããFlash Builderã®å Žåãããã»ã¹ã¯äŒŒãŠãããå Žåã«ãã£ãŠã¯ããã«ç°¡åã§ãïŒã
- * .aneãã¡ã€ã«ãéåžžã®zipã¢ãŒã«ã€ããšããŠãæ¡åŒµåã®ID + .aneãšãŸã£ããåãååãæã€ãã©ã«ããŒã«è§£åããŸãã ãã®å Žåããmy.awesome.native.extension.aneãã«ãªããŸãã ãã®ãã©ã«ãããããžã§ã¯ãå ã®æ°ãããã£ã¬ã¯ããªã«ã³ããŒããããšããå§ãããŸãã ããšãã°ãæ¢ã«è§£åãããæ¡åŒµæ©èœãå«ãŸããŠãããã®libs-aneããããŸãã
- IntelliJ IDEAã§ã¯ããããžã§ã¯ãèšå®ã§ããã®ãã£ã¬ã¯ããªãè¿œå ããªãã§ãã ããã
- ãããžã§ã¯ãå ã®å¥ã®ãã£ã¬ã¯ããªã«ãã¢ã»ã³ãã«ãããas3ã©ã€ãã©ãªãè¿œå ããŸãã libs-swcãšåŒã°ãããã®ãã£ã¬ã¯ããªããããŸãã
- ãã®ãã£ã¬ã¯ããªã¯ããããžã§ã¯ãã«å¿ããŠãã§ã«è¿œå ãããŠããŸãã ãªã³ã¯ã¿ã€ããããŒãžãããŸããã
- ADLèµ·åãã©ã¡ãŒã¿ãŒã§ã次ã®ãªãã·ã§ã³-extdir / ABSOLUTE_PATH_TO_PROJECT / libs-aneãè¿œå ããå¿
èŠããããŸãã IntelliJ IDEAã§ã¯ããããã®ãªãã·ã§ã³ã¯ãå®è¡ã->ãæ§æã®ç·šéã->ãAIRãããã°ã©ã³ãã£ãŒãªãã·ã§ã³ãã«ãããŸãã
- ãããžã§ã¯ãèšè¿°åã§ããextensionsããããã¯ã«ãã€ãã£ãæ¡åŒµã®IDãè¿œå ããŸã
<extensions> <extensionID>my.awesome.native.extension</extensionID> </extensions>
ããã§ããããã°ã«ãã€ãã£ãæ¡åŒµã䜿çšã§ããŸãã ãããããã1ã€ãããŸãã ãããããåç¥ã®ããã«ãiOS SDKã«ã¯ãFinderããèµ·åãããå Žåã«ã®ã¿æ£åžžã«æ©èœããã¯ã©ã¹ãããã€ããããŸãã ãããè¡ãã«ã¯ãåãIntelliJ IDEAã䜿çšããŠããã€ãã£ããã³ãã«ããã«ãããŠäœ¿çšã§ããŸãã ããããåé¡ã¯ããã€ãã£ãæ¡åŒµãçµ±åãã以åã®æ¹æ³ã§ã¯ãã³ãã«ãæ§ç¯ã§ããªãããšã§ãã ããããã¢ã»ã³ããªã¯äŸç¶ãšããŠæçšã§ããå¯èœæ§ããããããããå°ãäœæ¥ããå¿ èŠããããŸãã * .aneãèŠããŠããŸããïŒ ã ããä»ããã®æãæ¥ãŸããã
- ãã¹ãŠã®* .aneã¯ããããžã§ã¯ãå
ã®æ¬¡ã®åå¥ã®ãã£ã¬ã¯ããªã«è¿œå ããå¿
èŠããããŸãã anesãšããååã®ãã®ãã©ã«ããŒããããŸãã
IntelliJ IDEAã§ã¯ããããžã§ã¯ãã®èšå®ã§ããã®ãã£ã¬ã¯ããªãè¿œå ããŸãã æ¥ç¶ã®ã¿ã€ãã¯ANEã«ãªãããããå€æŽããããšã¯ã§ããŸããïŒãããããã³ãã«ãåéããŠãããã°ã¢ãŒãã§åæã«åäœããããšãäžå¯èœãªçç±ã§ãïŒã ããã«ãããã°ã®ããã«-ãã®ãã£ã¬ã¯ããªãäŸåé¢ä¿ããåé€ãããã³ãã«ã®ã¢ã»ã³ããªã®ããã«-è¿œå ããŸãã - ãããããããã«ãããå€éšã©ã€ãã©ãªãšããŠanesãå¿
èŠã§ãã ãããè¡ãã«ã¯ãè¿œå ã®buildãã©ã¡ãŒã¿ãŒã説æããè¿œå ã®build-config.xmlãã¡ã€ã«ã䜿çšããŸãã ãã®build-config.xmlã§ã¯ãå€éšã©ã€ãã©ãªã®ãã¹ãšããŠanesãã£ã¬ã¯ããªãæå®ããå¿
èŠããããŸãã æãåçŽãªãªãã·ã§ã³ã¯æ¬¡ã®ããã«ãªããŸãã
<?xml version="1.0"?> <flex-config> <target-player>16.0.0</target-player> <swf-version>23</swf-version> <compiler> <external-library-path> <path-element>${flexlib}/libs/player/{targetPlayerMajorVersion}.{targetPlayerMinorVersion}/playerglobal.swc</path-element> <path-element>anes</path-element> </external-library-path> <as3>true</as3> <library-path> <path-element>libs-swc</path-element> </library-path> </compiler> </flex-config>
è¿œå ã®build-configãã¡ã€ã«ã䜿çšããã«ã¯ããããžã§ã¯ãèšå®ã«è¿œå ããå¿ èŠããããŸãã ãããžã§ã¯ãæ§é ->è¿œå ã®ã³ã³ãã€ã©æ§æãã¡ã€ã«ã
ãŸãããŸãã¯ããç°¡åã«ãè¿œå ã®ã³ã³ãã€ã©ãªãã·ã§ã³ã§ããã©ã¡ãŒã¿ãŒãè¿œå ã§ããŸãïŒ "-external-library-path path-element anes"
ããã§ããã€ãã£ããã³ãã«ãåéã§ããŸãã ããã¯ãåã«Build-> Package AIR Applicationã«ãã£ãŠå®è¡ãããŸãã ã¿ãŒã²ãããšããŠã* .appã䜿çšããŸãã
ããŠãåºåã§ã¯ãANEã䜿çšããäœæ¥ãã©ãããåããæ¢è£œã®ãã€ãã£ããã³ãã«ãååŸããŸãã
以äžã§ãã ãæž èŽããããšãããããŸããããã®èšäºã誰ãã®åœ¹ã«ç«ã€ããšãé¡ã£ãŠããŸãã ããã¯Habréã«é¢ããç§ã®æåã®èšäºãªã®ã§ãèšäºãæ¹åããæ¹æ³ã«ã€ããŠå»ºèšçãªæ¹å€ãšã¢ããã€ã¹ãèãããã§ãã ãŸããã³ã¡ã³ãã®è³ªåã«ééããªãçããã§ããã°èšäºãè£è¶³ããŸãã
ãã®ãããã¯ã«èå³ãããå Žåã¯ãas3ãšãã€ãã£ãã³ãŒãéã®ããŸããŸãªããŒã¿ã®äº€æãã€ãã³ããªã©ã«ã€ããŠã話ããããšæããŸãïŒãã ãããããã¯æ¢ã«æ å ±ãèŠã€ããã®ãå°ãç°¡åãªäžè¬çãªæŠå¿µã§ããïŒã