See Related Forum Messages: Follow the Links Below to View Complete Thread
Draw A Line Using LineTo Then Hit Test That Line
is there a way to hitTest a line drawn with the following method?
Code:
clear();
lineStyle(1, 0, 100);
moveTo(obj1._x, obj1._y);
lineTo(obj2._x, obj2._y);
perhaps turn it into a movie clip and hitTest that?
...I'm stumped here...
API-draw: Check If Line Intersects Another Line
It been a while and I need some help on this one...
I'm making a very simple game that lets you draw a curve by hand (using lineTo to the mouse position on mousemove) but now, I need to check wether the line intersects wiith another part of the same line (e.g. a loop)
I first used an onrollover command, and that worked, but not always because the mouse moved too fast (same with hittest with mouse). Then I pre-drawed the line in another mc, used hittest on it, and if it wasn't intersecting, draw it in the real mc. But that didn't work because it used the bounds to test. I guess the best way is to use some mathematical formula, but that would mean I have to save all my coordinates in an array...
Is there another way?
TIA
API-draw: Check If Line Intersects Another Line
It been a while and I need some help on this one...
I'm making a very simple game that lets you draw a curve by hand (using lineTo to the mouse position on mousemove) but now, I need to check wether the line intersects wiith another part of the same line (e.g. a loop)
I first used an onrollover command, and that worked, but not always because the mouse moved too fast (same with hittest with mouse). Then I pre-drawed the line in another mc, used hittest on it, and if it wasn't intersecting, draw it in the real mc. But that didn't work because it used the bounds to test. I guess the best way is to use some mathematical formula, but that would mean I have to save all my coordinates in an array...
Is there another way?
TIA
Draw A Line Through A Path Line
Hail,
Does anyone knows how I draw a line through a path line?
An example I have a movieClip that is a pencil and it is moving through a path line, now I want to draw the line that the pencil draw. Confused?
How To Draw A Line
Hi !
I would like some pointers as to how to go about drawing a line. Here's what I want to happen :
I would like the user to click and drag from a point A and a line should begin and end at the point B where the user releases the mouse button.
Any help is highly appreciated.
Thanks in advance
Vinod Sharma
Draw Line
How do you draw lines between different mcs with actionscript
I am using flash 5 but I would be interested in the Mx way as well.
How To Draw Line?
Hi all,
I have a photo, say of a Printer and I draw the Outline of the Printer, with simple Sketches... just Lines.
Now, how would I create an Animation like Someone is "DRAWING" that lines that make up a Printer???
Hope you get that...
Please help me with that... I do not mean a masking effect.. If I want the Individual Lines to be drawn the way they are... how would I do that..
Thanks a lot for any help that you may provide.
Wishy
How To Draw A Line?
Hiya..
how to draw a line from one point to the other?
and how can i use masking to mask it??????
How To Draw Line
Hi hi,
Another question from newbie... I am learning AS3 diligently... reading books and online tutorial...
I know how to draw line :
--------------------------------------------------
var sp:Sprite = new Sprite;
addChild(sp);
sp.graphics.moveTo(400, 100);
sp.graphics.lineStyle(1, 0xff6600);
sp.graphics.lineTo(400, 150);
--------------------------------------------------
... but how to do some animation from point (400, 100) to (400, 150) in one minute time...
I know tween class and also tweener... but just don't know how to apply....
Don't laugh at me... please help !!!
Thanks in advance
Florence
How To: Get A Line To Draw Itself?
I'm trying to get a line to follow the outline of a path/ object, so that it apears to draw itself.
The sort of thing you see in many contepory design/graphis sites.
I can do this by frame by frame animation, but it doesn't look smooth enough. I have been told to look at Actonscripts, but at Newbie stage this is a bit over my head.
Is there a tutorial, page or site were I can learn to do this specific animation.?
Cheers.
[AS]line Draw
Hi, what I want to do with the follow code is to draw a line between 0,0 to my mc, so when the mc moves, the single line will keep stick to this 2 point, one is 0,0, and one is my mc, but when I execute this code, it just keep duplicating the lines, so it became tones of lines when my mc moves along, how can I clear the previous lines? I only need one line stick to it when it moves but not act like it's duplicating the lines...I tried clear() but it didn't work...any other method? thank you.
Code:
onEnterFrame = function(){
mc._x += 2;
this.lineStyle(1, 0, 100);
this.moveTo(0,0);
this.lineTo(mc._x, mc._y);
}
Draw Line
Is there any formula to generate a line (like line graph) between two random points on the stage? (I want to use 'onEnterFrame' to show the line growth)
Thanks in Advance.
Draw Line
Hi All,
Is there any formula to draw a line between two points dynamically?
Draw A Line From X To Y With Actionscript?
Hi there new friends!
Is it possible to add a snippet of code which draws a line from point 1 to point 2, according to variable coordinates.
I want a funcion looking like this, kinda;
drawLine(p1_X,p1_Y,p2_X,p2_Y,COLOR_GREEN, WIDTH_2px)
Or something like that.
Or can you stretch a piece of graphics between those points? It sure would be great, sorry if this is a n00b question.
Cheers and thanks in advance.
/Hoffe
How To Draw A Line With Action?
how to draw a line with action?
my way is :draw a 100 pix width ,0 pix height in a mc.
then use _root.mc._xscale=*** to cortrol the length.
but there is much problems,for example the line's thickness will be scale which look abnormal.
Is there a better way to carry out?
thank you very much in advance~~
Draw A Line Between To Points
Hi all!
i wan to draw a line between to points. After that the line should be drawn to the next point and so on. Finally I have a full shape. It should of course be done only by actionscript.
regards
schth23
Draw A Free Line
Hi all,
Here is part of my script first.
onClipEvent (enterFrame) {
b = _root.i;
// Assign drawing object counter to b
if (_root.mode == "_root.Free") {
i++;
_root.attachMovie("lin", "lin"+i, i);
}
}
.................................
onClipEvent (mouseUp) {
endX = _root._xmouse;
endY = _root._ymouse;
// Create Free Line if the drawing within the board
if (endX-startX != 0 && endY-startY != 0) {
if (_root.mode == "_root.Free") {
b++;
_root.createEmptyMovieClip(b, b);
with (_root[b]) {
lineStyle(_root.pensize, _root.SelColor, 100);
moveTo(_root["lin"+i]._x, _root["lin"+i]._y);
....
....
...
}
This is only a part of the script, but i hope this is still helpful to understand.
My problem is: I have recorded the track of free drawing, and use moreTo to draw a "REAL" line on the track. The whole "REAL" line is considered to be in a movie clip with name "b" and with depth "b", right? Ok, then once i have drawn a free line on the stage and use trace(_root[b]._x) to check its x-coordinate, the value it gives is zero no matter where i draw this line. Then i try to make this drawn line draggable, sure when it go right, _x value would increas from zero, on the other hand, it will decrease its _x value when it move left. So I am wondering why its default _x coordinate is zero? How can I make its _x coordinate is refernece to the coordinate to the stage?
(I hope that my english is clear enough for you to understand, thank you for reading)
Line Draw Question
does a line drawn with flash onto a movieclip count when you're doing hittests?
ie. I have an object travelling from left to right, and in the middle of the screen I have drawn a line on movieclip vectorblank:
vectorblank.moveTo(100, 0)
vectorblank.lineTo(100, 100)
etc..
Now, if I run hittest on the ball, will it detect a hit over the line?
Random Draw Line
Hi all,
I am a newbie in flash MX here and I really need help from everyone. I am currently creating a flash action script which require me to create a game which will randomly draw line when you click on the dot.
The game will be done this way.... There will be a dot in the middle of the scene and when the user click on the dot, 3 lines will spread out randomly from the dot of different length and at different directions. At the end of the line drawn, there will be a dot at the end of the line which the user can in turn click on it and 3 more lines will spread out... the rule is not to collide with any of the line and touch the border of the scene...
Can anyoune out there please help- me here with my problems as I really do not know how should I do... Thanks.
Warmest Regards
Fernado
[F8] Line Fades Out While You Draw.. Help Please (API)
Hi. I know how to draw using actionscript and all that. But how do you make it so that the line fades after a while. Like this http://www.selftitled.ca/ (drag the thing around). How do you get this effect. I'm guessing you could use arrays to do it, but I don't know anything about arrays. Can anyone explain to me how to do this?? It would be very much appreciated. Thanks,
Christian
How To Draw A Line And Erase It?
Probably a newbie question:
on a button click, i want to dynamically draw a line starting at a point, and when it reaches a certain length, have it retract again. Think of it as a fishing line. How do i do this? I can get the first part, drawing a line using "lineTo", but have no idea how to 'rewind' it so to speak. I also tried stretching a line using ._yscale or ._height, but i can not get the desired effect.
Thanks for your help!
Line Draw With Images?
hi, I'm working on a ragdoll program and i've hit a wall... my program will rotate the lines it produces using linedraw but if you draw your own images they kinda... orbit and don't spin... is there a way to linedraw but instead of lines you use png's or jpg's..or import from the library?
Draw Line On Top Of Bitmap
Hi all,
I am using flex2. I would like to draw a bitmap on canvas and then draw lines on top of bitmap. My code is attached. I found that the line is always underneath the bitmap and thus invisible. How can I fix it?
Thanks,
ff
ActionScript Code:
var image:Bitmap = ...
var bitmapHolder:UIComponent = new UIComponent();
var mySprite:Sprite = new Sprite();
mySprite.addChild(image);
bitmapHolder.addChild(mySprite);
canvas.height = image.height;
canvas.width = image.width;
canvas.addChild(bitmapHolder);
canvas.graphics.lineStyle(2, 0xff0000, 1);
canvas.graphics.moveTo(100, 100);
canvas.graphics.lineTo(200, 200);
Draw Preloader Line?
Hello
I have a preloader which does what it is supposed to do except that the line which moves from left to right while it is taking effect is not too straight (it is slightly ragged instead of being super straight).
Here is my AS:
Code:
onClipEvent (load) {
total = _root.getBytesTotal();
}
onClipEvent (enterFrame) {
loaded = _root.getBytesLoaded();
percent = int(loaded/total*100);
// text = percent+"%";
gotoAndStop(percent);
if (loaded == total) {
_root.gotoAndPlay(2);
}
}
Instead of hand-drawing the line with the pencil tool as I do now, is there a way I can use action script to ensure it is completely horizontal?
Thanks
Steve
How Do You Make A Line Appear To Draw Itself?
I want to make a border appear to be "drawing itself" around a rounded rectangle on my site, how would I go about doing it? I'm sure it's easy but for the life of me I can't figure it out. Also, I want to have an X appear to draw itself on the site to cross out some text, how would I do this? (the X I want to use is a graphic, not a vector graphic).
Thanks big time!
How To Draw A Line Over Time
I want to draw a line so that it look like it is transitioning from one point to another. Basically like it is being drawn from point A to point B. I am able to draw a line with ActionScript but I need to put a little interval in there (maybe 1/2 - 1 second) so that it looks like the line is being drawn.
Does anyone have any suggestions.
Thank you.
Dave
Can't Draw A Line Across The Stage
Trying to make a banner ad. Want a cigarette to start at left side of stage and then draw a line (ashes) across to right side of stage. Have animated cigarette from left to right using a guide motion. Don't know how to draw the line without it either disapearing or the whole line appearing from start to finish. Any suggestion? See http://1800quitnow.cancer.gov/banners.aspx for an example of what I am trying to do.
Making Line Draw Itself
I've hit a wall. I need to make a line look like it's drawing itself, as if an invisible hand is drawing on the screen. For some reason, though, I can't figure out or find how to do this.
Could anybody link me to a tutorial or tell me how I might do this? I really appreciate any input in advance.
-Jacob
How To Make A Line Draw Itself?
Hi I'm pretty new to flash and I've managed to find tutorials on pretty much everything I've needed to know so far, but just due to the words in my latest search, I can't find the answer to this Q: I want to make a line draw itself. It's a relatively complex shape I want to trace, and it even has to split at three points. So far I've done it using masks the same as the bg colour that reveal it piece by piece. I'm guessing this is a very crude way of doing this, and I'm getting a pretty poor frame rate. Is there a right way to make a line draw itsef?
If you go here and click "view" on any of the things, and look at the preloader - http://www.brendandawes.com/headshop/ - Thats the nearest thing I can find to an example of what I want to do.
Random Line Draw
Okay, Hey Guys!
I am trying to get an effect like http://www.lindsaylohanmusic.com/news.asp at the header when her picture comes up, the lines draw all by themselves and then they reverse the same way.
Just so they randomly draw squiggly, loopy, big sqiggles all over the scene. I think its a cool effect.
Thanks
Draw Dashed Line
Hello.
Can i Draw a dashed line using the ActionScript 3? I just have success draw a normal line but not a dashed line.
Thanks
Draw Line Between Different Shapes
Hi ther,
i have created array of rectangles using
var myUIComponent:UIComponent = new UIComponent();
//var roundRect:Sprite = new Sprite();
myUIComponent.graphics.beginFill(0xFF8800);
myUIComponent.graphics.drawRoundRect(X,
Y,
150,
75,
50,
50);
myUIComponent.graphics.endFill();
in mxml my code is like
for (i = 1; i <= 2; i++)
{
X = 10;
for(j=1;j<=5;j++)
{
var rectsprit:UIComponent = rect.drawRect(X,Y);
//this.rawChildren.addChild(rectsprit);
panel.addChild(rectsprit);
//this.addChild(rectsprit);
X = (160*j) + 10;
}
Y = (85*i) + 10;
}
Now i need to draw line between these shapes. i mean when i click to point and then drag and draw a line to other rectangle.
Pls help me out
Thanks in advance
Draw A Moving Line From (400,100) To (500, 150)
Hi hi,
I am newbie in AS3. This forum is great. With the replies of my previous post, I have learned how to draw vertical, horizontal or with 45 degrees moving line.
But what if I want to draw a line from (400,100) to (500, 150).... I think I need to use some sine, cos or tan formula to increment ... right ?? :
-----------------------------------------------------------
var line:Sprite = new Sprite;
addChild(line);
with (line.graphics) {
clear();
moveTo(400, 100);
lineStyle(1, 0xff6600);
lineTo(500, 150);
}
var sp:Sprite = new Sprite;
addChild(sp);
var lineY:uint = 100;
var lineX:uint = 400;
function drawLine(e:Event):void {
with (sp.graphics) {
clear();
moveTo(400, 100);
lineStyle(1, 0xff6600);
lineTo(lineX++, lineY++); // I know this is not correct !!!!
}
trace("lineX = ", lineX, " lineY = ", lineY);
if ((lineY>150) || (lineX>500)) {
removeEventListener(Event.ENTER_FRAME,drawLine);
}
}
addEventListener(Event.ENTER_FRAME,drawLine);
------------------------------------------------------------------------
Please show me how to achieve this.
Thanks
Florence
Draw A Line Between Two Points
Hello! I'm trying to build a basic graphing tool for high-school students. I want them to be able to plot two points on an x-y graph, then click a button to draw a line between the two points.
I have an idea for how to let users drag and drop the points on a grid, but I'm not sure how I would approach drawing the line. I suppose I could create a library of lines at different angles, each of which loads for a specific pair of coordinates, but there must be a better way.
Any suggestions?
Thanks!
--J
Can I Allow The User To Draw A Line?
Hey :-)
I'm trying to find out how I can allow the user of my flash site to draw a simple, black line when he holds and clicks down the left mouse button, at any time. Does anyone know how to do this? Or have any links to point me in the right direction?
Many thanks!
How Draw Dotted Line With AS
Hi,
I'm working on a whiteboard project for e-leaning solution, I have to make some drawing tools for this but I couldn't find any way to draw dotted line (........) with actionscript , if any one can help I will appreciate, thanks for your time to reply.
Draw A Line Around A Movieclip
Hi everyone,
I would be most thankful for some help here. I want to draw a line (which I have no problem with using lineTo, moveTo etc.), but I want it to be around a movieclip where I have some graphics. Is this possible or do I have to figure out all the exact cordinates myself? Which is the easiest way without choose the frame by frame. Just some ideas 'cause I'm stuck here.
Hope you understand me here, otherwise shout.
Thanks.
Script Line Draw?
I've got a scribbled line that I need to animate being drawn in. I'm thinking I could use duplicate movie clip or something. If I get the x and y coordinates from a movie clip that is animating along the path of the scribbled line. Is that possible? How could I accomplish drawing in this scribbled line -- without having to resort to doing it manually?
Any help would be much appreciated... Thank You.
Rony Tako
http://www.iamgeneric.com/
Line Draw Behavior : Works 50%.....
Ok, I've been working on this silly script for a few hours now, and have run into a wall.
Right now the X +/- animations are perfect, but I get NOTHING on the Y +/- version.
Object: Simply to animate a line draw from 0 length to some other length, in the X and Y + and - directions. Simple, right?
My theory is that the problem has something to do with the _width and _height properties and the _rotation combined. Note, that when I run it in the X direction, if I edit the _rotation with the debugger it looks fine. (?)
Here's the code:
FRAME 1
---------
//initialize, determine distance to draw
segment = 0;
_parent._width = 1;
if (_parent.lineX == 0){
distance = Math.abs(_parent.lineY);
}
else if (_parent.lineY == 0){
distance = Math.abs(_parent.lineX);
}
FRAME 2
---------
// Rotate line to proper direction, Flag if it's X or Y based animation (drawtype)
if (_parent.lineX == 0) {
drawtype = 0;
if (_parent.lineY == math.abs(_parent.lineY)) {
_parent._rotation = 90;
} else {
_parent._rotation = -90;
}
} else if (_parent.lineY == 0) {
drawtype = 1;
if (_parent.lineX == math.abs(_parent.lineX)) {
_parent._rotation = 0;
} else {
_parent._rotation = 180;
}
}
//set the segment length for the animation
segment = Math.round(distance/_parent.speed);
FRAME 3 "animateLoop"
---------
// change the line incrementally
if (drawtype == 1) {
length_now = _parent._width+segment;
_parent._width = length_now;
} else if (drawtype == 0) {
length_now = _parent._height+segment;
_parent._height = length_now;
}
FRAME4
--------
if (length_now <= distance){
gotoAndPlay ("animateloop");
}
else {
stop();
}
++++++++++++
It seems that altering the _height never has the right effect.
Anyone??
jonny
hollow planet design
Draw A Gradullay Increasing Line
initially there should be a point on the screen. this point should gradually form into a line. how can i get this kind of effect. i have seen this effect being used many number of times.
please give me the action script code of the following. sir please give a code which will work on flash mx 6.0
Draw Line/circle, Then Open .swf
I'm having quite the problem trying to develop this odd navigation system for my art portfolio online. This navigation system is based off of a component at the DonnieDarko.com site, you can look at this link to see what i'm talking about:
http://www.donniedarko.com/are/you/sleep/golfing/
The component i'm referring to on that website is the 'chalkboard'.
Now, what i would like to do is the following:
On the lower left side of the mainstage, i will have a notepad looking image just for looks. When the cursor is passed over the notepad image, the cursor is turned into a pencil, and when the cursor is passed out of the notepad image, it turns back into the cursor. Next, i will have 7 seperate static text boxes with the different titles of the different .swf pages. When the user draws a line through the desired .swf title-statictext-box, that .swf will open up in the empty movie clip that is set on the mainstage. That's basically it. However, i would prefer if the user could circle the title, instead of drawing a line through it, but either a line or circle will do just fine.
Now, once again this is a very far out idea, and hopefully someone here can aid me in the process to success. This has proved to be a very popular topic at Kirupa.com:
http://www.kirupaforum.com/forums/sh...threadid=50939
But my comrade Colin and i could never find a concrete solution; though we did indeed get close. ANY ideas, suggestions or anything at all would be greatly appreciated.
Victor.
How Do You Draw A Line From Point A To B Dynamicly?
Hey, how do you draw a line from point A to B dynamicly? What I mean is, how do you draw a line on the screen that keeps changing acording to x1,y1, x2,y2?
Also, how do I fill in the lines to a solid color?
|