Actionscript 3 :: Finding Out Coordinates Of Drawn Objects In Flash?

Jan 6, 2010

I'm in the process of making a board game in Flash; as part of process of getting fully to grips with Flash AS3.

I have a JPEG of the original board. This contains ~ 1000 circles that players may move pieces between. Pretty standard board-game stuff. The circles are not in any way regularly spaced.

So far, I've drawn the circles in Flash, by hand, and positioned them where they need to be. This looks great - I can see all my places.

What I want to do now is create these circles programatically. I want to be able to do this so I can adjust how the spaces look (depending on game state). Eventually I'll want to be able to zoom / pan the entire game board as well.

My question is, is there a way of tagging each circle with a unique reference and then looping through and recording locations?

I'm thinking something a bit like the Javascript DOM "getElementsByTagName" or similar.

At the moment I can only see two options:

Convert each circle to a symbol and give it a unique class name so I can access it from code Go through and write down the X/Y of each circle (add to my DB of board locations that I already have) so I can plot them programatically

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Finding Coordinates With 2 Objects

Nov 30, 2009

I get the feeling the title is misleading... What I try to achieve is quite simple (at least it sounds like a simple thing to do). I am trying to find the intersection of 2 objects in relation to each other. One of them is the character for my game, and the other is the obstacle (the floor, a barrel, etc). I need to find the coordinates of the character in relation to the obstacle. Here's a picture to make it a bit clearer:

Here the coordinates (and the cross) represent the origin of my objects, and the two squares are my character (twice to better represent the multiple possibilities). The number after the slash for the square is what I should get as the .x when my character hits the obstacle. I tried using getBounds(), but I really don't know about it and tried stuff based on the little knowledge I have about it (I won't post the code here, first it was horrible, and it also didn't survive the rage I had trying to get this to work...).

[Code]...

View 4 Replies

Flex :: Objects Drawn By Flash Graphics Class Exist As Objects?

Jan 16, 2011

Internally Flash obviously keeps a list of the primitives drawn using Graphics so I wondered if you have many such primitives in a Sprite, can you re-position/remove/alter individual items rather than clear and re-draw everything? Or is this deeper into the bowels of Flash than you're allowed (or recommended) to go?

View 4 Replies

Flash :: Finding Closest Object In Proxmity To Mouse Coordinates

Mar 30, 2010

i've been working on a problem for a while now, which involves targeting the closest movieClip in relation to the x y coords of the mouse, I've attached a nice little acompanying graphic.Each mc added to the stage has it's own sub-class (HotSpots) which uses Pythag to measure distance from mouse. At this stage i can determine the closest value from my Main class but can't figure out how to reference it back to the movieclip... hope this makes sense. Below are the two Classes.My Main Class which attachs the mcs, and monitors mouse movement and traces closest value.[code]

View 3 Replies

Actionscript 3 :: Flash - Drawn Objects Are Not The Same

Mar 17, 2012

I'm playing with Open Flash Chart. Take a look at this chart: [URL] As you can see, the rounded dot points look ugly. Some of them are more rounded, some of them less, they don't look the same, as they should. I don't know AS3 and have no idea what is the case. I checked the source code:

[Code]....

View 1 Replies

ActionScript 3.0 :: Recover Coordinates Of Points Drawn With LineTo

Jan 20, 2011

I am developing a software in flash in which I need to draw some points in a movie clip dynamically with moveTo() and lineTo() during the runtime of the software. However, later in the future (during runtime), given the (x,y) coordinates of a point, I need to know if this specific point is part of the curve I drew before. Is there a way of doing that without saving the (x,y) coordinates of all the points I have drawn in the movie clip?

View 0 Replies

Finding The Mouse X And Y Coordinates?

Apr 18, 2011

I'd like to use the x and y mouse coordinates as variables in a program. I'm very new to Flash and ActionScript and I'm not even sure which classes I need to import or which listeners or handlers I need to use.

View 1 Replies

Finding Object At X And Y Coordinates

Oct 16, 2009

We have a client server architecture where a C++ server talks to Flash clients. I'm developing the server and would like to send through tcp an xy coord to simulate a button press where the receiving flash client would find the topmost visible object at that coord and send a mouse event to it such that we could simulate play without a human present. I'm told this is incredibly difficult, but it seems to me that there must be a way to do this. Am I off the mark? Or is there a mechanism in flash to iterate through all objects regardless of parent child relationships to find a visible button at an x, y coord and signal a press event?

View 2 Replies

ActionScript 2.0 :: Finding X And Y Coordinates Of A MC

Oct 6, 2011

I have made a few posts now, and I'd like to especially Prid for not only answering them, but for giving me guidance on how to learn AS2. I am progressing very nicely, and have made a couple of simple games without any tutorials, but theres one thing I couldn't find. I have this character which can move, up and down, left and right. I also have an enemy trying to shoot at him. However, this enemy needs to know where the character is. I already have the shooting code (Prid), but it was for shooting in the direction of the mouse. What I need now is to replace the bit of code that finds the mouse coordinates with code that finds the coordinates of the player.

The shooting code is on the frame (doubt that is important to say, but still) and the instance AND name of the Character is, well, Character. So basically, I need a code to calculate coordinates of a movie clip that does not have a fixed position. Oh and one more thing, should I post simple stuff like this in the beginner section, because I've seen waaay more complicated stuff there than in the AS2 section.

View 9 Replies

ActionScript 1/2 :: Finding Coordinates Of A Color?

Jul 1, 2010

what i am trying to do is find the coridanates of anywhere there is the color red and save this in 2 variables. one  for the corodanets of the color on the x axis and one of the corordonates on the y axis.

View 7 Replies

ActionScript 2.0 :: Finding (X And Y) Coordinates For HitTest

May 5, 2010

I have a line dynamically drawn in a coordinatesystem. The line is drawn by the user. Now I wonder if there is a way to find out where the line crosses the y-axis. I know about hittest but how can I get exacltly where (x- and y-coordinates) for the hitpoint?

View 0 Replies

ActionScript 2.0 :: Finding Movieclip Coordinates?

May 19, 2009

for some reason whenever i call or define a variable like this:

Code:
onClipEvent(enterFrame){trace(k); k = go._y;}
the trace results in "undefined". dose anyone know why and how to get around this issue? it

[code]....

View 1 Replies

Flash :: Flex Render Culling Objects Not In View To Stop Them Getting Drawn When Not Needed?

Oct 27, 2010

Does anyone have any knowledge (preferably with links to make it official) about how/if Flash/Flex culls objects not in view, to stop them getting drawn when not needed? A specific cases: I have an 800x600 panel (a Canvas or Sprite, or other container) containing loads of Sprites representing individual game objects like asteroids or spaceships or missiles or map-tiles. The game world might be 5000x5000 so can I naively position Sprites anywhere in this range and let Flash cull them effectively? Or do I need to manage visibility somehow at a higher level (like manually removing them from the parent) to avoid performance issues?

View 1 Replies

ActionScript 3.0 :: Finding Stage Coordinates Of Point Inside Rotated MC

Jun 5, 2011

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?

View 2 Replies

ActionScript 3.0 :: Moving MovieClip In Perfect Diagonal - Finding Coordinates

Mar 2, 2010

Imagine two movieclips, both on the same Y axis. I want one MC to be able to diagonally move to the other MC X axis, all while making a perfect diagonal line until it reaches 100y. So just like this picture, that MC moves in a perfect diagonal until it matches the other MC.x, and 100y (no matter what, it can't go past 100y but must equal 100y). I probably made it sound more complicated than it is.

View 2 Replies

ActionScript 3.0 :: Flash Finding Nearest Point Of The Outside Of Two Objects

Aug 8, 2011

[Code]....

two balls are stationary on stage and I am dragging ball 1 between them. I want my program to deny the ability to do this (technical terms) and move the ball automatically to the closest point available that does not overlap either of the other two balls i.e. the left side of the dragged ball may touch but not over lap ball 3. I have a feeling the circular equation: (x-a)^2 + (Y-b)^2 = c comes into it but it may need pythagoras instead as the balls are all circular but not all the same size. The best way I can see for this is to write a multi-part equation for the bounds of boths balls and then finding the nearest point, but not sure how to do this in as3, perhaps using the 'for each' tag.

View 3 Replies

Actionscript :: Resize, Move, Export Coordinates Of Objects In Flash?

Jan 19, 2011

How would I place objects in flash, moving and resizing them, etc. and then export coordinates/rotation to a text file or something like that?

View 1 Replies

ActionScript :: Flash - Continuously Dragging Objects Within Bounds From Off-Stage Mouse Coordinates?

Jul 2, 2010

is it possible for flash to detect off-stage mouse coordinates in order to continuously drag an object within its bounds while the mouse is moving outside of the stage? for example: i have a draggable red square on my stage. the stage is the bounds of the drag. if i drag the red square to the bottom of the stage and continue to drag outside of and around the stage, i'd like the red square to continue moving within it's bounds, following the mouse coordinates. currently, dragging halts as soon as i leave the stage and the red square only begins to move with the mouse coordinates if i reenter the stage bounds.

View 2 Replies

ActionScript 3.0 :: Duplicating User Drawn Objects?

Feb 20, 2009

I want to duplicate objects that users have drawn. I set up a pencil class and added those drawings to a container. I tried duplicating the container , which worked, but did not duplicate the drawing. Only the container. I know I'm missing some vital piece of information here.in DOC class:

Code:
public function Seed():void{
grow1.addEventListener(MouseEvent.CLICK, onGrow, false,0,true);

[code]........

View 0 Replies

Actionscript 3.0 :: Get Objects To Follow A Path (a Drawn Line)?

Mar 30, 2010

is there a way using AS3 to get objects to follow a path (a drawn line) or will i have to set waypoints?

View 3 Replies

ActionScript 2.0 :: Building A Dynamic Content Page In Flash That Consists Of Using AttachMovieClip And CreateEmptyMovieClip With Coordinates To Place Photos And Objects

Oct 15, 2006

I'm building a dynamic content page in flash that consists of using attachMovieClip and createEmptyMovieClip with coordinates to place photos and objects, which are loaded from an external source and scrolling their thumbnails I've run into a problem setting the variables correctly because the scrolling thumbnails required that the thumbnails be nested inside a scrolling controller clip and that has somehow messed up my preloading and sequential text caption loading for the tumbnails.

View 4 Replies

ActionScript 3.0 :: Display Objects Drawn To Bitmap Always Dispatches Rollover / Rollout

Apr 12, 2009

If you draw a movieclip (with a 3d rotation on it) to bitmap, eventlisteners will always dispatch rollout and rollover for that movieclip (on mouse over). A solution could be to set the matrix3d = null ,draw, and then apply the original matrix3d, but I can't do this in my project 'cause all clips is a 3d object to a parent 3d object that gets drawn to a bitmap every frame.

To see the bug, copy this example code into the first frame on the stage (CS4 flashplayer 10).
var bmp:BitmapData = new BitmapData(100, 100); //setup a dummy bitmap
var bmpContainer:MovieClip = new MovieClip;
bmpContainer.addChild(new Bitmap(bmp));
var box:MovieClip = new MovieClip;
addChild(box);
[Code] .....

View 1 Replies

ActionScript 3.0 :: Finding All Objects In The Movie?

Jan 30, 2011

Is there any way to find out about all the objects being on the stage?I mean, all nested in other movieClips or Sprites too.I can find children of specific object by looping it with getChildAt(), but of course I would have to do this for all the objects in their levels that they are nested in..

View 2 Replies

ActionScript 2.0 :: Finding Objects Within Area?

Nov 13, 2006

need a method of finding all the objects over the top of another object...

I realise I could use hitTest to check if something is intersecting, but I can't use it to find the names of the said objects. I also realise I could just cycle through all the objects on the stage and calculate it that way, but considering there's over 300 objects that could 'possibly' be covering this particular object, thats a lot to calculate, and i'd like it to be snappy...

View 1 Replies

ActionScript 3.0 :: Capturing X,y Coordinates For Two Objects?

Mar 29, 2010

I have two columns of objects on stage, one on the left side column (A) and one on the right side (column B). Each column has 3 objects in it. For this quiz I want the user to be able to draw a line from each object in column A to the corresponding object in column B.To do this I need to capture the xy coordinates of the first object that the user clicks on and then capture the coordinates of the 2nd object the user clicks on so that I can draw a line between the two of them. Drawing the line is no problem but how do I capture the coordinates of the first object selected and then the 2nd object selected? This is as far as I've got with the code.

var clip:Shape = new Shape()
var startX=0
var startY=0

[code]....

View 1 Replies

ActionScript 3.0 :: Moving Objects Using X,y Coordinates?

Jun 23, 2009

I have a MovieClip on my stage. Inside the MovieClip there are a few buttons (all MovieClips also) and a mask layer to keep anything on the outside invisible.

Problem: My MouseEvent fires and should move objectA into position over objectB. All code in the script tells me it has moved. Tracing the x,y coordinates of objectA also tells me it has moved. The Alpha on objectA is 100% and it is positioned on the topmost layer beneath the mask layer. All this tells me that when the object moves, it should be visible on the stage (the event moves the object into the masked area). Testing disproves everything. The traces all tell me the object is where it is supposed to be but it cannot be seen. I don't understand this and it, amongst other AS3 hiccups, is seriously turning me off Flash as it seems to be a waste of time to try and learn as it seems like 90% of the scripts written will fail 90% of the time.

View 3 Replies

ActionScript 3.0 :: Get Objects Absolute Coordinates?

Oct 2, 2010

My stage contains an object that contains a child. The child sees it's x and y position in relation to it's parent, so when the object moves, the coordinates remain the same.

How do i get a child's coordinates relative to the stage?

View 3 Replies

Actionscript 3 :: Showing An Objects Coordinates On Stage?

Oct 22, 2011

I need to show a an objects coordinates on stage as it moves across the screen.

View 2 Replies

ActionScript 3.0 :: Showing An Objects Coordinates On Stage?

Oct 22, 2011

I need to show a an objects coordinates on stage as it moves across the screen.

View 2 Replies

Actionscript 3 :: Objects Coordinates Relating To A Frame On A Timeline

Mar 16, 2012

I am looking to create an animation (perhaps frame by frame) that corresponds with the coordinates of an object. Specifically, I want to have a draggable object's coordinates (locked to the x-axis) indicate where the playhead of a specific movie clip should be. In other words, let's say that I have a 100px wide stage and I want each px location of an object on that stage to correspond to a particular frame of a movieclip. In concept, I feel that it should be as easy as loading an objects coordinates into a variable, then passing that variable on with a simple math equation, adjusting it for movieclip length... but right about then my brain gets fried. Finding out how to lock a draggable object to the x-axis has been pretty easy, but from there I'm stumped. I'm not particularly well versed in AS3 but I do like to think I understand the concepts.

View 1 Replies







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