ActionScript 3.0 :: Flash - Find Coordinates Of Another Movieclip On Stage?
May 4, 2011
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?
View 12 Replies
Similar Posts:
Mar 28, 2009
Okay this is always something that's puzzled me. If I create a movieclip, place that clip on the stage, then inside that movieclip, create another movieclip, how does flash determine the coordinates of that second movieclip in relation to the stage. The reason I am asking this, is that I have a large movieclip which contains a number of other smaller movieclips. When a user clicks on one of the smaller movie clips, I need the larger movieclip to move so that the clicked movieclip is now centered on the stage.
I figure that this would be easier to know if I knew how to calculate the distance which the second, smaller movieclip is from the center of the main stage in x and y coordinate values. Am I making any sense? If not I'll try to explain again.
View 14 Replies
Feb 11, 2011
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?
View 2 Replies
Feb 23, 2012
All my custom classes that extend MovieClip simply trace as "MovieClip" when using stage.getChildIndex(i); I'm trying to search the stage to see what objects have been placed and then add them to the correct array. E.g. if I place 5 "Enemies" on the screen, I want to then add them to an array by searching the stage for the "Enemies" class, without naming each one and adding it manually in the code.
Edit:
Code:
for(var i:int = 0; i < stage.numChildren-1; i++)
{
trace(getQualifiedClassName(stage.getChildAt(i)));
[Code]....
View 6 Replies
Jul 4, 2011
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.
View 1 Replies
Oct 7, 2011
I want to find out what object is at 200x300? is there a particular command for this?
View 2 Replies
Sep 3, 2009
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.
View 1 Replies
May 12, 2010
I know about Flash's localToGlobal and globalToLocal methods to transform coordinates from the local system to the global system, but is there a way to achieve the intermediate? To transform coordinates from an arbitrary system to any other arbitrary system?
I have a clickable object inside a Sprite, and the Sprite is a child of the stage. I want to retrieve the clicked point in the Sprite.
View 2 Replies
Oct 7, 2011
I have the coordinates, i just need to know what is there. Is there a simple command that will return this to me?
View 1 Replies
Nov 23, 2005
Is there any way of tracking the coordinates of a cursor in an input text box?
View 8 Replies
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.
View 2 Replies
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
Oct 8, 2011
I have a MovieClip inside a stage that is mostly(not accurately) centered to the middle of the stage.
When I try to save the MovieClip into a bitmap in order to upload it to facebook, I either get a cropped image or a white image(blank). Here is the code for generating the bitmap:
var source:BitmapData = new BitmapData(board.width, board.height);
source.draw(board);
var bitmap:Bitmap = new Bitmap(source);
The result I am getting is the yellow area in the following image:
[Code]...
View 2 Replies
Oct 22, 2010
Is there a way to find the location a clip in the library is used?
View 0 Replies
Nov 25, 2010
i can't seem to figure out this:
I have 3 coordinates on a stage.
Coordinate1 (x50;y50);
Coordinate2 (x150;y150);
Coordinate3 (x250;y250);
How to make a movieclip (or button) appear on one of theese coordinates randomly when loading flash?
Coordinates don't change but movieclip (or button) goes to one of theese positions upon flash movie starting.
View 6 Replies
May 17, 2011
If I have a rectangle on the stage, how do I find its top left tip (x,y) and the bottom right tip (x,y) in relation to the stage?
View 2 Replies
Jun 23, 2011
I have a button that I cant link. This was the correct code for the movieclip.
Code:
MovieClip(this.parent).tint_mc.gotoAndPlay("on");
Only now I have a button inside a movieclip. And Flash cant find my button from the mainstage. I tried
Code:
Button(this.parent).fac_btn.addEventListener(MouseEvent.CLICK,link);
View 1 Replies
Jan 21, 2011
I'll give a complete explanation of what I'm trying to do. I have a video player as a separate SWF. In this video player I have a VideoContainer class extending Sprite, which contains the video and a control bar with specific video buttons.
This SWF is loaded in another main SWF, which has a menu that is on top of everything else. When I click "Fullscreen" in the video SWF, everything goes smoothly, except the menu remains on top of the VideoContainer object.
I need a way to change the display order of the loaded SWF, to put it on top of everything else on Fullscreen and change it back when Fullscreen goes off. All this needs to be made inside the video player. Also, the configuration of the children can change (the video player can be loaded in different places in the main SWF), so I can't use a certain unchanging path.
View 2 Replies
Jul 22, 2005
I have a whole stack of tile instances arranged in a grid on the stage. Each mc has a button in it. All I want is when the user clicks the 'mc', to return the coordinates of that mc relative to the main stage. I've tried _root, _parent ... everything.
Does each tile have to be named? Of course I have been able to find the coordinate if I name them all but I'm dealing with about 600 of them. Also, they are arranged in a weird way that I can't use AS to generate it at runtime. Check out the attachment and you will see what I mean.
View 2 Replies
May 21, 2011
movieclips in flash have a Rectalge Zone . if we have a Circle shape and covert to movieclip , have a Rectagle Area.with empty area.
i want terminate this area when az drag any moveclip on my target movieclip. when i use hitTestObject do now work good.
View 1 Replies
Dec 5, 2007
Okay picture an mc embedded in an unknow amount of parent mcs. With the code put on the mc, I tried this:
Code:
trace( _root.stageX(this) );
where it is defined on the main timeline as:
[code]....
View 1 Replies
Sep 29, 2011
Is it possible to change the coordinates of a project so that is it more like a graph?
Eg. The center of the page is 0,0 and the bottom is -200 and the top is 200
View 4 Replies
Oct 22, 2011
I need to show a an objects coordinates on stage as it moves across the screen.
View 2 Replies
Oct 7, 2010
I have a graphical component and I am trying to obtain it's coordinates relative to the stage by using the localToGlobal or contentToGlobal methods.
My problem is when scrolling a Container, these methods do not return the correct values, but return the old unshifted coordinates of the graphical component. Later, after everything seems stable, when trying to use the methods they return correct value so this means at the time where I use them after scrolling not all information necessary in computing have been commited.
For the case of the Container class I have investigated and although it passes through the scrollChildren method, the computation is wrong.For the case of the Tree component when scrolling with the wheel, the methods return correct value, but when pressing the arrow button of the scroll-bar the methods return incorrect value.
Until now I have tried to listen the scroll and the update complete events when they are dispatched but without any success. So my problem is that after scrolling I would need to know a moment(event to be listened or something else) that I can call the methods and the output to be ok.I would like the final solution to be uniform.
View 1 Replies
Oct 22, 2011
I need to show a an objects coordinates on stage as it moves across the screen.
View 2 Replies
Jul 8, 2009
I am building a project where I have 15 'islands' inside one big 'ocean' movie clip. I created navigation buttons so you can explore the Ocean movie clip and look around the islands. my problem comes when i want to 'zoom into an island'
So basically on the stage i have a movie clip called- Ocean_mc, and inside it are 15 movie clips, one of them (for this example) is a movie clip called GreenIsland_mc.
when a user clicks the GreenIsland_mc it needs to expand and place itself centre stage, then when clicked again in needs to colaps back to where it came from. The problem is that when GreenIsland_mc expands it needs to expand to coordinates relative to the stage, but when I shrink it back again it need to find the original coordinates relative to its place inside the Ocean_mc movie clip.
[Code]...
View 1 Replies
Jul 16, 2010
I am trying to scale a movieclip with AS3, but always using the center of the stage as the registration point. The movieclip is larger than the stage to begin with, and uses a slider component to slide back and forth. I'd like to be able to scale the movieclip using a button, but it currently uses it's own registration point (upper left corner) as the source.
Is there a way to force the scale to use the center of the stage?
View 3 Replies
Dec 26, 2010
exactly as the title says, or is there a way to call up its original x,y coordinates like box_MC.originalX or something?
View 5 Replies
Aug 12, 2011
Is there a way to check an objects x,y coordinates based on where it is on the stage, vs. where it is in the movie clip that is on the stage?
need this to compare with the mouse for instance.
View 2 Replies
Oct 14, 2011
I've a button on the stage called "closedbt" that i have to move near an image. This image is nested into a MC named "gallery", then it's coordinates are different from the rest of the stage.
View 4 Replies