0

私は完全なFlash初心者です。Flash CS5をインストールして、このコードを実行しました。

import flash.display.BitmapData
import flash.geom.Matrix
import com.adobe.images.JPGEncoder;
import flash.net.FileReference;
import flash.utils.ByteArray;

//get the default camera
//change your Default camera using the Flash Player Settings.
cam=Camera.get()
//this event is called whenever permission to access the local camera, is accepted or denied by the user
cam.onStatus=function(e)
{
    //if we are given permission
    if(e.code == "Camera.Unmuted")
    {
        //start the application
        initialize()
    }
    else
    {
        System.showSettings(3)
    }
}

var snapshot:BitmapData=new BitmapData(cam.width,cam.height);

function takeSnapshot()
{   
    var i:Number=1;
    var fileRef:FileReference = new FileReference();
    snapshot.draw(cam,new Matrix());
    //saveImage();
     var encoder:JPGEncoder = new JPGEncoder();
     var ba:ByteArray = encoder.encode(bitmapData);
     fileRef.save(ba,"capture"+i+".jpg");
     i++;
}


//if there are no Cameras
if(cam == null)
{
    System.showSettings(3)
}
else
{
    cam.setMode(1024, 768, 30);
    cam.setQuality(10000,0);
    output.attachVideo(cam);
    setInterval(this,"takeSnapshot",100);
}

次に、SWFにエクスポートすると、次のエラーが発生します。The class or interface 'flash.utils.ByteArray' could not be loaded.

ここで何か助けはありますか?

変更する必要のあるAS3設定はありますか?

4

1 に答える 1

0

AS3を使用してエクスポートしていないようです。エクスポートする場合は、言語として「Actionscript3」を選択してください。CS3を使用して試してみましたが(CS5がこの点で何かを変えたとは思えません)、すべてが正常に機能しました。

プロジェクトをAS3(CS3の場合)に変更するには:[ファイル]>[公開設定...]に移動します>[フラッシュ]タブをクリックします>[ActionScriptバージョン]を[Actionscript3.0]に変更します。

于 2010-07-17T15:56:55.153 に答える