ActionScript 2.0 :: Find All The Coordinates Inside A Circle?
Oct 31, 2004
Okay without putting a million boxes around the circle, which i found laggs out my game alot. How can i use some sort of code to find all the coordinates inside a circle.
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.
i'm trying to create AS3 match game - match card to some square in the game.i created class for cards, and i'v tried to capture the card's original position so in case of dragging it to the wrong place, it will return to it's original place.from some reason it always returns to the 0,0 coordinates.
In a tab navigator, I need to find out the x and y coordinates of each the tabs. Is there a way to do that? I am using HBox as Tab in the TabNavigator.
I have been working on Flash AS3 project. I am designing a 3D system. Consider a MovieClip A which is at (0,0,0). A contains B which is at (10,10,10). If I rotate A by 10 degrees then the position of B with respect to A remains the same but position of B with respect to the system changes. To find Global X and Y of B, we have the function localToGlobal but it does not tell anything about the Z property. How to find that?
I just started coding classes and I am having some pretty good success thus far coding individual objects. BUT I realized that I don't know how to find coordinates of another object that is on the stage!Say I am coding in the class "Zombieguy".With the other movieclips linkage "Armyguy" I try toracetrace(Armyguy.y);ORtrace(Armyguy.Y);Both come up with "access of possibly undefined property y through reference with static type Class".I'm sure this is probably pretty simple, but can someone inform me of how to do this small step that is holding me back?
I have two circles, an inner circle and an outter circle. I'm trying to find points that reside within the area between the edge of the inner circle and the edge of the outer circle.
I have a BitmapData with 2 red circles. I want to find the rectangle area or each circle. If i use [B]getColorBoundsRect[/B] I get the smallest area enclosed by the 2 circles. How can i go about this and get individual area of the circles?
I'm drawing a 3D pie chart that is calculated with in 3D vectors, projected to 2D vectors and then drawn on a Graphics object. I want to calculate the most left and right point of the circle after projected in 2d. (So not 0 and 1 Pi!) The method to create a vector, draw and project to a 2d vector are below. Anyone knows the answer?
how I can access the coordinates of an mc, but its coordinates with respect to the stage.
What I am doing is using a dragging function, but while the mouse is moving I am also trying to trace the position of the mc itself with respect to its position on the stage, but it seems to keep giving me very small numbers, almost like numbers with respect to its original position. I am not sure yet though why this is. Here is my code:
[Code]....
I have also tried to get rid of the this.x = mouseX and the same for y, but then it returns the values as undefined when i trace this.x and this.y
Excuse the title, had no idea what to call this. I'm creating a simple game with the following components (added picture for clarity):
[URL]
1. Character - The symbol in the center of the stage.
2. Level - The bounds surrounding the stage. Everything in this picture is contained within the level except for the character.
3. Water - The blue square. The water symbol is located within the level symbol.
4. Water droplet - The blue dot floating above the water. This is also located within the level symbol.
Using the arrow keys the player controls the movement of the level. While the character symbol is always located at x=275, y=200 (center stage), the level symbol's coordinates change whenever the arrows are pressed. This gives the player the illusion that they are controlling the character.
When the player makes the character symbol touch the water symbol, I want to move the water droplet to the location of the character. The problem is, I can't for the life of me figure out the coordinates I need as they will always be different depending on where the character touched the water. It's important that the water droplet be inside of the level symbol because after the player drops the water I need it to act as if it's moving with the surroundings.
tl;dr: I essentially need to find the x and y distance from the character symbol to the origin of the level symbol, keeping in mind that the level symbol's location is always changing and that both symbols are located on the stage.
What I'm trying to do is attach a bunch of movieclips onto my game table in a grid like pattern. But the game table is a circle. So I want to cut out all of the coordinates that are not inside the circle. I could sit there and map out all of these possible coordinates my self, but I'd rather have my actionscript do it dynamically.
I have a circle drawn on the screen, wherein I add a moving object. I want it to keep inside. My strategy is to calculate the circle's radius and compare it with the distance the moving object is off its center. I beleive it's the proper solution. However, I'm having a problem with letting Flash know when the running guy should stop, so he doesn't leave the circle and ruin all the fun. Here's the code I'm using (it's not working of course):
function moveTheCreaturesRightwards(event:Event) { if(maleMovingRight == true) {
[Code]....
The line: rayMale.width = maleRadius.width; was added when nothing else had seemed to be working
I'm figuring out a way to update my mouse x and y inside a loop. In this small test block, I'm tracing the mouseX and mouseY twice. The first one is outside a loop. The second one is inside a loop.
When I test the SWF, you can see that the first trace changes constantly and seamlessly. But when you hold your mouse down, the code starts tracing the 2nd trace. Even though the mouse is down and moving, the mouseX and mouseY traced is not changing.
Closely related to the main question, when you click the stage, you would get 100 lines of the 2nd trace. Is there a way to break the loop as soon as the mouse is up?
I googled for almost a day to find the answer to my question: [URL]. This almost works (and is a great solution), but the solution doesn't work when I do: 1). Copy and paste multiple-line texts. 2). Write long and scroll the texts. I also found another working example at: [URL]. (The autocomplete prompt appears when you press ctrl+space right at the caret's position). But an email from its author says he uses monotype fonts to calculate individual character's location. Is there a way to get multi-line input from a textfield?
I have a Movieclip (MC1) with and moving object (OBJ1) inside it and using AS3. I want to do a hit test on it with another object (OBJ2) that is on the stage. Normally I would just do MC1.x + OBJ1.x to get my coords for the hit test. But how do I do it if MC1 has been rotated?
My basic requirement is to draw a circle inside a BorderContainer with the layout set to BasicLayout.I run this method in the CREATION_COMPLETE event of the BorderContainer object.[code]I know I must be missing something VERY basic here. Can I just draw like this OR should I draw in some other event? I know that I can create a Ellipse object and easily add it to the border container but I would like to know how I can do this using the graphics object.
I need an algorithm to place a set of N rectangles inside a circle for radius R, so that they can scaled up to the biggest possible size that doesn't exceed the border of the circle.
I need to find all url's inside string ex. "abc [URL]. I have tried few regeps but they worked only if all string was url, otherwise regexp has no matches. I would be gratefull fo a clue or working regexp.
Q1) The registration point of a created clip is top left - my question is how can I dynamically change it's registration point - say to center center?
(I am trying to attach a movie clip to a created clip and I wanted it to be centered inside the container - a related sub-question, how can I find the x-y coordinates of the attached movie clip within the created movie clip?)
Q2)When I tried to create two different movie clips, I found I had to create them at different depths, else the first would load and the second would not. Why would that be so? I'm on MX 2004 Pro.