This page was saved using jaction on 2006-09-04 8:33:34.
Address: http://flexdocs.kr/docs/flex2/langref/flash/events/ContextMenuEvent.html
Title: flash.events.ContextMenuEvent (Flex™ 2 레퍼런스 가이드)  •  Size: 60160
Packageflash.events
Classpublic class ContextMenuEvent
InheritanceContextMenuEvent Inheritance Event Inheritance Object

유저가 context menu를 생성 또는 사용하면, Flash® Player 에 의해 ContextMenuEvent object가 dispatch됩니다. 유저는, 유저의 pointing device (통상은 마우스 또는 트랙볼) 가 작은 버튼을 클릭하는 것으로써, context menu를 생성합니다. 다음의 2 종류의 ContextMenuEvent object가 있습니다.

View the examples

See also

ContextMenu class
ContextMenuItem class


Public property
 property정의
 Inheritedbubbles : Boolean
이벤트가 바브 링 이벤트인 가 어떤가를 나타냅니다.
Event
 Inheritedcancelable : Boolean
이벤트에 관련지을 수 있었던 행동을 회피할 수 있을지 어떨지를 나타냅니다.
Event
 Inheritedconstructor : Object
특정의 object 인스턴스의 클래스 object 또는 constructor    함수에의 참조입니다.
Object
  contextMenuOwner : InteractiveObject
메뉴를 관련지을 수 있는 표시 리스트 object입니다.
ContextMenuEvent
 InheritedcurrentTarget : Object
event listener로 Event object를 액티브하게 처리하고 있는 object입니다.
Event
 InheritedeventPhase : uint
event 플로우(flow)의 현재의 단계입니다.
Event
  mouseTarget : InteractiveObject
유저가 context menu를 표시하기 위해서 오른쪽 클릭한 표시 리스트 object입니다.
ContextMenuEvent
 Inheritedprototype : Object
[static] 클래스 또는 함수 object의 prototype object에의 참조입니다.
Object
 Inheritedtarget : Object
event 타겟입니다.
Event
 Inheritedtype : String
이벤트의 형태입니다.
Event
Public Methods
 Methods정의
  ContextMenuEvent (type:String , bubbles:Boolean = false, cancelable:Boolean = false, mouseTarget:InteractiveObject = null, contextMenuOwner:InteractiveObject = null)
메뉴 이벤트에 관한 특정의 정보를 포함한 Event object를 작성합니다.
ContextMenuEvent
  clone ():Event
ContextMenuEvent object의 복사를 작성해, 각 property의 값을 원의 property의 값과 일치하도록(듯이) 설정합니다.
ContextMenuEvent
 InheritedformatToString (className:String , ... arguments):String
custom Event 클래스에 toString() Methods를 Implements하기 위한 유틸리티 함수입니다.
Event
 InheritedhasOwnProperty (name:String ):Boolean
object로 지정된 property가 정의되고 있는지 어떤지를 나타냅니다.
Object
 InheritedisDefaultPrevented ():Boolean
이벤트로 preventDefault() 가 불려 갔는지 어떠했는지를 체크합니다.
Event
 InheritedisPrototypeOf (theClass:Object ):Boolean
Object 클래스의 인스턴스가, Parameters로서 지정된 object의 prototype 체인내에 있을지 어떨지를 나타냅니다.
Object
 InheritedpreventDefault ():void
이벤트의 디폴트 행동을 캔슬할 수 있는 경우에, 그 행동을 캔슬합니다.
Event
 InheritedpropertyIsEnumerable (name:String ):Boolean
지정된 property가 존재해, 열거 가능한가 어떤가를 나타냅니다.
Object
 InheritedsetPropertyIsEnumerable (name:String , isEnum:Boolean = true):void
루프 처리에 대한 다이나믹 property의 가용성을 설정합니다.
Object
 InheritedstopImmediatePropagation ():void
event 플로우(flow)의 현재의 노드 및 후속 하는 노드로, event listener가 처리되지 않게 합니다.
Event
 InheritedstopPropagation ():void
event 플로우(flow)의 현재의 노드에 후속 하는 노드로, event listener가 처리되지 않게 합니다.
Event
  toString ():String
ContextMenuEvent object의 모든 property를 포함한 string를 돌려줍니다.
ContextMenuEvent
 InheritedvalueOf ():Object
지정된 object의 원시적치를 돌려줍니다.
Object
Public 정수
 정수정의
 InheritedACTIVATE : String = "activate"
[static] activate event object의 type property의 값을 정의합니다.
Event
 InheritedADDED : String = "added"
[static] added event object의 type property의 값을 정의합니다.
Event
 InheritedCANCEL : String = "cancel"
[static] cancelevent object의 type property의 값을 정의합니다.
Event
 InheritedCHANGE : String = "change"
[static] change event object의 type property의 값을 정의합니다.
Event
 InheritedCLOSE : String = "close"
[static] close event object의 type property의 값을 정의합니다.
Event
 InheritedCOMPLETE : String = "complete"
[static] complete event object의 type property의 값을 정의합니다.
Event
 InheritedCONNECT : String = "connect"
[static] connect event object의 type property의 값을 정의합니다.
Event
 InheritedDEACTIVATE : String = "deactivate"
[static] deactivate event object의 type property의 값을 정의합니다.
Event
 InheritedENTER_FRAME : String = "enterFrame"
[static] enterFrame event object의 type property의 값을 정의합니다.
Event
 InheritedID3 : String = "id3"
[static] id3 event object의 type property의 값을 정의합니다.
Event
 InheritedINIT : String = "init"
[static] init event object의 type property의 값을 정의합니다.
Event
  MENU_ITEM_SELECT : String = "menuItemSelect"
[static] menuItemSelect event object의 type property의 값을 정의합니다.
ContextMenuEvent
  MENU_SELECT : String = "menuSelect"
[static] menuSelect event object의 type property의 값을 정의합니다.
ContextMenuEvent
 InheritedMOUSE_LEAVE : String = "mouseLeave"
[static] mouseLeave event object의 type property의 값을 정의합니다.
Event
 InheritedOPEN : String = "open"
[static] open event object의 type property의 값을 정의합니다.
Event
 InheritedREMOVED : String = "removed"
[static] removed event object의 type property의 값을 정의합니다.
Event
 InheritedRENDER : String = "render"
[static] render event object의 type property의 값을 정의합니다.
Event
 InheritedRESIZE : String = "resize"
[static] resize event object의 type property의 값을 정의합니다.
Event
 InheritedSCROLL : String = "scroll"
[static] scroll event object의 type property의 값을 정의합니다.
Event
 InheritedSELECT : String = "select"
[static] select event object의 type property의 값을 정의합니다.
Event
 InheritedSOUND_COMPLETE : String = "soundComplete"
[static] soundComplete event object의 type property의 값을 정의합니다.
Event
 InheritedTAB_CHILDREN_CHANGE : String = "tabChildrenChange"
[static] tabChildrenChange event object의 type property의 값을 정의합니다.
Event
 InheritedTAB_ENABLED_CHANGE : String = "tabEnabledChange"
[static] tabEnabledChange event object의 type property의 값을 정의합니다.
Event
 InheritedTAB_INDEX_CHANGE : String = "tabIndexChange"
[static] tabIndexChange event object의 type property의 값을 정의합니다.
Event
 InheritedUNLOAD : String = "unload"
[static] unload event object의 type property의 값을 정의합니다.
Event
property의 상세
contextMenuOwnerproperty
contextMenuOwner:InteractiveObject   [read-write]

메뉴를 관련지을 수 있는 표시 리스트 object입니다. 이것은, 마우스 타겟 (mouseTarget), 또는 표시 리스트의 조상의 어느 쪽인가에 됩니다.

Implements
    public function get contextMenuOwner():InteractiveObject
    public function set contextMenuOwner(value:InteractiveObject ):void
mouseTargetproperty 
mouseTarget:InteractiveObject   [read-write]

유저가 context menu를 표시하기 위해서 오른쪽 클릭한 표시 리스트 object입니다. 이것은, 메뉴를 관련지을 수 있고 있는 표시 리스트 object (contextMenuOwner), 또는 그 표시 리스트의 자손의 어느 쪽인가에 됩니다.

Implements
    public function get mouseTarget():InteractiveObject
    public function set mouseTarget(value:InteractiveObject ):void
constructor    의 상세
ContextMenuEvent()constructor   
public 함수 ContextMenuEvent(type:String , bubbles:Boolean = false, cancelable:Boolean = false, mouseTarget:InteractiveObject = null, contextMenuOwner:InteractiveObject = null)

메뉴 이벤트에 관한 특정의 정보를 포함한 Event object를 작성합니다. event listener에게는 Event object가 Parameters로서 건네받습니다.

Parameters
type:String — 이벤트의 타입입니다. 유효한 값은 다음과 같습니다.
  • ContextMenuEvent.MENU_ITEM_SELECT
  • ContextMenuEvent.MENU_SELECT
 
bubbles:Boolean (default = false) — Event object가 event 플로우(flow)의 바브 링 단계에서 처리될지 어떨지를 판단합니다. event listener는, Inheritance된 bubbles property를 통해서 이 정보에 액세스 할 수 있습니다.
 
cancelable:Boolean (default = false) — Event object가 캔슬 가능한가 어떤가를 판단합니다. event listener는, Inheritance된 cancelable property를 통해서 이 정보에 액세스 할 수 있습니다.
 
mouseTarget:InteractiveObject (default = null) — 유저가 context menu를 표시하기 위해서 오른쪽 클릭한 표시 리스트 object입니다. 이것은,contextMenuOwner 또는, 그 표시 리스트의 자손의 어느 쪽인가에 됩니다.
 
contextMenuOwner:InteractiveObject (default = null) — 메뉴를 관련지을 수 있는 표시 리스트 object입니다. 이것은,mouseTarget 또는, 그 표시 리스트의 조상의 어느 쪽인가에 됩니다.

See also

Methods의 상세
clone()Methods
public override function clone():Event

ContextMenuEvent object의 복사를 작성해, 각 property의 값을 원의 property의 값과 일치하도록(듯이) 설정합니다.

반환값
Event — 원의 object와 같은 property치를 포함한 새로운 ContextMenuEvent object입니다.
toString()Methods 
public override function toString():String

ContextMenuEvent object의 모든 property를 포함한 string를 돌려줍니다. string는 다음의 형식입니다.

[ContextMenuEvent type=value bubbles=value cancelable=value ... contextMenuOwner=value]

반환값
String — ContextMenuEvent object의 모든 property를 포함한 string입니다.
정수의 상세
MENU_ITEM_SELECT정수
public static const MENU_ITEM_SELECT:String = "menuItemSelect"

menuItemSelect event object의 type property의 값을 정의합니다.

이 이벤트에는, 다음의 property가 있습니다.

PropertyValue
bubblesfalse
cancelablefalse 는, 캔슬하는 디폴트의 동작이 없는 것을 나타냅니다.
contextMenuOwner메뉴를 관련지을 수 있는 표시 리스트 object입니다.
currentTargetevent listener로 Event object를 액티브하게 처리하고 있는 object입니다.
mouseTarget유저가 context menu를 표시하기 위해서 오른쪽 클릭한 표시 리스트 object입니다.
target선택된 ContextMenuItem object입니다. target 는, 반드시 event listener를 등록한 표시 리스트내의 object라고는 할 수 없습니다. 현재 이벤트를 처리하고 있는 표시 리스트내의 object에 액세스 하려면 ,currentTarget property를 사용합니다.

See also

MENU_SELECT정수 
public static const MENU_SELECT:String = "menuSelect"

menuSelect event object의 type property의 값을 정의합니다.

이 이벤트에는, 다음의 property가 있습니다.

PropertyValue
bubblesfalse
cancelablefalse 는, 캔슬하는 디폴트의 동작이 없는 것을 나타냅니다.
contextMenuOwner메뉴를 관련지을 수 있는 표시 리스트 object입니다.
currentTargetevent listener로 Event object를 액티브하게 처리하고 있는 object입니다.
mouseTarget유저가 context menu를 표시하기 위해서 오른쪽 클릭한 표시 리스트 object입니다.
target표시되는 ContextMenu object입니다. target 는, 반드시 event listener를 등록한 표시 리스트내의 object라고는 할 수 없습니다. 현재 이벤트를 처리하고 있는 표시 리스트내의 object에 액세스 하려면 ,currentTarget property를 사용합니다.

See also

Examples

다음의 예에서는,ContextMenuEventExample 클래스 (을)를 사용해, 디폴트의 context menu 아이템을 스테이지로부터 삭제해, 스테이지상의 사각형의 색을 변경한다 새로운 메뉴 아이템을 추가합니다. 이 예에서는, 다음의 처리를 실행합니다.
  1. myContextMenu property가 선언되어 새로운 ContextMenu object에 할당할 수 있어 Sprite 형의 redRectangle property가 선언됩니다.
  2. removeDefaultItems() Methods가 불려 갑니다. 이 Methods에 의해, 모든 빌트인 문맥 메뉴 아이템이 삭제됩니다. 다만, 프린트를 제외합니다.
  3. addCustomMenuItems() Methods가 불려 갑니다. 이 Methods에 의해, Reverse Colors 메뉴 아이템이 defaultItems 배열에 배치됩니다. 배열의 push() Methods가 사용됩니다. menuItemSelect event listener가 ContextMenuItem object에 추가되어 관련지을 수 있는 Methods는 menuItemSelectHandler() 라는 이름입니다. 이 Methods는, 유저가 context menu로부터[색의 반전]을 선택했을 때에 항상 trace() 명령문(statement)를 출력합니다. 또, 붉은 사각형은 흑으로 바뀌어, 흑의 텍스트는 빨강으로 바뀝니다.
  4. constructor    에 돌아와,menuSelect event listener가 추가됩니다. 그것과 함께, 관련하는 Methods menuSelectHandler() 도 추가됩니다. 이 Methods는, context menu의 아이템이 선택될 때마다, 3 개의 trace() 명령문(statement)를 출력합니다.
  5. constructor    은 addChildren() 를 호출합니다. 이것은, 적색의 사각형을 묘화 해, 그것을 표시 리스트에 추가합니다. 이 사각형은, 표시 리스트에 즉석에서 표시됩니다.
  6. 마지막으로,myContextMenuredRectangle property의 context menu에 할당할 수 있습니다. 이 때문에, custom context menu가 표시되는 것은, 마우스 포인터가 사각형 위에 있는 경우만입니다.
package {
    import flash.ui.ContextMenu;
    import flash.ui.ContextMenuItem;
    import flash.ui.ContextMenuBuiltInItems;
    import flash.events.ContextMenuEvent;
    import flash.display.Sprite;
    import flash.display.Shape;
    import flash.text.TextField;

    public class ContextMenuEventExample extends Sprite {
        private var myContextMenu:ContextMenu;
        private var menuLabel:String = "Reverse Colors";
        private var textLabel:String = "Right Click";
        private var redRectangle:Sprite;
        private var label:TextField;
        private var size:uint = 100;
        private var black:uint = 0x000000;
        private var red:uint = 0xFF0000;

        public function ContextMenuEventExample() {
            myContextMenu = new ContextMenu();
            removeDefaultItems();
            addCustomMenuItems();
            myContextMenu.addEventListener(ContextMenuEvent.MENU_SELECT, menuSelectHandler);

            addChildren();
            redRectangle.contextMenu = myContextMenu;
        }

        private function addChildren() :void {
            redRectangle = new Sprite();
            redRectangle.graphics.beginFill(red);
            redRectangle.graphics.drawRect(0, 0, size, size);
            addChild(redRectangle);
            redRectangle.x = size;
            redRectangle.y = size;
            label = createLabel();
            redRectangle.addChild(label);
        }

        private function removeDefaultItems() :void {
            myContextMenu.hideBuiltInItems();
            var defaultItems:ContextMenuBuiltInItems = myContextMenu.builtInItems;
            defaultItems.print = true;
        }

        private function addCustomMenuItems() :void {
            var item:ContextMenuItem = new ContextMenuItem(menuLabel);
            myContextMenu.customItems.push(item);
            item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler);
        }

        private function menuSelectHandler(event:ContextMenuEvent) :void {
            trace("menuSelectHandler: " + event);
        }

        private function menuItemSelectHandler(event:ContextMenuEvent) :void {
            trace("menuItemSelectHandler: " + event);
            var textColor:uint = (label.textColor == black) ?  red : black;
            var bgColor:uint = (label.textColor == black) ?  black : red;
            redRectangle.graphics.clear();
            redRectangle.graphics.beginFill(bgColor);
            redRectangle.graphics.drawRect(0, 0, size, size);
            label.textColor = textColor;
        }

        private function createLabel() :TextField {
            var txtField:TextField = new TextField();
            txtField.text = textLabel;
            return txtField;
        }
    }
}






 

코멘트가 추가되었을 경우, 메일로 받기. | 코멘트 리포트

현재의 페이지: http://flexdocs.kr/docs/flex2/langref/flash/events/ContextMenuEvent.html