View Full Version : Draging 2 clips, and then drawing a line between them
geedogg
September 29th, 2003, 05:43 PM
Hi there.
Im trying to make something :P
Here it is.
Its going to be 2 movie clips that are going to be dragged up and down(Only vertical movment!!!). And when u have then in the position u want, u can push a button and draw a line thrugh the 2 clips.
Or if there could be a line that is always on the 2 clips.
I know its kinda badly explained, therefore im gonna put up a little schetch.
The only thing i have manage to make is the drag
sirkel1.onPress = function() {
startDrag("sirkel1", true);
};
sirkel1.onRelease = function() {
stopDrag();
};
can anyone help me?
geedogg
September 29th, 2003, 05:49 PM
Oh yeah, its probably best if the line that goes horisontaly across the screen in the 2 clips, is always there, and not drawn later on.
Sorry bout that! :)
fez
September 29th, 2003, 08:58 PM
if youre using flash mx, you can make an empty movie clip on the main timeline and have an
onClipEvent(enterFrame){
moveTo(_movieclip1._x, movieclip1._y);
lineTo(_movieclip2._x, movieclip3._y);
//and some sort of clear function here, i cant rememebr off the top of my head
}
i figure that about what you want to do
claudio
September 29th, 2003, 11:40 PM
depth = 1000;//to make sure the line will stay behind the movie clips
mc1.swapDepths(depth+1);
mc2.swapDepths(depth+2);
this.createEmptyMovieClip("temp", depth);
temp.onEnterFrame = function() {
temp.clear();
temp.lineStyle(1, 0x999999, 100);
temp.moveTo(mc1._x, mc1._y);
temp.lineTo(mc2._x, mc2._y);
};
geedogg
September 30th, 2003, 06:49 AM
coooooool :)
Now i have a line that goes from clip one to clip 2.
But can i make the line go through the 2 clips, across the hwole screen?
And do u know how i can make the clips only go verticaly?
heres the code now:
mc1.onPress = function() {
startDrag("mc1", true);
};
mc1.onRelease = function() {
stopDrag();
};
mc2.onPress = function() {
startDrag("mc2", true);
};
mc2.onRelease = function() {
stopDrag();
};
depth = 1000;//to make sure the line will stay behind the movie clips
mc1.swapDepths(depth+1);
mc2.swapDepths(depth+2);
this.createEmptyMovieClip("temp", depth);
temp.onEnterFrame = function() {
temp.clear();
temp.lineStyle(1, 0x999999, 100);
temp.moveTo(mc1._x, mc1._y);
temp.lineTo(mc2._x, mc2._y);
};
claudio
September 30th, 2003, 09:38 AM
stageH = Stage.height;
mc1.onPress = function() {
this.startDrag(true, this._x, stageH, this._x, 0);
};
mc2.onPress = function() {
this.startDrag(true, this._x, stageH, this._x, 0);
};
mc1.onRelease = function() {
this.stopDrag();
};
mc2.onRelease = function() {
this.stopDrag();
};
depth = 1000;//to make sure the line will stay behind the movie clips
mc1.swapDepths(depth+1);
mc2.swapDepths(depth+2);
this.createEmptyMovieClip("temp", depth);
temp.onEnterFrame = function() {
temp.clear();
temp.lineStyle(1, 0x999999, 100);
temp.moveTo(mc1._x, mc1._y);
temp.lineTo(mc2._x, mc2._y);
};
geedogg
September 30th, 2003, 09:42 AM
cool, thanks man!!!!!
But (always a but with me;) ) Is it possible to make the line not stop at the two clips? So the line continues through the two clips and to the end of the screen?
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.