我是一個總的Flash新手。我剛安裝了Flash CS5,並寫了下面的代碼:無法加載類或接口com.adobe.images.JPGEncoder
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 com.adobe.images.JPGEncoder could not be loaded
我已經下載從code.google權源as3corelibrary。 com並將該文件夾放在根目錄中。現在它是C:\ wamp \ www \ com \ adobe \ images \ JPGEncoder.as
是否有一些類路徑或我必須設置的東西?
哦,是的,我確實把as3corelib放在了我的服務器的根目錄下。 FLA文件在別的地方。如你所說,我會糾正自己。 – 2010-07-19 06:30:42