0

SELECT および CANCEL イベントは発生しません。コードの別の部分から問題が発生していないことを確認するために、新しいプロジェクトで実行しました。

FileReferenceList.Browsing Dialog でファイルを選択した後に [開く] をクリックすると、出力に [Event Fired] が表示されません。FileReference も試しましたが、うまくいきませんでした。他の要素の他のイベント (addedToStage、Click、touch など) が機能します。Air 14 と Flex 4.6.0 を搭載した FlashDevelop で Air AS3 プロジェクター プロジェクトを使用しています。

これは Main.as です:

public class Main extends Sprite 
{
    public function Main():void 
    {
        var asd:FileReferenceList = new FileReferenceList();
        asd.addEventListener(Event.SELECT, traceResult);
        asd.browse();

        trace("FileReferenceList is browsing...");
    }

    public function traceResult(e:Event):void
    {
        trace("Event Fired");
    }
}

アプリケーション.mxml :

<?xml version="1.0" encoding="utf-8" ?> 
<application xmlns="http://ns.adobe.com/air/application/14.0">

<id>FileReferenceListTest</id> 
<versionNumber>1.0</versionNumber> 
<filename>FileReferenceListTest</filename> 

<name>FileReferenceListTest</name> 
<description></description> 
<copyright></copyright> 

<initialWindow> 
    <title>FileReferenceListTest</title> 
    <content>FileReferenceListTest.swf</content> 
    <systemChrome>standard</systemChrome> 
    <transparent>false</transparent> 
    <visible>true</visible> 
    <minimizable>true</minimizable> 
    <maximizable>true</maximizable> 
    <resizable>true</resizable> 
</initialWindow> 

</application>

SetupSDK.bat で使用している SDK は次のとおりです: FlashDevelop\Apps\flexairsdk\4.6.0+14.0.0

機能のバージョンは次のとおりです: WIN 14,0,0,176 (このような別の質問で尋ねられるように)。私はフラッシュを初めて使用するので、回答にコンパイラの変更や見つけにくい (または確認できない) ものが含まれている場合は、その方法を正確に説明してください。御時間ありがとうございます :)。

4

2 に答える 2

0

actionScript® 3.0 Reference を注意深く読んだ後、私はこれを見ました:

注意: Adob​​e AIR では、FileReference クラスを拡張する File クラスは、FileReference クラスよりも多くの機能を提供し、セキュリティ制限が少なくなります。

したがって、ここに良いコードがあります:

public class Main extends Sprite 
{
    public function Main():void 
    {
        var f:File = new File();
        f.addEventListener("selectMultiple", traceResult);
        f.browseForOpenMultiple("Browse...");

        trace("FileReferenceList is browsing...");
    }

    public function traceResult(e:Event):void
    {
        trace("Event Fired");
    }
}
于 2014-08-18T17:18:21.603 に答える
0

上記のコードは機能しています。他のことを確認してください。別の問題があると思います

于 2014-08-18T12:34:36.787 に答える