2012-12-13 1 views
1

내 응용 프로그램에는 마우스에 연결된 마우스 커서가 있습니다. 그러나 그것은 나를 위해 큰 문제가 내 응용 프로그램 내에서 버튼을 클릭하게 내버려 두지 않아야 할 일은 버튼이 필수적입니다.AS3 - 버튼을 클릭하기 위해 마우스 커서를 얻는 방법?

나는 AS가 처음이므로 도움을 많이 주시면 감사하겠습니다!

stage.addEventListener(MouseEvent.MOUSE_MOVE, draw_cursor); 
stage.addEventListener(Event.MOUSE_LEAVE, hide_cursor); 

Mouse.hide(); 

function draw_cursor(event:MouseEvent):void 
{ 
    my_cursor_mc.visible = true; 
    my_cursor_mc.x = event.stageX; 
    my_cursor_mc.y = event.stageY; 
} 


function hide_cursor(event:Event):void 
{ 
    my_cursor_mc.visible=false; 
} 

난이 (아래)를 사용하여 시도했지만 매우 glichy이었다 커서 내가 (정말 이상하지) 버튼을 클릭 할 수 있었다 THEN 멀리 갈 위해 버튼을 눌러야했다 :

stage.addEventListener(MouseEvent.CLICK, hide_cursor); 
+0

지원 플래시 플레이어 10.2에서 추가되었다. 다음 사이트에서 해당 정보를 얻을 수 있습니다. http://www.adobe.com/devnet/flashplayer/articles/native-mouse-cursors.html –

+0

공유 기능 덕분에 탁월한 링크입니다. Adam이 제안한대로 기본 마우스 커서를 사용하는 것이 좋습니다. – ToddBFisher

+0

actionscript 3 이벤트의 [맞춤 커서]가 중복 될 수 있습니다. (https://stackoverflow.com/questions/2528709/custom-cursor-in-actionscript-3-event-doesnt-work) –

답변

3

을 커서가 마우스 이벤트를 훔치는 것처럼 들릴 수 있습니다. 최상위 레벨 코드 (또는 생성자)에 추가하려고 :

// Disable mouse events for cursor  
my_cursor_mc.mouseEnabled = false; 

당신이 만약 마우스 이벤트는 자식도 추가 객체가 있습니다 적절한 사용자 정의 기본 마우스 커서에 대한

// Disable mouse events for any children of the cursor 
my_cursor_mc.mouseChildren = false; 
+0

완벽하게 작동했습니다. 고마워! –

관련 문제