Jump to content
xisto Community
Sign in to follow this  
iGuest

Can anyone help with this drawing actionscript 2.0 ? Flash Actionscript Zone

Recommended Posts

Can anyone help with this drawing actionscript 2.0 ?Flash Actionscript ZoneHi can anyone help me?
 
I need to create an area on stage where the user can draw using the mouse. I found this action script 2.0 coding;
 
_root.CreateEmptyMovieClip("myLine", 0);
 
_root.OnMouseDown = function() {
myLine.MoveTo(_xmouse, _ymouse);
myLine.LineStyle(2, 0xff0000, 100);
_root.OnMouseMove = function() {
   myLine.LineTo(_xmouse, _ymouse);
}
}
 
_root.OnMouseUp = function() {
_root.OnMouseMove = noLine;
}
 
 
however this lets the user draw all over the stage and I need to restrict it within a certain area of the stage. I have tried masking, creating my own movie clips and trying to alter the code but I'm not too exerienced with this. Can anyone help me with any ideas please.

 

-question by Daniel

Share this post


Link to post
Share on other sites

Your code drwas to _root which is the whole parent movieclip.To limit the drawing to a certain area, create a new movieclip with the size you need, call it drawpad for example. the you attach the mouse events to _root.drawpad instaed of _root.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.