0

AIR ネイティブ拡張に問題があります。私の学士論文では、プレーヤーが Bluetooth 経由で通信するマルチプレーヤー ゲームをタブレットで作成する必要があります。ActionScript には Bluetooth API がないため、AIR Native Extension を使用する必要があります。

私のトピックに関していくつか質問があります。

  1. 拡張機能のネイティブ コードを C で実装する必要があるというのは本当ですか? Java ネイティブ コードは Android でのみ機能することを読みました。

  2. ネイティブ拡張には、ネイティブ コード、インターフェイスとして機能する ActionScript ライブラリが必要です。しかし、AIR Native Extension を作成するために Flex プロジェクトが必要な理由がわかりません。ゲームからネイティブ メソッドを呼び出したいだけです。誰かが私に説明してくれることを願っています。

助けてくれてありがとう。

4

2 に答える 2

2
  1. 個々のプラットフォームごとにネイティブ コードを記述する必要があります。そのため、Java (Android) と Objective-C (iOS) の両方でコードを記述する必要があります。拡張機能は、ネイティブ コードへの橋渡しにすぎません
  2. ネイティブ拡張を使用するために Flex は必要ありません。ネイティブ拡張は、拡張のネイティブ部分をネイティブ言語 (プラットフォームに応じて Java、Objective-C、または C++) で記述して、ActionScript で完全に記述する必要があります。

Adobe がこの件に関して提供しているリソースを参照してください。ANE は世界で最も文書化された機能ではありませんが、開始するために利用できるリソースはたくさんあります。さらに、Bluetooth のサポートを可能にする ANE が公開されています。私はそれらをテストしたことがないので、それらの有効性の質を保証することはできませんが、サードパーティのライブラリを使用できる場合は、一見する価値があるでしょう.

http://www.adobe.com/devnet/air/native-extensions-for-air.html http://help.adobe.com/en_US/air/extensions/air_extensions.pdf http://help.adobe. com/en_US/air/build/WS597e5dadb9cc1e0253f7d2fc1311b491071-8000.html http://www.adobe.com/devnet/air/articles/ane-android-devices.html http://www.adobe.com/devnet/air/記事/ building-ane-ios-android-pt1.html

于 2013-10-16T18:44:24.890 に答える
0

私たち MyFlashLab チームが作成したチュートリアルがあり、役に立つかもしれません。リンクはhttp://www.myflashlabs.com/build-multiplayer-games-in-adobe-air-using-bluetooth-ane/です。リスナーを初期化して Bluetooth ANE に追加するための重要なポイント。

var _ex:Bluetooth = new Bluetooth();

// dispatches the state of Bluetooth whenever it changes (you will know if it's on or off)
_ex.addEventListener(BluetoothEvent.BLUETOOTH_STATE , bluetoothState);

// dispatches the communication state of two devices
_ex.addEventListener(BluetoothEvent.COMMUNICATION_STATUS , communication);

// dispatches the connection state of two devices. Are the devices connected or not.
_ex.addEventListener(BluetoothEvent.CONNECTION , connection);

// dispatches the 'enable' and 'visibility' dialog states
_ex.addEventListener(BluetoothEvent.DIALOG_STATUS , dialog);

// dispatches the device discovering state
_ex.addEventListener(BluetoothEvent.DISCOVERING_STATUS , discovering);

// dispatches when new devices are discovered
_ex.addEventListener(BluetoothEvent.NEW_DISCOVERD , newDiscoverd);

// dispatches whenever a new String message is received from the other device
_ex.addEventListener(BluetoothEvent.READ_MESSAGE , readMessage);

// dispatches to notify you about the scan mode of the device
_ex.addEventListener(BluetoothEvent.SCAN_MODE , scanMode);

// dispatches when a String message is sent to the other device
_ex.addEventListener(BluetoothEvent.SEND_MESSAGE , sendMessage);

// check if Bluetooth hardware is on or off
if (_ex.isEnable)
{
    // make Bluetooth visible to others infinitely 
    // or set a duration which must be between 0 and 3600
    _ex.visible(0);

    // start the communication service for Bluetooth
    _ex.initCommunicationService();
}
else
{
    // if it's not on, just turn it on
    _ex.enable();
}

// listen to know when the Bluetooth is turning on
function bluetoothState(e:BluetoothEvent):void
{
    trace("state >> " + e.param);

    if (e.param == "bluetoothOn")
    {
        // as soon as it's on, make it visible and start the communication service
        _ex.visible(0);
        _ex.initCommunicationService();
    }
}
于 2015-12-07T05:17:29.750 に答える