캠핑과 개발


1. 현재 설치된 flash player 버전 확인하기
(http://www.adobe.com/software/flash/about/)


2. 플래시 플레이어 삭제 프로그램 다운

http://download.macromedia.com/pub/flashplayer/current/uninstall_flash_player.exe


3. flash 설치

9버전

http://download.macromedia.com/pub/flashplayer/updaters/9/flashplayer_9_ax_debug.exe 

※ 설치 에러시 레지스트리 삭제

HKEY_LOCAL_MACHINE\SOFTWARE\Macromedia\FlashPlayer\SafeVersions
(안에 버전별 내용 모두 삭제)

// 무비클립을 탄력적으로 움직이게 하는 메서드

// a는 -2부터 2사이의 실수 (-2<a<2)

// b는 -1부터 0사이의 실수(-1<b<0)

// a*a+4b는 -4부터 0사이의 실수(-4<a*a+4b<0)

// b가 -1에 가까울수록 진동폭이 큼

// a가 -2에 가까울수록(작을수록) 속도가 빠름

// tx와 ty는 이동할 최종 위치


MovieClip.prototype.elasticMove = function(a, b, tx, ty){

     var tempx = this._x;

     var tempy = this._y;

     this._x = a*(this._x - tx) + b*(this.prevx - tx) + tx;

     this._y = a*(this._y - ty) + b*(this.prevy - ty) + ty;

     this.prevx = tempx;

     this.prevy = tempy;

};


[출처] http://blog.naver.com/sync6324/110033835026

// 부드러운 움직임

MovieClip.prototype.smoothMove = function(speed, targetx, targety){

    this._x += speed*(targetx - this._x);

    this._y += speed*(targety - this._y);

};



_root.무비클립인스턴스.smoothMove(0.2, _xmouse, _ymouse);


[출처] http://blog.naver.com/sync6324/110033835026

'DEVELOPMENT > IOS' 카테고리의 다른 글

아이폰 OS 개발 자료 총정리  (0) 2012.05.17
iPhone용 Open Source 모음  (0) 2012.05.17

// (x1, y1)에서 (x2, y2)까지의 거리를 구해서 정수값을 반환하는 함수

function distance(x1, y1, x2, y2) {

    var diffX = x2-x1;

    var diffY = y2-y1;

    var r = Math.sqrt(diffX*diffX+diffY*diffY);

    return r;

}


[출처] http://blog.naver.com/sync6324/110033835026

// 무비클립을 (targetx, targety)로 회전시키는 함수

MovieClip.prototype.rotateTo = function(targetx, targety){

    var diffX = targetx - this._x;

    var diffY = targety - this._y;

    this._rotation = Math.atan2(diffY, diffX)*180/Math.PI;

};


_root.무비클립인스턴스.rotateTo(this._xmouse, this._ymouse);



[출처] http://blog.naver.com/sync6324/110033835026

기본적으로 Bitmap 인스턴스는, 참조하고 있는 BitmapData 객체에 setPixcel32()나 setPixel()이 호출되는 상황을 알아챈다.
비트맵의 모든 픽셀의 색상을 바꾸게 될 경우 setPixcel32()나 setPixcel()이 한프레임에서 자주 호출될때는 퍼포먼스가 떨어지게 되는데 이런경우 퍼포먼스 향상을 위해 lock()을 사용한다.

lock()을 호출하게 되면 AS는 Bitmap 객체가 setPixel32()나 setPixcel()의 실행을 알 수 없게 강제로 막는다.
그래서 연속된 setPixcel()이 호출되는 경우는 lock()을 호출하는 편이 좋다. 호출된 후 변경하려던 모든 픽셀이 변경이 완료된 경우는 unlock()을 호출해주면 Bitmap 객체가 모든 알림을 받을 수 있게 된다. 


var bitmapData:BitmapData = new BitmapData(1024, 1024, false);
var bmp:Bitmap = new Bitmap(bitmapData);
 
//퍼포먼스 향샹을 위해 lock을 걸어준다.
bitmapData.lock();    
    
for(var i:uint = 0; i < bitmapData.height; i++){
    for(var j:uint = 0; j < imgData.width; j++){
        bitmapData.setPixel(j, i, Math.floor(Math.random()*0xffffffff));
    }
}

bitmapData.unlock(); //lock 해제
 
container.addChild(bmp);


 공통디렉터리 설명  속성 
 사용자 홈 사용자 계정의 루트 디렉터리  File.userDirectory
 사용자 문서 디렉터리 사용자 홈 디렉터리에 위치하는 문서 디렉터리  File.documentsDirectory
 애플리케이션 스토리지 디렉터리 설치되는 어플리케이션별로 생성되는 고유 스토리지 디렉터리  File.applicationStorageDirectory
 애플리케이션 디렉터리 애플리케이션이 설치된 디렉터리   File.applicationDirectory
 바탕화면 사용자의 바탕화면 디렉터리   File.desktopDirectory


사용자 바탕화면 디렉터리 읽어오기
var listing:Array = File.desktopDirectory.getDirectoryListing();

애플리케이션 디렉터리 참조하기
var applicationDirectory:File = new File("app:/");
var applicationDirectory:File = File.applicationDirectory();

예제)

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
 layout="absolute"
 creationComplete="creationCompleteHandler()">
 <mx:Script>
  <![CDATA[
   import mx.controls.Alert;
   private function creationCompleteHandler():void{
    print(File.userDirectory.nativePath);
    print(File.documentsDirectory.nativePath);
    print(File.desktopDirectory.nativePath);
    print(File.applicationDirectory.nativePath);
    print(File.applicationStorageDirectory.nativePath);
    print(File.documentsDirectory.resolvePath("Downloads").nativePath);
    print(File.documentsDirectory.resolvePath("Downloads/test").nativePath);
    print(File.documentsDirectory.resolvePath("..").nativePath);
    print(File.userDirectory.getRelativePath(File.documentsDirectory));
   }
   
   private function print(string:String):void{
    output.text += ">" + string + "\n";
   }   
  ]]>
 </mx:Script>
 <mx:TextArea id="output" width="100%" height="100%" />
</mx:WindowedApplication>

참고 
http://help.adobe.com/en_US/AIR/1.5/devappsflex/WS53995f63097985ed-7aaf5f2511d5bbfba82-8000f.html
http://livedocs.adobe.com/apollo/1.0/aslr/