-
User input - Please help!
Hi,
i have created a flash movie that shows the layout of a computer room. I want the user to be able to draw lines between these computers, hence showing they are connected.
How can i allow the user to to draw various lines between the computers and choose the colour of the line they want.
Thanks
-
Between Flash & Flashkit
you can draw with this .
Code:
_root.onMouseDown = function() {
_root.lineStyle(5, 0xFFCC00, 100);
_root.moveTo(_root._xmouse, _root._ymouse);
isDrawing = true;
};
_root.onMouseMove = function() {
if (isDrawing == true) {
_root.lineTo(_root._xmouse, _root._ymouse);
updateAfterEvent();
}
};
_root.onMouseUp = function() {
isDrawing = false;
};
cheers
I want to learn .
wannabe flasher [ Actionscript 2.0 ]
-
Timothye's method will work, but if you don't draw a perfectly straight line, will leave scraps lying around that you might not want.
If that's a problem for your application, try creating a new movie clip, say "lineClip" + i, for each line, then calling all the drawing commands on lineClip. Put lineClip.clear() at the start.
e.g.,
code:
var counter = 0;
aComputer.onPress = function() {
counter++;
var startX = _root._xmouse;
var startY = _root._ymouse;
var lc = _root.createEmptyMovieClip("lineClip" + counter, counter);
lc.onMouseMove = function() {
this.clear();
this.lineStyle(1, 0);
this.moveTo(startX, startY);
this.lineTo(lc._xmouse, lc._ymouse);
}
lc.onMouseUp = function() {
delete this.onMouseMove;
delete this.onMouseUp;
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|