ActionScript 3.0 :: Tell If An Object Is Within A Dynamically Made Circle?

May 7, 2011

Essentially what the project consists of is I have random balls appearing on the screen and moving around and I need to make it so that the user is able to draw a circle around the ball (may be more than one) and have that balls dissapear and count the number of balls circled.

This project is being done in flash builder 4.5 and is being made for the android platform as part of a senior project.

At this point this is where I am.. I have been able to randomly create the balls and give them a random movement. I have also been able to figure out how to allow the user to draw on the screen.

What I am trying to figure out is how to make it so that if the user draws a circle around the balls make it so that I know these balls have been circled and make them dissapear and have the number of balls inside the area calculated.

I have thought about making the entire background a grid and make it so that I can track somehow the line made by the user and then track the coordinate of the balls then if it is within that area it means that the ball has been circled but I would like something more efficient than that.

I apologize if it is unclear for what I am looking for but a simple description is I am making a simple game where you are able to circle a moving item on screen, then once it is circled the item disappearsand you gain a point.

View 5 Replies


Similar Posts:


ActionScript 3.0 :: Object Is Within A Dynamically Made Circle?

May 7, 2011

Essentially what the project consists of is I have random balls appearing on the screen and moving around and I need to make it so that the user is able to draw a circle around the ball (may be more than one) and have that balls dissapear and count the number of balls circled.This project is being done in flash builder 4.5 and is being made for the android platform as part of a senior project.I have been able to randomly create the balls and give them a random movement. I have also been able to figure out how to allow the user to draw on the screen.

What I am trying to figure out is how to make it so that if the user draws a circle around the balls make it so that I know these balls have been circled and make them dissapear and have the number of balls inside the area calculated.I have thought about making the entire background a grid and make it so that I can track somehow the line made by the user and then track the coordinate of the balls then if it is within that area it means that the ball has been circled but I would like something more efficient than that.

View 1 Replies

ActionScript 3.0 :: How To Tell If An Object Is Within A Dynamically Made Circle

May 7, 2011

Essentially what the project consists of is I have random balls appearing on the screen and moving around and I need to make it so that the user is able to draw a circle around the ball (may be more than one) and have that balls dissapear and count the number of balls circled. This project is being done in flash builder 4.5 and is being made for the android platform as part of a senior project.
 
At this point this is where I am.. I have been able to randomly create the balls and give them a random movement. I have also been able to figure out how to allow the user to draw on the screen. What I am trying to figure out is how to make it so that if the user draws a circle around the balls make it so that I know these balls have been circled and make them dissapear and have the number of balls inside the area calculated.
 
I have thought about making the entire background a grid and make it so that I can track somehow the line made by the user and then track the coordinate of the balls then if it is within that area it means that the ball has been circled but I would like something more efficient than that.  

View 2 Replies

Flash - Dynamically Made Sprite Object Has Margin/Padding On Bottom?

Sep 18, 2010

I'm made an Item class which extends the Sprite class, the Item class basically has a few checkmarks & labels at the moment.

Then what I try to do is run through a for loop of items and create Item classes that I want to place one after each other on the y-axis, so I'm reading the Item.height property to find the y of the next Item in the list.

The problem is for some reason there is always an extra 75 pixels added to the Sprite height at the bottom, no matter how many checkmarks and labels are in each Item class ( varying the height of the Item class ).

Any idea why this is being added and how it can be removed?I'm having trouble figuring this out, I tried dynamicly calculating and setting the Item.height property but when I do that the Sprite is simply cropped.

View 1 Replies

ActionScript 2.0 :: Dynamically Moving An Object Along A Circle Motion Guide

Jul 5, 2005

I'm trying to move an object along circlular motion guide dynamically using two buttons -- a left button, when pressed down, will move the object counter clockwise, and the right button clockwise.

View 2 Replies

ActionScript 2.0 :: Separate Objects Are Made, Object A And Object B?

Nov 11, 2008

Inside the attached .rar Two seperate objects are made, object A and object B, but they share the same variable (only works with arrays) even though they aren't linked in any way. Any changes made to A is reflected in B, and vise versa.

How would I go about fixing this issue? (SIMPLY, aka I don't want to write a class or whatever, I just want to know if I am doing something wrong, like not writing new or something)

View 2 Replies

ActionScript 3.0 :: Sphere Made Up Of Dynamically Loaded Images

Nov 6, 2009

I am currently building a sphere of images that I'm trying to load from a remote location using XML. I managed to find the source for the sphere and was able to figure out how load the XML into an array of image details.

My problem is that the sphere is made up of images that were loaded into the library and I'm trying to load them in dynamically, i got all the information from XML but i don't understand how to make these dynamic images the same as the ones in the library so i can instantiate the image object.

thumbsArray[0]=[new Bitmap(new Small1(thumbWidth,thumbHeight))];

Small1 = the name of one of the image in the library that makes up the sphere. if i go to the properties of this Small1 image i noticed that its class is called Small1 too. I don't understand this as iv never seen this in actionscript 2.0.

The code below is my attempt at making a image loader object to a bitmap object, that doesnt seem to work my bitmap object becomes null, and throws an error.

SYNTAX / CODE:

function getLoader(url) {
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, completeHandler);

[Code]......

View 0 Replies

ActionScript 2.0 :: Dynamically Drawing A Circle?

Apr 24, 2003

How can I draw a simple circle using actionscript?

View 10 Replies

ActionScript 2.0 :: Creating A Circle Dynamically?

Dec 29, 2008

I need to create a circle dynamically in as 2.0, i.e., when i drag the mouse downwards the circle should get bigger and when i drag the mouse upwards the circle should reduce smaller according to the radius of the circle it should resize.

View 1 Replies

ActionScript 3.0 :: Dynamically Fit Text To Circle/Oval?

Jun 9, 2011

Just a quick question today, is there any way to quickly and simply fit a string of text into a circular shape? Almost as if the text field was circular instead of rectangular. I have been working on a game where the text is presented in a series of speech bubble shapes, and previously I've had to manually insert " " around the text to get it to fit. This was a bit of a hassle but overall not too much extra work. Now, however, the game has been translated into 14 different languages and I sure as hell am not going through all that text to sort it out again haha

If there's no quick and easy way to do it (I don't really want to go down the route of using a loop to search for the last space in the first X characters and inserting a new line, etc) I'm just going to contact the artist and ask him to make the speech bubbles rectangular lol I did a google search to see if I could find anything but most of the stuff I found either wasn't relevant or said "there isn't an easy way to do it yet" but I just wanted to check here first.

View 3 Replies

Flex :: Dynamically Spacing Numbers Around A Circle

Jan 30, 2010

I'm trying to figure out how to dynamically place numbers around a circle (similar to a clock face) but dynamically so if the number of numbers around the circle is 5 or 27.. they would space out correctly. I found some code (below) that looked like it might help but I'm having trouble implementing it. I don't know how I actually tie this back to the circle and numbers.

[Code]...

View 1 Replies

ActionScript 3.0 :: Dynamically Draw A Cemi Circle

Aug 24, 2009

I have a requirement wherien a semi circle has to be drawn. The circle radius can be chosen/varied by the user. How can i do it dynamicaly using action script.

View 1 Replies

ActionScript 2.0 :: Dynamically Drawn Circle - How To Fill With Some Color

Jul 7, 2010

I am trying to dynamically draw a circle and fill it up with some color. Drawing a circle is pretty easy job for me, but fill it up with some color seems not happening today.

PHP Code:
Circle function starts
function fnDrawArc(mc,x,y,r,angle){
mc.beginFill(0xFF0000); // this is not working....
mc.moveTo(x+r,y);
for(i=1;i<=angle;i++){
[Code] .....

View 1 Replies

ActionScript 3.0 :: Place Text On A Path Or A Circle Dynamically?

Jun 18, 2009

I want to place dynamic text, enteed by user, on an arc of a circle. I have written a code for it but not able to get exactly what i want. The text is rotated and placed on an arc but the rotation and placement is not that accurate. Anyone who can point me to some example or tutorial where it has already been implemented?I came across a flash component but it is paid : [URL]..

View 1 Replies

ActionScript 3.0 :: How To Dynamically Create Radial Gradient In Circle

Dec 10, 2010

I've been trying to learn just now how to dynamically create a radial gradient in a circle. All the pages that I can find use the command 'beginGradientFill', but when I use it I get the following messages:

Warning: 1060: Migration issue: The method beginGradientFill is no longer supported. For more information, see the Graphics class..
and
TypeError: Error #1006: beginGradientFill is not a function.

Unfortunately I can't seem to find the replacement, or any other pages that describe an alternative to that function. What is the way to do a radial gradient now?

View 3 Replies

ActionScript 3.0 :: If Pixel Calculations Are Made Swf Files And When They Are Made To Fullscreen

Apr 29, 2009

Anyone let me know wether if pixel calculations are made swf files and when they r made to fullscreen wether they will remain the same in any monitor size?

View 1 Replies

Actionscript 3 :: Listening To Changes Made To Flex Date Object?

Nov 24, 2011

I have a date object and I want to listen to any changes made to it. The changes can be made by either directly assigning another date object

var newDate:Date = new Date(2009,10,9);
date = newDate;

and by using

date.setTime(timeInMilliSeconds)

I tried using BindingUtils.bindsetter:

var myWatcher:ChangeWatcher = BindingUtils.bindSetter(updateDate,date,"time");
private function updateDate(value:Number):void
{
trace(value);
}

but this doesn't seem to work. I wish to know what am I doing wrong or if there is someother way to do this.

View 2 Replies

ActionScript 3.0 :: Output / Dump A Custom Made Object

Aug 27, 2009

Well this is strange:

ActionScript Code:
var myObject:Object = {firstName:"Alf", age:34, city:"Oslo"};
for (var prop in myObject) {
trace("myObject."+prop+" = "+myObject[prop]);
}

This will output all the properties of the object, but if I make my own class object it doesnt work at all! Simple.as:

[Code]...

View 0 Replies

ActionScript 3.0 :: Access An Object That Has Been Made In A Class In An External AS Document

Sep 12, 2009

I'm using the following code to arrange indexes of objects on the stage the only problem is I can't access an Object that has been made in a class in an external AS document. if i go into the document and trace I can see it but i can't access it from the document class and arrange its index anybody have any ideas?

[Code]...

View 1 Replies

Actionscript 3 :: Dynamically Draw Circle Preloader Error 1061 When In Document Class

Oct 31, 2011

how to make a dynamic unfilled and filled circle. that will take input from a slider to dertermine how much of the circle is drawn. I wanted to use this for a preloader. Unlike the author I would like to use it inside of a document class. I am getting 1061: Call to a possibly undefined method createEmptyMovieClip through a reference with static type document. and 1120: Access of undefined property circ1. The second is caused from the first. How would I get this to work in my document class?

//original code
// x: circles center x, y: circles center y
// a1: first angle, a2: angle to draw to, r: radius
// dir: direction; 1 for clockwise -1 for counter clockwise

[Code].....

View 1 Replies

Javascript :: Intercept The Response Of An Ajax Http Request Made By A Flash Object ?

Feb 24, 2012

I want want to intercept the response for an ajax request made inside a flash object via javascript.

View 3 Replies

ActionScript 2.0 :: Creating 10 Circle Movie Clips Dynamically And Giving Each Of Them A Width And Height Randomly?

Mar 8, 2005

i am creating 10 Circle movie clips dynamically and giving each of them a width and height random from 1 to 50, I am creating these CELLS to react to eachother in an environment that I create, well anyway everything is going good but this, SPEED

i would like the smallest cells to have a speed of .05 and from then on the larger the cell the smaller the speed, Every ... property i guess you could say... of the cell is proportional to it's width.

View 4 Replies

ActionScript 2.0 :: Make An Object Move In A Circle?

Apr 14, 2004

Does anybody know how to make an object moving in a smooth circle?

View 9 Replies

ActionScript 3.0 :: Square Object In The Middle Of Circle?

May 28, 2010

I have a square object in the middle of circle.and i can move square object using up, down, left, riht arrow keys. I need script for when square object touches circle, then it goes to back, I have use for this below code :

var myobjdim:Array=new Array;[code].....

In above code "myobjdim" is square object and "bg1" is circle object..

View 1 Replies

ActionScript 3.0 :: Keep A Moving Object Inside A Circle?

Apr 24, 2010

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

View 3 Replies

ActionScript 3.0 :: Position Object Along Edge Of Circle

Oct 21, 2010

What I'm doing is taking an image and "folding" it into a cylinder. I am then placing smaller images at certain points in front of that image. The large image isn't big enough to make a decent-sized cylinder, so I had to use it twice, which is fine. So now I need to create doubles of every small image that goes in and place them at opposite points (from the top perspective) in the cylinder.

Here's my problem: I want my inputs to be a simply x and y representing where the object would be if it were overtop of the flat large image. I take those inputs and (attempt) to convert the x coordinate into an angle, with which I can calculate the object's x and z position, as well as its y-rotation. However, my input range seems to be much more limited than it should be. The problem seems to lie in my angle calculation, since the others are pretty standard. Here's what I'm using right now:

[Code]...

View 0 Replies

ActionScript 2.0 :: Make An Object Spin In A Circle?

Aug 7, 2003

i use this to make an object spin in a circle

onClipEvent (load) {
this._rotation = 10;
_x = 260;

[Code].....

Now what i need to know is how can i make a sentence for example "welcome to blah blah blah blah" go around in a circle i already try using Dynamic text and wrap the word but only thing i get is the whole sentence just going around with out going around following each other.

how to make an object spin in an 360 degree sorta like sureshot's site.

View 3 Replies

ActionScript 2.0 :: Using Hittest For A More Irregular Object Than A Circle?

Dec 15, 2004

ive recently made a game in which you have to avoid some big evil round planets. i found out the in the making of that that using the function hittest uses square objects. i dident bother much then with it, i just brought out the ol'e algebra book and looked up the distance formual and made my own hittest. now my questyion is is there a more refined way of using hittest for a more irregular object than a circle.

I made somewhat irregualr objects have hittest boxxes so that it was split up into many smaller parts, this gets kinda tedious if its really irregualr or if i need to move it around on the screen btw if anyone wants ta c the game i made [URL] avoid everyting , and shop at the store on the planet , u can go over the big planet in lower left corner but not the ones in orbit a few bugs still like only way to restart is the reload button in browser

View 2 Replies

Flash CS5 - Moving Object Around In Circle One Degree At A Time

Aug 2, 2011

I have an object called point that I can move around the screen with my mouse. This object has a vector mapped through it (_v1) using the center of the stage and "point"s x,y location in order to draw the vector (note all of this is working fine). My problem is occurring when I set up was a button that simply sets a value to true if you press it. The idea behind this button is that when pressed, whatever location "point" is at, it will move 1 degree clockwise in a circle around the center of the stage (this is all happening in the frameHandler so I can keep clicking the button to make it continue around the stage).

The code I am using is based in an if statement listed below:
if(clockwisePressed) {
var v1angle:Number = _v1.angle;
v1angle++; //increase the angle by 1 degree
if(v1angle>180) {
v1angle -= 360; }
[Code] .....

So what is happening here is that clockwisePressed has been set to true so this fires off. My vector (_v1) is set up to tell me the angle (already converted from radians to degrees) but it's a read-only value. So I assign it (_v1.angle) to v1angle so I can mess with it and increase it by 1 so I'm moving clockwise around the center of the stage. Then I just check to make sure that it falls into a range between -180 and 180 (if I trace _v1.angle around the stage, 0 degrees is to the left, 90 degrees is straight up, 180 degrees is to the right, and -90 is straight down). Now using the formula I derived from this thread but converted to work with 0 degrees pointing to the left and the value for Y going up the further down the stage you go, I came up with

x = centerX - radius * cos(angle)
y = centerY - radius * sin(angle)

Now when I make a sample chart on paper and use these values on my calculator, this works like a charm. If I plug in an angle, the radius, and center I get a point right on my circle I draw on a sheet of graph paper. However, when I actually try this in flash, the "point" jumps all over the stage. (Note that _v1.m is just the magnitude of the vector between the center of the stage and "point" which is the same as the radius). So I trace everything and the values for cos and sin don't seem to be coming out right. For example, if my angle is -1.9581 and I take the cos of that on my calculator I get something along the lines of 0.9994 but flash traces Math.cos(angle) to be -0.3777. Isn't using Math.cos(-1.9581) the same as putting -1.9581 into your calculator and hitting cos?

Below is the corrected code that works:
if(clockwisePressed) {
var v1RadAngle:Number = Math.atan2(_v1.vy, _v1.vx); //get angle in radians
v1RadAngle += 0.0174; //increase the angle by ~1 degree more or less
//Now just move the crosshair and get it ready to be redrawn
point.x = centerX - _v1.m * Math.cos(v1RadAngle); //_v1.m = radius
point.y = centerY - _v1.m * Math.sin(v1RadAngle);
clockwisePressed = false; //remove button pressed boolean
}

View 1 Replies

ActionScript 3.0 :: Collisions Between Moving Circle And Rectangle Object

Oct 9, 2010

In AS3 is there an easy way for collisions to take place between a moving circle and a rectangle object. A moving circle has a direction and you need to know how it collides with an object rather than knowing it just hits. In .net you use a points test where you test several points around a circle to see what hits an object and then you can work out what direction it will bounce off.

View 2 Replies







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