ActionScript 3.0 :: Detect If A Circle Is Crossing A Diagonal Line?
Apr 6, 2010
Currently, I am using the code below. But it is telling me that the circle is starting to hit the line when it's y position is 40. But since the circle actually isn't crossing the line itself (virtually) until it's y position is at about 205, I don't want the trace-action called so early.
Code:
var circle: Sprite = new Sprite();
circle.graphics.beginFill(0xFF0000);
circle.graphics.drawCircle(0, 0, 10);
circle.x = 170;
[code]....
View 1 Replies
Similar Posts:
Apr 23, 2006
Given 2 point A(x,y) and B(x,y), is there a way to tell if C(x,y) is crossing the line that A,B do? I mean in between thoses to 2 points...
View 14 Replies
Nov 20, 2009
anyone can u explain how to drag a movieclip on a diagonal path..?
View 2 Replies
Apr 23, 2008
I'm working on a volume slider for a type of jukebox and what I'm using is an actual drawing that is on an angle, therefore the volume slider and handle aren't in a straight horizontal line.I've done the basic code to keep the handle within the distance of my slider "line" (left to right), but what I have obviously just constrains it to a rectangle.
on(press){
this.startDrag(false,0,0,32,9);
}
on(release){
this.stopDrag();
}
The slider and handle are both at actual size, that's why it's only 32 pixels wide that I need it to go across and 9 pixels down. I do realize that for what I want, it's much more involved than this simple startDrag code with 4 sets of numbers in it.I'm including the source file in Flash 8/Actionscript 2.0.
View 3 Replies
May 30, 2010
how to draw a diagonal line that looks sharp and not pixelated? Straight lines are easy, but I can't figure it out for diagonal lines.
View 1 Replies
Feb 11, 2010
I used some code that I found, I think even from you guys the scale an external swf being loaded onto a background movie clip. Works great with the exception that it clips some text and creates some funny diagonal lines and some poor picture quality. I have a feeling that this is down to a slight difference in sizing some where along the line. The stage size is 2560 x 1440 being scaled down to any size, but as I mentioned I don't think the height and width are quite in sync for the widescreen format.
[URL]
// perform initial size check
checkStageSize();
// register to re-check when stage size changes
stage.addEventListener( Event.RESIZE, onResize, false, 0, true );
[Code]...
View 4 Replies
Nov 8, 2010
This is actually more a math problem, but maybe some of you are better at math and have an idea on how I should be approaching this.
I'm dynamicly creating circles in my actionscript project and what I want now is calculate their x- and y-positions. I want them to be positioned in a circle, with the condition that it shouldn't matter how much circles I dinamicly load. (I'm having a hard time translating my problem to English, so I'll add an image so you instantly see my problem.) Does anybody have an idea on how to calculate this? What kind of formula should I use?
View 5 Replies
Mar 2, 2011
I am trying to move a line around in a circle, around a fixed point (not 0,0). As in the way a clock hand moves around with one end at the middle and the other end traveling in a circle. I tried the rotation function but that moves the entire object around (0,0), I need the point in the middle stationary and at a non (0,0) point.
View 9 Replies
Apr 23, 2010
I want to draw a circle on the scrren of a random x,y position and a random radius. Then, I would like to draw a line that starts at the center of the circle and ends at the spot where the circle ends, at its perimeter. All I have been capable of doing by myself was creating that circle and set the drawing position with the moveTo function to its center, but I don't know how to calculate the length of the radius, so I have the coordinates for the lineTo function.
View 7 Replies
Feb 7, 2006
I want a straight line to slowly curve so it become a circle. Can yo do that with actionscript?
View 5 Replies
Aug 6, 2009
I was wondering if anyone could tell me how and if it is possible to draw a line/ circle and place a movie clip on it and get the movie clip to go round the circle by placing the left and right arrow keys on the keyboard.
View 0 Replies
Apr 15, 2011
This should be a bit of simple geometry: How do I calculate the points to draw the lines in the code below so that it makes a 2D cone or wedge shape?
import flash.geom.Point;
//draw circle
var mc=new Sprite()[code]...........
UPDATE:I should have mentioned my aim is not to draw a wedge shape, but to draw a line from a random point to the edge of an existing circle.If you're more comfortable with algebra than actionscript,
View 5 Replies
Aug 9, 2010
I have some trails data that I am adding to an interactive map. The trails were imported from Illustrator and are lines that have been converted to movieclips upon import. I'd like to add effects and some interactivity to the lines upon click and mouse_over. The difficult piece is that Flash treats movie clip like a box making it dificult to click on just the trail you'd like info for. For example, if there are two trails next to one another, clicking on the one you want can be difficult.
Is there a way that I can make it so that only the line part of the MC is the piece that responds to mouse action (rather than the whole box which encompasses its extent)?
View 2 Replies
Jun 4, 2011
I have table
words = [aaaa, bbbb,cccc,dddd,eeee,ffff]
and i want to make table like this:
words2 = [aabb,bbaa,ccdd,ddcc,eeff,ffee]
View 1 Replies
Jun 26, 2011
I'm drawing a simple line with API and I would like to know how to detect what angle the line has and where a ball hits it.Scenario: the player draws a random line in a random angle, a ball comes in from random points and hits the line, the ball then bounces off the line depending on where it hit the line (and of course depends on the line's angle).I draw the red line with this: (on a 400x400 stage)Actionscript Code:graphics.lineStyle(2, 0xFF0000, 100);graphics.moveTo(150, 150);graphics.lineTo(250, 250);The grey, green and purple lines are just demonstation of the ball movement, comming in from outside the screen, hitting the line and bouncing off in different directions. I just made a guess on the angle they will bounce off in.
I just can't figure out how to detect the line's angle and where the ball hits it. So all I have is a ball flying in from random positions and hitTests the line (not coded yet, but no problem to do ball movement and hitTesting with line), I don't know where to go from there until I know how to detect where it hits the line.I know this is a double post (from the Games section), but I realized this place seems to have more activity and not many seem to visit the Games place anymore.
View 11 Replies
Nov 27, 2010
There is some information but I couldn't figure it out:How can I detect if a line intersects with a triangle ? And how can I detect the point of intersection in AS3 ?
View 1 Replies
Oct 5, 2010
I want to be able to write a paragraph in a textfield, and then click and hold, or do some similar gesture, and have the entire paragraph selected. I'm then going to drag it (using bitmapdata or whatever) to another textfield.
In order to do this, I need to be able to detect where a given paragraph ends. So I'm trying to do that with the following code, which searches for " " in the text.
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
[Code].....
View 1 Replies
Apr 27, 2011
I have converted line to movieclip. Now I want to detect click and drag on line not on whole movieclip how to add listener just to the line ?
View 1 Replies
Nov 26, 2004
How do I detect collisions between movie clips and a line created through actionscript (with the lineStyle, lineTo, etc. commands). I tried making the line inside a movie clip and doing a hitTest with that movie clip, but it did nto work.
View 1 Replies
Apr 21, 2011
I want to shape tween multiple objects on the same layer. When they are placed independently from each other all the time on the canvas, I have no problem to make them morph into the other shapes in the ending keyframe.
However, when some of the objects are crossing each other in either the starting or ending keyframe, they don't morph smoothly but quite funnily. Funny phases are nested between the intended starting and ending tages.
See the images below. What should I do to prevent this?
[Code]...
View 1 Replies
Apr 21, 2011
I want to shape tween multiple objects in the same layer. When each objects are placed independently within within distance from each other, I have no problem to make them morph into the other shapes in the nex keyframe.However, when some of the objects are intersecting each other in either, they don't morph smoothly but quite funnily. Funny phases are interpolated between the intended starting and ending stages.See the images below. What should I do to prevent this?
View 1 Replies
Mar 12, 2011
I have an animated fish crossing the screen. I made that using the animated fish (movieclip1) following a path on a guide layer. All these are into another movieclip (2). I want in mouse hover condition to accelerate the tween. In other words I want the user to point the fish with the mouse (mouse hover) and then the fish tries to escape (tween acceleration). How can I accelerate the tween?Keep in mind that in fish movieclip(1) I have more than one Tweens. So the code must be for selected tween (named by frame label). Another thing is that acceleration mustn't be directly from 0 to 1. There must be an ease on the start and on the end of acceleration so it can be more realistic. I am not related on programming so I would like a complete answer (not just directions)
[Code]...
View 5 Replies
Nov 26, 2004
How do I detect collisions between movie clips and a line created through actionscript (with the lineStyle, lineTo, etc. commands). I tried making the line inside a movie clip and doing a hitTest with that movie clip, but it did nto work.
View 1 Replies
May 3, 2006
How can I move a point (or circle) slowly and the point let behind a line.When the point turn back the line will be erase.
View 8 Replies
Mar 8, 2005
I'm developing a game atm, and I need some help on the mathematics/coding of colliding circles (and their change in x/y speed). What i need to know is how to calculate the direction and speed a circle has after colliding with a static (non-moving) circle. I know how to detect a collision between the two, but I'm not sure about the maths I need to give the circle the right speed and direction after the collision
If i do know how far away the two circle-points (in the middle of each) are to each other (in both x and y coords) would it be easy for me to find the new speed and direction of the large circle in the example above? I know that I somehow should use the angles to pretend the circle hits a flat "wall" (as it only hits one point), and then calculate the new speed/direction. My only problem is that I'm not sure how to decide the angle of this flat "wall" and how x and y speeds should change when colliding with a wall that is angled. Does anyone here have any insight, links or tips on how I can du this?
View 6 Replies
Sep 30, 2005
i want to make one circle follow the mouse cursor, inside another circle. Similar to an eye looking at the cursor. Ive attached an example.
View 4 Replies
Nov 5, 2008
I have text in a dynamic field showing up as circle. I want to say if circle shows up change it to cercle (french).
[Code]...
View 1 Replies
Mar 8, 2005
What i need to know is how to calculate the direction and speed a circle has after colliding with a static (non-moving) circle. I know how to detect a collision between the two, but I'm not sure about the maths I need to give the circle the right speed and direction after the collision.If i do know how far away the two circle-points (in the middle of each) are to each other (in both x and y coords) would it be easy for me to find the new speed and direction of the large circle in the example above? I know that I somehow should use the angles to pretend the circle hits a flat "wall" (as it only hits one point), and then calculate the new speed/direction. My only problem is that I'm not sure how to decide the angle of this flat "wall" and how x and y speeds should change when colliding with a wall that is angled.
View 6 Replies
Aug 24, 2009
I`m working on a app that you can draw lines.....like circles, rectangles... my problem is when a user draw a circle for example....i wanna be able to paint (change color) inside of this circle. I`ve tried working on Shapes with cacheAsBitmap = true and Bitmaps with BitmapData but it doesn`t seens to work.
View 4 Replies
Mar 16, 2012
I want to create circle, and put 8 points on it. So, user can drag each point in order to change it's shape.
Is there any way to do this in flash?
I have some following code:
Ref. - How to draw a continuous curved line from 3 given points at a time
package{import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.geom.Point;
[Code].....
So, can anyone convert these three point curve line to 8 points circle?
View 1 Replies