Flex 용 swc 컴포넌트


Flash CS3 용 swc 컴포넌트


 - 샘플 -

사용방법 :

1) Flex 용 swc 컴퍼넌트
 - Flash 로만 작업하면 필요 없음
 - Project 우클릭 > Properties > ActionScript Build Path > Library path > Add SWC > 파일 선택
 - 사용 ㄱㄱ

2) Flash CS3 용 swc 컴퍼넌트
 - Flex 로만 작업하면 필요 없음
 - C:\Users\우야꼬\AppData\Local\Adobe\Flash CS3\en\Configuration\Components (사용자 계정. 예는 vista)
 - Flash CS3 용 swc 컴퍼넌트 복사
 - 플래시 창에서 Components 패널 reload.
 - Library 로 com_motion 컴퍼넌트를 추가한다.
 - 사용 ㄱㄱ

사용 예제

package AS
{
     import com.motion.*;
    
     import flash.display.Sprite;
     import flash.events.MouseEvent;
     import flash.text.*;

     public class CustomTextMotionSample extends Sprite
     {
          private var motion:CustomTextMotion;
         
          private var txt:TextField;
         
          public function CustomTextMotionSample()
          {
               this.createText();
              
               this.motion = new CustomTextMotion();
               this.motion.target = this.txt;
              
               this.stage.addEventListener(MouseEvent.CLICK, click);
          }
         
          private function click(e:MouseEvent):void
          {
               this.motion.start();
          }
         
          private function createText():void
          {
               this.txt = new TextField();
               this.txt.defaultTextFormat = new TextFormat("Tahoma", 10);
               this.txt.text = "com.motion.CustomTextMotion Sample";
               // Left
               this.txt.autoSize = TextFieldAutoSize.LEFT;
               this.txt.x = (this.stage.stageWidth - this.txt.width)/2;
               this.txt.y = (this.stage.stageHeight - this.txt.height)/2;
              
               this.addChild(this.txt);
          }
     }
}

추가 설정 예제

 - 모션 진행 방향
 - 랜덤 텍스트 캐릭터 세트 설정. (영문, 특수문자, 영문+특수문자, 한글(비츄))
 - 모션 시간 (ms)
 - 이벤트 (시작, 변할때마다, 끝)

package AS
{
     import com.motion.*;
    
     import flash.display.Sprite;
     import flash.events.MouseEvent;
     import flash.text.*;

     public class CustomTextMotionSample extends Sprite
     {
          private var motion:CustomTextMotion;
         
          private var txt:TextField;
         
          public function CustomTextMotionSample()
          {
               this.createText();
              
               this.motion = new CustomTextMotion();
               this.motion.target = this.txt;
              
               // CustomTextEvent : START, STOP, UPDATE
               this.motion.addEventListener(CustomTextEvent.START, onStart);
               this.motion.addEventListener(CustomTextEvent.STOP, onStop);
               this.motion.addEventListener(CustomTextEvent.UPDATE, onUpdate);
              
               // CustomTextSet : ENGLISH, ESCAPE, ENGLISH_ESCAPE, KOREAN(not recommand).
               this.motion.character = CustomTextSet.ENGLISH_ESCAPE;
              
               // CustomTextDirection : LEFT, RIGHT
               this.motion.direction = CustomTextDirection.RIGHT;
              
               // Delay (ms)
               this.motion.time = 5000;
              
               this.stage.addEventListener(MouseEvent.CLICK, click);
          }
         
          private function click(e:MouseEvent):void
          {
               this.motion.start();
          }
         
          private function onStart(e:CustomTextEvent):void
          {
               trace("start");
          }
         
          private function onStop(e:CustomTextEvent):void
          {
               trace("stop");
          }
         
          private function onUpdate(e:CustomTextEvent):void
          {
               trace("update");
          }
         
          private function createText():void
          {
               this.txt = new TextField();
               this.txt.defaultTextFormat = new TextFormat("Tahoma", 10);
               this.txt.text = "com.motion.CustomTextMotion Sample";
               // Right
               this.txt.autoSize = TextFieldAutoSize.RIGHT;
               this.txt.x = (this.stage.stageWidth - this.txt.width)/2;
               this.txt.y = (this.stage.stageHeight - this.txt.height)/2;
              
               this.addChild(this.txt);
          }
     }
}

+ Recent posts