Copy link to clipboard
Copied
Hello. I transform a as2 game to as3. transform all the code and the game start but dont detect any MouseEvent associated to a MovieClip. In stage yes but not in any MovieClip. This is one example of my code...
wheelmain.wheel.addEventListener(MouseEvent.MOUSE_DOWN, onWheelDown);
wheelmain.wheel.addEventListener(MouseEvent.MOUSE_UP, onWheelUp);
wheelmain.wheel.addEventListener(MouseEvent.ROLL_OUT, onWheelRollOut);
wheelmain.wheel.addEventListener(MouseEvent.CLICK, onWheelReleaseOutside);
function onWheelDown(e:MouseEvent)
{
trace("Boton del raton pulsado.");
//sndPotencia.start();
potenciaRuletaOn();
}
wheelmain.wheel exists and is a MovieClip. The movie dont show nothing to console.
Anybody help me?.
thanks!.
Copy link to clipboard
Copied
what's in the output panel when you use:
wheelmain.wheel.addEventListener(MouseEvent.MOUSE_DOWN, onWheelDown);
wheelmain.wheel.addEventListener(MouseEvent.MOUSE_UP, onWheelUp);
wheelmain.wheel.addEventListener(MouseEvent.ROLL_OUT, onWheelRollOut);
wheelmain.wheel.addEventListener(MouseEvent.CLICK, onWheelReleaseOutside);
trace(wheelmain.wheel.stage,wheelmain.wheel.x,wheelmain.wheel.y,wheelmain.wheel.mouseEnabled)
function onWheelDown(e:MouseEvent)
{
trace("Boton del raton pulsado.");
//sndPotencia.start();
potenciaRuletaOn();
}
Copy link to clipboard
Copied
This is the output:
[object Stage] 0 0 true
Copy link to clipboard
Copied
can you see wheelmain.wheel?
if it's covered by another object, has its (or one of its parents) visible property assigned to false, it will not respond to the mouse.
Copy link to clipboard
Copied
Yes, i see the movieclip in the screen but the strange thing is that any of the movie MovieClip respond to mouse events
Copy link to clipboard
Copied
i didn't understand your last post.
is wheelmain.wheel timeline tweened?
Copy link to clipboard
Copied
Sorry for my bad english.
Well, if i change one of the lines and type this:
wheelmain.wheel.addEventListener(Event.ENTER_FRAME, onWheelDown);
when the output console write:
Boton del raton pulsado.
Boton del raton pulsado.
Boton del raton pulsado.
Boton del raton pulsado.
.
.
That means that the object is displayed and accessible, but for some strange reason it seems that no stage Movieclip dispatches any mouse event.
Copy link to clipboard
Copied
that doesn't mean the object is displayed and it doesn't mean the object is accessible.
it just means wheelmain.wheel exists when the listener is added. if those traces continue when you click wheelmain.wheel you can conclude it exists when you click something. but, you cannot conclude you clicked the object that has the enterframe listener.
is wheelmain.wheel or wheelmain part of a timeline tween.
Copy link to clipboard
Copied
To my knowledge there is not part of any interpolation, the movie only has 1 frame.
When i transform the game as2 to as3 i only changed code,dont change library and in as2 the game run correctly.
Copy link to clipboard
Copied
because similar code worked in as2 doesn't mean much. as3 is much more picky and has a tendency to lose object references for no good reason.
if there is no timeline tweening, put your mouse listener code in the first keyframe that contains wheelmain.wheel. retest.
Copy link to clipboard
Copied
Maybe a transparent object is over the stage
try
stage.addEventListener(MouseEvent.CLICK, dimeVaquero)
function dimeVaquero(e:MouseEvent):void {
trace(e.target.name);
}
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more