AS3 :: Flash - Get The Two Points Of A Line?

Oct 15, 2011

I have a component (link to Test class) which contain one line in it, and I put one point of this line to (0, 0).

Then drag it to Flash(fla), and get its Shape in AS3 like:

// in Test.as
// assume that the movie clip only contain one line.
var line:Shape = Shape(getChildAt(0));

And I can get one point of this line which is x and y of var line. But how to get another point of this line?

Edit:
Ignore component stuff above, here has another question but I guess it pretty much the same as the question above:

Draw a line from (0, 0) to (10, 10) and draw another line from (10, 0) to (0, 10), how to get those lines of two-point form in AS3?

If I access them as Shape then I get two similar shapes which have same x, y, width and height values. Does AS3 has some way to access line as a REAL line not just a shape? or does it has any way I can calculate it out?

View 2 Replies


Similar Posts:


Flash :: Using The Pen Tool - Line Automatically Connects Between The Two Points In A Straight Line

Jul 3, 2009

I'm in the process of teaching myself the components of the CS4 Design Premium package using the Adobe Classroom in a Book series. I'm currently going through the Flash CIAB and i've started using the pen tool. The task involves creating a wave like design across the stage. Whilst this in itself is simple, the final instruction is to click on the first anchor point to close the shape. In the illustration, the closed shape seems to automatically extend around the stage, however when I click on the first anchor point, the line automatically connects between the two points in a straight line.

Am I doing something wrong? The next step is to fill this area, but with the straight line effect that I am getting, this becomes impossible. I should point out that the instruction states that the pen tool line should extend off the stage. I have done this, but even then on clicking on the first anchor point the shape is closed incorrectly.

View 2 Replies

Actionscript 3 :: Calculating Evenly Distributed Points On A Line Of Points

Oct 3, 2011

I have been tasked with trying to create a drawing tool that draws dotted lines as you drag the mouse across the stage. I can easily capture the points on MouseEvent.MOUSE_MOVE and store them in a vector and then draw the points as dots:

The problem is that I need to calculate evenly distributed points on an ever growing Vector of points so I can only draw the line between say every 5th point (say using modulus). I have been battling away with Bezier curve equations both Quadratic and Cubic but still can't quite figure out how to convert my Vector of points into an evenly distributed Vector of Points without sucking the life from the CPU.

View 1 Replies

ActionScript 3.0 :: Flash Runtime Ignores Alpha Values When Iterating Over Points In A Line

Apr 15, 2011

I have a large-ish array of points.

The graphics object I am using has it's alpha value set to 0.1.

When these points are plotted iteratively, and the line being drawn overlaps another line drawn earlier, there is no visible change in the colour at the intersection.

If I draw the line differently, not using an array of points, the alpha is not ignored.

ActionScript Code:
public function render(e:Event):void
{
if (segmentsCollection.length > 0)

[Code].....

This all occurs on each ENTER_FRAME event until the array is emptied.

I have tried loads of options but the alpha is always ignored.

View 5 Replies

Creating A Line Between 2 Points?

May 20, 2009

I want to create line between 2 points ...such tht the line will start when i click the point A then i will drag the line by holding it to point B and i will join the line to point B by clickin on point B (somethin like the pen tool) ..then line will then be joined between the points ...

View 1 Replies

ActionScript 1/2 :: Join Two Points With A Line?

Aug 25, 2010

I want to ask how do you join two points with a line using actionscript? The points would be constantly moving.

View 9 Replies

ActionScript 3.0 :: Find Points On The Line When Given The X Value?

Oct 28, 2010

I have a line that is drawn using the draw api. I need to find points on the line when given the x value, how would I do this. I know on the bezier segment I can just user the yForX() and get the value but not sure how to with just a straight line.

View 5 Replies

ActionScript 2.0 :: Create A Line Between Two Points?

Oct 23, 2009

I need to create a line drawn between 2 points. My actual idea is of joining 3 points with lines drawn dynamically(for a triangle).

View 1 Replies

ActionScript 2.0 :: Check All Points Along A Line?

Aug 20, 2009

I'm using Flash 8 and AS2 I am attempting to make some code that checks whether or not a line that rotates around the screen is hitting a movie clip. Here is my code (with comments explaining it):

[Code]....

View 3 Replies

Professional :: Anchor Points On Line Segments?

Feb 14, 2010

Closed path made with pen tool in Flash MX  comprises of line segments & curved segments both.While adding anchor points on segments it is noticed that pen tool adds anchor points on curvaceous segments but not on line segments. Why is it so ? Is their any way to accomlish this task ?

View 5 Replies

ActionScript 2.0 :: Find The Points In A Line (Math)

Feb 3, 2005

find a points in a line Actually i want to make some footsteps in a sand. The footsteps are dhynamically placed on the stage. How to find the points in a dioganal. see the image

View 1 Replies

ActionScript 2.0 :: Find The Points In Line (Math)

Feb 3, 2005

i'm trouble to find a points in a line Actually i want to make some footsteps in a sand. The footsteps are dhynamically placed on the stage. How to find the points in a dioganal.

View 1 Replies

ActionScript 3.0 :: Drawing A Squiggly Or Wavy Line Between Two Points?

Oct 19, 2008

draw a squiggly or wavy line in the MOUSE_MOVED event as the user clicks and moves the mouse.

View 1 Replies

Draw A Continuous Curved Line From 3 Given Points At A Time?

May 10, 2011

I am trying to draw a continuous curved line in flash. There are many methods but none of the ones I have found so far quite fit my requirements. First of all, I want to use the flash graphic api's curveTo() method. I DO NOT want to simulate a curve with hundreds of calls to lineTo() per curved line segment. It is my experience and understanding that line segments are processor heavy. Flash's quadratic bezier curve should take less CPU power. [code]...

View 3 Replies

ActionScript 3.0 :: Add Mc Over Some Points Of A Line Drawn With LineTo Method

Nov 1, 2010

this is the thing: Using "lineTo" i get a line drawn on stage when dragging a mc. Then i should have four mc (note1, note2, note3, note4) added randomly over this line. I mean, the line is drawn and then over some parts of this line, using x and y of some of the points drawn there, this movie clips should be added randomly. I can make the mc appear randomly, but always in the same point (mouseX, mouseY); i cannot access others x and y of the drawn line. This is my code (noteContainer is a sprite):

Code:
private function drawingAPI(event:MouseEvent):void{
sprite1.graphics.lineTo(mouseX, mouseY);
}

[Code]...

View 9 Replies

ActionScript 3.0 :: TweenMax: From Flat Line To Multiple Points?

Jan 11, 2012

I think it would be cool if the line started out as flat (i.e., y=_height/2 for all points) and then the y points of the line animate into place.I don't even know where to start with doing this in TweenMax/Lite... I've seen several code snippets that draw a line from left to right, but that's not what I want.

View 6 Replies

ActionScript 2.0 :: Trigonometry - Line To Continue After The Points In Both Directions And With The Same Steep

Sep 27, 2005

Is there someone who is good at trigonometry? I have two points punkt1 and punkt2 and a line that is drawn between them. Both points is dragable. I want the line to continue after the points in both directions and with the same steep. I have counted the steep between point1 and point2 and tried to continue to drag to a point with the same steep, but it doesnt succed.

[Code]....

View 3 Replies

Actionscript :: Assemble Array Of Continuous Points For A Contour Line Using Conrec

Mar 31, 2011

I am trying to implement contour lines in ActionScript using Conrec. I have looked at both the java and javascript implementation and am still stuck.URL...Conrec will take grid data and assemble continuous contour lines. The problem is that it does not necessarily draw those lines in a continuous fashion. For example, it will draw A->B and then C->B and then C->D instead of A, B, C, D, etc.The javascript implementation seems to be accounting for this and serializing the instructions into an array of draw points. Which is what I too want to accomplish in the end. That is it takes the instructions from the core Conrec logic (eg: A->B, C->B, C->D, etc) and organizes it into an A, B, C, D series. I think it will also return the series as a multi-dimensional array to accommodate broken lines (eg: [[A, B, C, D], [E, F, G]]). This last functionality is what I need to do in Actionscript.This last part is where I am stuck. Ignore Conrec for now (I have given up on finding an Actionscript implementation), how can I organize these instructions into a collection of serial points? When Conrec gives me "draw point from X->Y" how can I first check if X or Y are already in a series and append either X or Y (whichever is not in the series) into the series? AND if neither are in the series, start a NEW series with X, Y as the starting set. Then check subsequent instructions against all existing series and connect series if they now start and stop on the same point? Also, I need to be able to allow for a series to close itself (eg: A, B, C, A) -- a loop (is that even possible?!).

I'm not sure if there is a technical term for what I want to do beyond "concatenation". I also hope someone out there has done this with Conrec and can give me some pointers.In the meantime, I am going to continue to plug away at this and see if I can come up with something but I am not confident in my abilities.If you know another way to draw contour lines from grid data, I am open to alternatives. But I have to be able to implement it in Actionscript.

View 3 Replies

ActionScript 2.0 :: Code In Flash To Read It Line By Line But Its Only Showing The First Line Out Of 5 Lines?

Dec 17, 2009

i have an xml file and i want my code in flash to read it line by line but its only showing the first line out of 5 lines.Below is the code:

var NigeriaNumber:Number;
var stateName:String;
var year:String;

[code].....

View 0 Replies

ActionScript 3.0 :: "attach" Textbox To Midpoint Of Line Between 2 Movable Points?

Dec 1, 2009

I have 2 points you can drag. A draw a line between them. I have a textbox that displays the distance between the 2 points. How can I have the textbox "attach" itself to the midpoint of the line and stay there as the points are dragged?a file is attached and you can see it here [URL]

PHP Code:

var item:MovieClip;
var dragOffsetX:int;
var dragOffsetY:int;
var itemOffsetXY:int;

[code]....

View 3 Replies

ActionScript 2.0 :: Make The Bar "snap To" Certain Points Along The Line?

Oct 19, 2005

I'm working on this sliding bar navigation thing , and I'd like to make the bar "snap to" certain points along the line.

View 5 Replies

Flash - When Drawing A Freehand Line With The Cursor, How To Make It A Dashed Line

Nov 23, 2011

I am using Flex 4 and AS3 and I am trying to make it so that the user can draw a freehand line with the cursor - I have this part done.However, I also need the line to be a dashed line instead of one solid line like it is now. below is my code I am using. I have found some examples on how to do this, but they are all for straight lines, not for a freehand line.

Class File (DrawingArea):

package
{
import flash.display.BitmapData;
import flash.events.Event;
import flash.events.MouseEvent;

[code]....

View 3 Replies

ActionScript 2.0 :: Draw Line Like Flash Line Tool?

Mar 12, 2010

I want to create a line tool exactly like flash line tool. But the code that I am using shows the line when we release the mouse button. How can I show the lines while it is drawing[code]...

View 4 Replies

Actionscript 3.0 :: Flash Drawing Board With Erase Function / Erase Line By Line

Jan 9, 2009

Im building a pretty simple drawing board in flash, i got this code from this forum and it works fine (there is more to it but this is the drawing part)[code]This works fine. But i want to be able to erase the drawings, step by step this is ths tricky part, ive looked everywhere(ok not everywhere) but in a whole lot of places but the only thing i found is how i could delete everything with removeChild and that in not what i want. Maybe i need to change the function abowe? Please help me to get in the right direction. What should i read about /look at?

View 5 Replies

AS3 :: Points & Lines - Getting Lines To Follow Points As They Are Dragged?

Jul 21, 2010

I am trying to create a mindmap where the user can drag points about the screen. I have gotten as far as drawing the line via actionscript, and drag+drop the points (defined as movie clips on stage). This is the existing script - I don't know how to get the lines to follow the points. Something to do with ENTER_FRAME or updateAfterEvent?

var line:MovieClip = new MovieClip();
line.graphics.lineStyle(1,1);
line.graphics.moveTo(ptOne.x,ptOne.y);

[code]....

View 1 Replies

Flash :: Add Multiple Points For A Single Value X?

Mar 20, 2010

Is there a way to plot multiple data for the same value x? For example following points:

[1, 1], [1, 2], [1, 3], [2, 6], [2, 9], [3, 11], [4, 11]...

View 1 Replies

Flash :: Maintain A LineTo Between Two Points In AS3?

May 5, 2011

I'm looking to work out the most efficient way to maintain the joining of two points with a line in AS3. Basically, I have a whole bunch of circles that move around, and have a property subNode which will act as an end point for the line. At the moment, the way I'm doing it is extremely intensive:

[Code]...

View 1 Replies

Flash Supports Subtitles With Cue Points And XML Files For Flash Video

Jun 24, 2010

I understand that Flash supports subtitles with cue points and XML files for flash video. First, I don't know if that would work for a flash animation, and second, I'm looking for a much simpler solution. I am more than willing to manually add and time my subtitles myself on a new layer. What I need help with is finding the simplest way possible to make these subtitles toggle-able. Why? Because I seem to have a serious allergy to ActionScript, and though I can master programs like 3D studio Max and After Effects, I seem to screw up even the simplest of Actionscript jobs.

Is there some way I can make a button that simply makes my subtitles layer invisible across the whole thing? Maybe a command to change the font to a blank one, or to move the titles off screen? There has to be SOME sort of trick that won't require me to drop a load of code into each instance of text. I'm currently using Actionscript 3.0 with Flash CS4. I'd also love to have a pause button that would also stop any music or sound effects that are playing, but after struggling with that for years, I seriously doubt that's going to happen. I did google this subtitles problem, and search flashkit first. Nothing but VIDEO subtitle stuff, and I'm almost positive it wont work the same for a regular animation.

View 5 Replies

ActionScript 2.0 :: Draw Line Tool Like Flash Line Tool?

Mar 12, 2010

I want to create a line tool exactly like flash line tool. But the code that I am using shows the line when we release the mouse button. How can I show the lines while it is drawing

Code:
this.createEmptyMovieClip("drawing_mc",this.getNextHighestDepth());
drawing_mc.lineStyle(1,100);

[code].....

View 1 Replies

Actionscript 3 :: Flash - Get The Points Of A Path Drawn?

Aug 31, 2011

Is it possible to draw a path in flash, and access the points from AS?For example if I have a map and I add hidden paths along various roads, I then later want to animate traffic or growing lines along these predefined paths from code.

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved