Highlighted

MouseEvent.MOUSE_WHEEL to move object on stage issue

Participant ,
Nov 11, 2019

Copy link to clipboard

Copied

I'm using the MouseEvent.MOUSE_WHEEL event to shift the .y position of a MC on stage.  This is working BUT I'm getting an bright yellow box that outlines the MC when the mosue wheel is activated. 

 

Note:  I'm publishing as a projector and I've tried on both OSX and Windows - the same result.  

 

Can anyone advise as to why my MC is outlined in Yellow?

 

Thanks in advance for your help!

 

stop();

stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;

import flash.events.MouseEvent;

 

stage.addEventListener(MouseEvent.MOUSE_WHEEL, myMouseWheel);

 

function myMouseWheel(event:MouseEvent):void {

stage.focus = MovieClip(event.target);
if (box_mc.y >= -709 && box_mc.y < 97) 
{
box_mc.y -= event.delta;
}

else if (box_mc.y < 97) {
box_mc.y = 97;
}

else if (box_mc.y >= -709) 
{
box_mc.y = -709;
}

}

Adobe Community Professional
Correct answer by kglad | Adobe Community Professional

because you're setting focus on it.  if you don't want that, don't do that.

TOPICS
ActionScript

Views

45

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

MouseEvent.MOUSE_WHEEL to move object on stage issue

Participant ,
Nov 11, 2019

Copy link to clipboard

Copied

I'm using the MouseEvent.MOUSE_WHEEL event to shift the .y position of a MC on stage.  This is working BUT I'm getting an bright yellow box that outlines the MC when the mosue wheel is activated. 

 

Note:  I'm publishing as a projector and I've tried on both OSX and Windows - the same result.  

 

Can anyone advise as to why my MC is outlined in Yellow?

 

Thanks in advance for your help!

 

stop();

stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;

import flash.events.MouseEvent;

 

stage.addEventListener(MouseEvent.MOUSE_WHEEL, myMouseWheel);

 

function myMouseWheel(event:MouseEvent):void {

stage.focus = MovieClip(event.target);
if (box_mc.y >= -709 && box_mc.y < 97) 
{
box_mc.y -= event.delta;
}

else if (box_mc.y < 97) {
box_mc.y = 97;
}

else if (box_mc.y >= -709) 
{
box_mc.y = -709;
}

}

Adobe Community Professional
Correct answer by kglad | Adobe Community Professional

because you're setting focus on it.  if you don't want that, don't do that.

TOPICS
ActionScript

Views

46

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 11, 2019 0
Adobe Community Professional ,
Nov 11, 2019

Copy link to clipboard

Copied

because you're setting focus on it.  if you don't want that, don't do that.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 11, 2019 0
Participant ,
Nov 13, 2019

Copy link to clipboard

Copied

Great... thanks KGLAD.  I got that script from a tutorial and clearly didn't understand what  stage.focus was doing.  Thanks for the quick input!

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 13, 2019 0