Event types doesn't have mouseX. Only MouseEvent has, and even, you should
use target or currentTarget and get it.
ie:
addEventListener(MouseEvent.CLICK, mousecords);
function mousecords(event:Event):void {
xTween.continueTo(event.target.mouseX, duration);
yTween.continueTo(event.target.mouseY, duration);
}
or in your case, just use the mouseX directly from object:
function mousecords(event:Event):void {
xTween.continueTo(getChildByName(your_cosilla_name).mouseX, duration);
yTween.continueTo(getChildByName(your_cosilla_name).mouseY, duration);
}
Hope that works for you
F
On Wed, Mar 11, 2009 at 2:18 PM, Gustavo Duenas <
[email protected]> wrote:
>
>
> Hi Coders I have this code, is simple I want to move something using as3,
> but when I do the movie test with it, it gives me this error
> 1172: Definition flash.display.Sprite:mouseX could not be found. same for
> the mouseY, I don't understand since the code appears to be in the import
> flash.display.Sprite.mouseX;
> doers anyone has encountered this error, am I doing something wrong, and
> please if someone knows what is would you please point which is the error
> there.
>
> I'd appreciate any help, here is the code
>
>
> import fl.transitions.*;
> import fl.transitions.easing.*;
> import flash.ui.Mouse;
>
> import flash.display.MovieClip;
> import flash.net.*;
> import flash.events.*;
> import flash.display.Sprite.mouseX;
> import flash.display.Sprite.mouseY;
>
> var duration:Number = 3;
> var cosilla:Sprite = new Sprite();
> var cosillaLoader:Loader = new Loader();
> cosillaLoader.load(new URLRequest("http://leftandrightsolutions.com/
> back1.jpg"));
> cosilla.addChild(cosillaLoader);
> addChild(cosilla);
> addEventListener(Event.ENTER_FRAME, mousecords);
> var xTween:Tween = new Tween(cosilla, "x", Regular.easeOut, cosilla.x,
> cosilla.x, duration, true);
> var yTween:Tween = new Tween(cosilla, "y", Regular.easeOut, cosilla.y,
> cosilla.y, duration, true);
>
> function mousecords(event:Event):void {
> xTween.continueTo(event.mouseX, duration);
> yTween.continueTo(event.mouseY, duration);
> }
>
>
>
>
> Gustavo
>
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
--
Fábio Pinatti
:: web.developer
:::: www.pinatti.com.br
:::::: 19. 9184.3745 / 3342.1130
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders