Hey!
My question is regarding drawing a straight line, just like on the flash game Line rider. I need to be able to create a line by dragging it with the mouse.
Any help would be appreciated :D
Regards
Printable View
Hey!
My question is regarding drawing a straight line, just like on the flash game Line rider. I need to be able to create a line by dragging it with the mouse.
Any help would be appreciated :D
Regards
hi,
Would it be something like:
PHP Code:this.onMouseDown = function()
{
var n:Number = this.getNextHighestDepth();
var mc:MovieClip = this.createEmptyMovieClip("mc" + n, n);
var x0:Number = _xmouse;
var y0:Number = _ymouse;
this.onMouseMove = function()
{
mc.clear();
mc.lineStyle(1);
mc.moveTo(x0,y0);
mc.lineTo(_xmouse,_ymouse);
updateAfterEvent();
};
};
this.onMouseUp = function()
{
delete this.onMouseMove;
};
Hey, thanks so much for your reply!
It works perfectly on the main timeline in a new flash file, but when I implement it into my project (inside a movieclip on frame 2 - "Activate pen" sort of thing) it draws a line, and when I go to draw another it deletes the previous.
Is there a way of fixing this?
Regards
Andeh
hi,
I'd say that you have some other code interfering with this one as this should work (on its own) inside any MovieClip, on any frame.
This is because I used this.getNextHighestDepth(); to create a new MovieClip, which means that the previous one is never removed.