ActionScript 3.0 :: Drawing A Circular Outline - Calculate The Next X And Y Points
Feb 2, 2010I found this code in AS2. It draws an outline of a circle:
[Code]....
I'm only just embarking on making the move to AS3
I found this code in AS2. It draws an outline of a circle:
[Code]....
I'm only just embarking on making the move to AS3
I am struggling with an issue where I want to create a function that draws an outline of any object and I want to use this outline as curve path so I can animate objects on this path using Tweener. Like that:
Code: Select allvar path = new Array();
path.push({x:300, y:0});
path.push({x:200, y:400});
[code].....
I just upgraded from Flash CS3 to CS5 and when I draw something and try to convert it to a movie clip, duplicate it, etc. the entire drawing's outline just disappears.
View 5 Repliesanimate the drawing of the outline of a circle over a set period of time, say 5 seconds?
View 1 RepliesI try to calculate all the points on a curve.
The curve decided by the width(X on the picture) and height(Y on the picture) properties of a movieclip.The distance between each green point on curve is the same.
I'm needing this for a current project, so I have been digging around quite a bit (with little luck) on finding the distance between two points VERY fast. Yes, it is quite critical that it be as optimized as possible. I have the basics, Pythagorean Theorem run in different ways, as well as the Point.distance() function.
View 11 RepliesI am trying to make a program where I put in a bitmap map and then am able to calculate the distance between two points, and I have done that. Now I want to be able to zoom out and still have those two distance calculate the same distance apart, is there a way to do this with AS3 without have to manually scale my code?
For example I don't necessarily want to have to do
var distance = Math.sqrt(dx*dx+dy*dy)/scale...
Reason being is I would have to redo a lot of code.
I am creating a game in which I draw a series of polygons by creating points around a radius of a cricle.
Later on I rotate the shapes and I need to calculate the new location (X,Y) of the points based on the rotation. I have the Old XY of each point, the XY of the center of the shape, radius of shape and the rotation.
Have a look at my diagram of the problem.
How to calculate the area of a triangle giving 3 (X, Y) points?
View 2 RepliesI am making a multiple drawing application in that three user can do drawing at same canves at same time. I have three layer one for each user. Now at the end I want to calculate the contribution of each user. How to calculate contribution
View 6 Repliesdraw a squiggly or wavy line in the MOUSE_MOVED event as the user clicks and moves the mouse.
View 1 RepliesIn flash, I use lineTo to draw a line between two points. This is working well, but I'm finding that on slower computers, the line is jagged because not as many mouse events are firing.I want to 'smooth' the line out, to add more points in between each point that the mouse registers:
The black lines show the result, the green ones are what I want. The red dots are actual points, and the green ones are interpolated.I have tried to code this myself but I can't seem to get it right, here is the code anyway:
var interX:Number = lastMouseX+(lastMouseSpeed.x/2);
var interY:Number = lastMouseY+(lastMouseSpeed.y/2);
//Also tried: lastMouseX+(this.mouseX-lastMouseX)/2;
// also jittery
[code]....
the result is much more jagged than the normal one.
I want to draw a curved line between random point. How can I do this? The random points are actually x,y positions of movie clips dragged on the stage and I want to code curved lines between them.
Im looking at curveto in as2 but not sure how to to do it?
I have a world map on which I display some data. I read long and lat coordinates for two countries from an XML file which is updated with different coordinates everytime. I then map the coordinates to X-Y axis using some projection method.
So, I have x-y coordinates for two countries. I wanna draw a curved line between those countries but curveTo method draws the curve in one shot. I want to animate the curve drawing part so it looks like it is being drawn real time.
I'm trying to draw a curve based on 24 data points. I want to draw a curved line based on the average of these 24 points. I can draw a line from point to point no problem, but would like a smooth curve. The white dashed line is what I'm trying to achieve:
View 2 RepliesI as this working in AS2 and need to update to AS3...shows that AS3 doesn't like sloppy coding. Here's what I need: I pull data from an XML and that works when I put the data into a dynamic text box. However, I can't seem to get the date of birth into a variable. I have some code that calcs age in years but uses a string literal that I thought I could just replace with a variable from my XML...ain't a workin'. Here's the code I have:
ActionScript Code:
import flash.display.*;
import flash.text.*;
import flash.events.*;
[Code]......
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.
i've tried to simulate a pencil tool, for drawing above a imagem, but the drawing is below the picture. How fix it?
[Code]....
It has me perplexed. Okay, when you draw a shape in Flash, let's say a circle, it draws a 'fill' and adds an 'outline' automatically. Now let's say I deleted the 'outline' part of it, and am left with just the 'fill'. Is there a way to add the 'outline' part back to the shape afterwards? I have a non-standard shape that I need to add an outline to, but can't seem to figure out how to do it
View 2 Replieswhen you draw a shape in Flash, let's say a circle, it draws a 'fill' and adds an 'outline' automatically. Now let's say I deleted the 'outline' part of it, and am left with just the 'fill'. Is there a way to add the 'outline' part back to the shape afterwards? I have a non-standard shape that I need to add an outline to, but can't seem to figure out how to do it...
View 4 RepliesBasically I've got a reasonably complex drawing object in a fla and I want to reproduce it in a class definition using the drawing api. However obviously this is a tedious task, so is there some trick or automated method of doing this?
Last time I needed to do this it was a drawing of an arrow and I ended up writing down x,y,width,height values for everything but this one has curves in it which I don't have experience with drawing anyway.
I've been trying to change the color of some static text using Flash Pro 8, and I can't figure out why, when I publish the file, the text looks like it's outlined in white. Almost like the stroke is white but the fill is the color I'm looking for.
View 1 RepliesIf I have a circle shape, or any else shape, what I should do to make a nice simple outline to that shape. Is there any way to make this simple. I tried to make this with the pen tool, bun it wasn't very precise. I want to use something else.
View 1 RepliesI have created 4 buttons so far and when pressed they change the color of a box on the screen. I will be putting more buttons on the page. When a button is pressed, how can i get a black outline to show around the button to let the person know that was the button they selected--it would then go off when the next button is selected.
red_btn.onRelease = function() {
var boxColor_color = new Color(box_mc);
boxColor_color.setRGB(0xFF0000);
[code]......
I really am a Flash newbie, and don't use Flash on daily basis but the client for whom i'm working at the moment would like a simmilar logo effect on their site.
View 10 RepliesI would like to perform a hit test on a movie clip which contains a closed outline, but no fill colour.
Unfortunately it doesn't seem to work in my code. Is it possible or do I have to work around this?
I was wondering how to go about doing a preloader that slowly reveal a building outline line by line.
View 1 RepliesI cannot get this to work. Without the "var drawing", "var drawing being true or false" and the "if statement", it works fine. But I need to add the "var drawing" so that you can only draw if you turn it on by pressing the "draw_btn" button. Note, I do not get an error, the script "apparently" contains no errors. Here is the code:
ActionScript Code:
var drawing = false
_root.createEmptyMovieClip("myLine", 0);
[Code].....
I've created a drawing tool which allows the user to draw on the canvas, the problem is that if I try to draw over a movieclip nothing happens. Is there a way I can allow for the user to draw over movieclips? For example if I had a background of paper?
Here's the code I'm using for it:
// This code is for drawing the lines on the page
//1.
var drawingLine:MovieClip = new MovieClip();
addChildAt(drawingLine,0);
[code]....
I have a circle on top of an image that's fading in and out. When I tween the image, a white border appears around the circles on top of the image. This doesn't happen when the circle is below the image layer, and it doesn't happen with a square. Any idea what's going on?
Below is an image of the hairline white border around the black and blue circle.
[Code]...