Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flash 无法加载类或接口com.adobe.images.JPGEncoder_Flash_Jpeg_Flash Cs5 - Fatal编程技术网

Flash 无法加载类或接口com.adobe.images.JPGEncoder

Flash 无法加载类或接口com.adobe.images.JPGEncoder,flash,jpeg,flash-cs5,Flash,Jpeg,Flash Cs5,我完全是个新手。我刚刚安装了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

我完全是个新手。我刚刚安装了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 com.adobe.images.JPGEncoder could not be loaded
我从code.google.com的正确源代码下载了as3corelibrary,并将该文件夹放在根目录中。现在是C:\wamp\www\com\adobe\images\JPGEncoder.as


是否有一些类路径或我必须设置的内容?

是的,您需要设置类路径

发件人:

设置应用程序级源的步骤 路径:

选择编辑首选项Windows或Flash>首选项Macintosh和 单击ActionScript类别。 单击ActionScript 3.0设置按钮并将路径添加到 源路径列表。
看起来您已经将as3corelib的代码放在了web服务器的根目录中—您必须将源代码放在源路径的根文件夹中。通常情况下,该文件夹与FLA相同。将com文件夹复制到包含FLA的同一文件夹中,然后进行编译


如果您的FLA位于web服务器的根目录下的同一文件夹中,那么从一开始就不是一个好主意-每个人都可以访问您的源代码。

哦,是的,我确实将as3corelib放在了服务器的根目录中。FLA文件在别的地方。我会像你说的那样纠正自己。你是说添加C:\wamp\www\com\adobe\images\JPGEncoder.as还是只添加C:\wamp\www\com\adobe\images?你应该添加C:\wamp\www。com.adobe.images包告诉编译器在哪里查找类。