Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- Node.js
- 스킨 스쿠버
- php
- C/C++
- 나의 취미
- ejb
- node.js web framework
- 명사 뽑아내기
- rss
- Eclipse
- 명사 분석기
- 주식이야기
- express for node.js
- 명사 추출기
- php thumbnail
- docker
- iBatis
- 메일왕창보내는법
- 책이야기
- ror실행
- 나의 프로젝트
- Cross
- 베트남어
- nodejs express
- flex3
- scala
- Lift
- ajax
- 도커
- 디즈니씨
Archives
- Today
- Total
nkdk의 세상
AS3.0의 EventDispatcher 본문
이벤트는 자바의 이벤트랑 동일하지만 쓰는 법을 아셔야 겠죠? 그런데 갑자기 팍 어려워 지네요.
CS3에서 3개의 인자로 혁신적으로 이벤트모델을 변경하였습니다.
- 이벤트 대상 객체
- EventDispatcher 객체
- Event 객체
EventDispatcher 클래스에 대해서
DisplayObject 를 포함한 많은 클래스가 이 클래스를 상속 받아 구현한다.
- component관련 EventDispathcer: RadioButtonGroup, DataProvider
- 비디오 관련 EventDispatcher: Camera, Microphone
- 통신 관련
FileReference, FileReferenceList, LocalConnection, NetConnection,NetStream, URLLoader, URLStream, XMLSocket, Socket, LoaderInfo
- 그 외 관련
Animator, ContextMenu, ContextMenuItem, DisplayObject, IME, Locale, PrintJob, SharedObject, Sound, SoundChannel, StyleSheet, Timer, Transition, TransitionManager, Tween
굉장히 많은 클래스가 상속 받고 있다.
자 예를 들어 보죠
/*
// 예제1)
import flash.events.MouseEvent;
stage.addEventListener(MouseEvent.CLICK,fnMouseClick);
trace(MouseEvent.CLICK);//click
function fnMouseClick(e:MouseEvent):void
{
trace(e);
}
/*
[MouseEvent type="click" bubbles=true cancelable=false eventPhase=2 localX=437 localY=173 stageX=437 stageY=173 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0]
*/
// 예제2)
import flash.events.MouseEvent;
stage.addEventListener(MouseEvent.CLICK,fnMouseClick1);
stage.addEventListener(MouseEvent.MOUSE_WHEEL,fnMouseClick2);
function fnMouseClick1(e:MouseEvent):void
{
//trace( e.formatToString( "type", "bubbles", "cancelable", "eventPhase"));
trace("fnMouseClick1"+e);
e.stopImmediatePropagation();
fnMouseClick2(e);
}
function fnMouseClick2(e:MouseEvent):void
{
trace("fnMouseClick2"+e);
}
다음과 같이 만들었습니다. 아마 자바를 하셨더라면
이해가 잘 되시리라 생각 되네요.
이벤트에서 나타낼 수 있는게 많으니까 출력된 걸 보시면 아마 아실 것입니다.
e.typename 이런식으로 하면 값을 얻을 수가 있습니다. 그럼 다음회에서 ^^
CS3에서 3개의 인자로 혁신적으로 이벤트모델을 변경하였습니다.
- 이벤트 대상 객체
- EventDispatcher 객체
- Event 객체
EventDispatcher 클래스에 대해서
DisplayObject 를 포함한 많은 클래스가 이 클래스를 상속 받아 구현한다.
- component관련 EventDispathcer: RadioButtonGroup, DataProvider
- 비디오 관련 EventDispatcher: Camera, Microphone
- 통신 관련
FileReference, FileReferenceList, LocalConnection, NetConnection,NetStream, URLLoader, URLStream, XMLSocket, Socket, LoaderInfo
- 그 외 관련
Animator, ContextMenu, ContextMenuItem, DisplayObject, IME, Locale, PrintJob, SharedObject, Sound, SoundChannel, StyleSheet, Timer, Transition, TransitionManager, Tween
굉장히 많은 클래스가 상속 받고 있다.
자 예를 들어 보죠
/*
// 예제1)
import flash.events.MouseEvent;
stage.addEventListener(MouseEvent.CLICK,fnMouseClick);
trace(MouseEvent.CLICK);//click
function fnMouseClick(e:MouseEvent):void
{
trace(e);
}
/*
[MouseEvent type="click" bubbles=true cancelable=false eventPhase=2 localX=437 localY=173 stageX=437 stageY=173 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0]
*/
// 예제2)
import flash.events.MouseEvent;
stage.addEventListener(MouseEvent.CLICK,fnMouseClick1);
stage.addEventListener(MouseEvent.MOUSE_WHEEL,fnMouseClick2);
function fnMouseClick1(e:MouseEvent):void
{
//trace( e.formatToString( "type", "bubbles", "cancelable", "eventPhase"));
trace("fnMouseClick1"+e);
e.stopImmediatePropagation();
fnMouseClick2(e);
}
function fnMouseClick2(e:MouseEvent):void
{
trace("fnMouseClick2"+e);
}
다음과 같이 만들었습니다. 아마 자바를 하셨더라면
이해가 잘 되시리라 생각 되네요.
이벤트에서 나타낼 수 있는게 많으니까 출력된 걸 보시면 아마 아실 것입니다.
e.typename 이런식으로 하면 값을 얻을 수가 있습니다. 그럼 다음회에서 ^^