2010-07-19 4 views
0

전 초보자입니다. 난 그냥 플래시 CS5를 설치 한 다음 코드 작성 : SWF로 내보내기, 나는 오류가 점점 오전에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); 
} 

을 :

The class or interface com.adobe.images.JPGEncoder could not be loaded 

나는 code.google에서 올바른 소스에서 as3corelibrary을 다운로드 한. co.kr 및 루트에 폴더를 배치했습니다. 지금은 C : \ wamp \ www \ com \ adobe \ images \ JPGEncoder.as입니다.

설정해야 할 클래스 경로가 있습니까?

답변

0

은 같은데 - 당신이 당신의 소스 경로의 루트 폴더에 소스를 넣어했습니다. 일반적으로 FLA가있는 폴더와 같습니다. com 폴더를 FLA가 들어있는 폴더에 복사 한 다음 컴파일하십시오.

동일한 폴더 (웹 서버의 루트)에 FLA를 가지고있는 경우 처음에는 좋지 않습니다. 모든 사람이 소스 코드에 액세스 할 수 있습니다.

+0

오오 그렇습니다. 서버의 루트에 as3corelib을 넣었습니다. 그리고 FLA 파일은 다른 곳에 있습니다. 나는 네가 말한대로 나 자신을 바로 잡을 것이다. –

0

예 클래스 경로를 설정해야합니다. Adobe help에서

:

  1. 은 액션 범주를 클릭 편집 환경 설정 (Windows) 또는 Flash> 환경 설정 (Macintosh)을 선택하고 를 선택

    응용 프로그램 수준의 소스 경로를 설정합니다.

  2. ActionScript 3.0 설정 버튼을 클릭하고 소스 경로 목록 에 경로를 추가하십시오. 당신은 웹 서버의 루트에 as3corelib에 대한 코드를 넣어 것 같은
+0

"C : \ Wamp \ www \ com \ adobe \ images \ JPGEncoder.as"또는 "C : \ Wamp \ www \ com \ adobe \ images"만 추가 하시겠습니까? –

+0

'C : \ wamp \ www'를 추가해야합니다. 'com.adobe.images' 패키지는 컴파일러에게 클래스를 찾을 곳을 알려줍니다. –