본문 바로가기

Event

TransitionManager의 Transition의 finish 이벤트 처리하기 AS3 에서는 TransitionManager의 finish 이벤트가 없기 때문에 AS2 에서 제공하는 allTransitionsInDone, allTransitionsOutDone 이벤트를 응용한다. private var barTransitionManager:TransitionManager; ... barTransitionManager = new TransitionManager(this); barTransitionManager.addEventListener("allTransitionsInDone", nextTransition); ... public function nextTransition(e:Event):void { .. transition 종료시 여기로 들어온다. } http://www.flasha.. 더보기
Tween 클래스를 사용하여 객체에 애니메이션을 적용 새 ActionScript 3.0 파일을 만들고 tweenWithEvent.fla로 저장합니다. 레이어 1을 선택하고 레이어 이름을 'assets'로 변경합니다. 레이어에서 임의의 모양을 그리고 이 모양을 심볼로 변환합니다(F8). 무비 클립을 유형으로 선택하고 확인을 클릭합니다. 인스턴스 이름을 img1_mc로 지정합니다. 새 레이어를 추가하고 레이어 이름을 'actions'로 지정합니다. actions 레이어의 프레임 1을 선택한 상태에서 액션 패널을 열고 다음 코드를 스크립트 윈도우에 입력합니다. 레이이를 추가한 것은 리소스와 소스의 분리차원 인 듯 하다... (아마도) import fl.transitions.*; import fl.transitions.easing.*; function finish.. 더보기
사용자 정의 이벤트 만들어보기 // 예제 소스에서 잠시. 이렇게 Event 를 상속받는 클래스를 만든다. // 이 클래스가 사용자 정의 이벤트를 구현한다. package com.example.programmingas3.clock { import flash.events.Event; /** * This custom Event class adds a message property to a basic Event. */ public class AlarmEvent extends Event { /** * The name of the new AlarmEvent type. */ public static const ALARM:String = "alarm"; /** * A text message that can be passed to an event h.. 더보기
이벤트 강제로 발생시키기 이벤트 강제 발생 : 쉽다.. dispatchEvent 함수를 사용한다... myButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK)); ==> myButton 을 클릭하는 것과 동일하다.. PostMessage .. ///////////////////////////////////////////// * function eventTest(e:Event):void { ... } 여기서 e.target 은 이벤트를 일으킨 객체가 되고 e.currentTarget 은 이벤트를 받는 객체가 된다. 더보기