ActionScript 2.0 :: Coordinates Of Mc On Stage?
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
Similar Posts:
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
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
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
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
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
Apr 1, 2011
Is there a method to determine the stage coordinates of a movie clip?
I don't mean something like this:
stageX = mc.x + mc.parent.x + mc.parent.parent.x + ....
I would like to be able to determine the movie clip stage coordinates without knowing what are its parents and grandparents etc. The goal is to be able to place the movie clip on exact place on a stage, no matter what is the nesting structure.
View 1 Replies
Dec 29, 2011
I want to trigger via mouseDown a function that plays a 30 frame mc while the mouseX coordinate increases and the mouse Y decreases. Then when the mouseX coordinates decreases and mouseY increases ie. the mouse moves up on the stage - mc plays in reverse So basically the movieClip is scrolled by the mousemovement. When the mouse is not moving mc stops at currentFrame
View 3 Replies
Jan 15, 2005
i have 20 buttons, and i want to design an external file that holds the coordinates for each named button.
how would i go about this, since the external file would be read as a string by flash?
View 3 Replies
Jan 15, 2005
i have 20 buttons, and i want to design an external file that holds the coordinates for each named button.how would i go about this, since the external file would be read as a string by flash?
View 3 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
Nov 12, 2009
I have 35 movie clips named mcMyObject1, mcMyObject2, etc. to mcMyObject35Each time the playhead enters the frame this code sits on, I want all of these 35 movie clips to be placed on the stage in random orderI want each one of these 35 movie clips to land on one of these X coordinates: 57, 187, 317, 447, 577, 707, 837 and on one of these Y coordinates: 53, 183, 131, 443, 573. (It's a 7 x 5 grid)Movie size is 1024 x 768Here's my code, which doesn't work:
stop();
var myXArray=[57, 187, 317, 447, 577, 707, 837]; //cordordinates for x
var myYArray=[53, 183, 313, 443, 573, 573, 573]; //cordordinates for y
[code]......
View 8 Replies
Dec 19, 2011
I was trying to convert global coordinates to local coordinates of a UIComplenent in my flex project using below code using below code
var gp:Point = new Point(e.stageX,e.stageY); //global point
var lp:Point = uic.globalToLocal(gp); //local point
uic is UIComponent in which I have subclass of Sprite for drawing something I have set the sprite's mouseEnabled and mouseChildren to false to not interrupt the mouse event. above code is within uic's mousemove event where I was tracing the gp and lp gp was giving correct value and suprisingly lp was giving negetive values. when I move the move to the top left corner of uic i expect lp to be 0,0 but it is giving the -width of of uic. I broke my head for hours and ended up finding an alternate by using offsets. Infact my original code was much simpler like this which was same issue
var lp:Point = new Point(e.localX,e.localY);
I am not sure what exactly is causing this problem. the workaround had lot of issues and it creating a mess in my rest of the algorithms.Just now I found even more interesting thing (which is actually weird). for some reason I went and create a new lp2
var lp2:Point = new Point(e.localX,e.localY);
now surprisingly it was giving correct values as expected and I went back and changed the code as
var gp:Point = new Point(e.stageX,e.stageY); //global point
var lp:Point = uic.globalToLocal(gp); //local point
var lp2:Point = new Point(e.localX,e.localY);
var lp2:Point = uic.globalToLocal(gp);
now it is expected to have all the lp, lp2 and lp3 variables to be same but weiredly lp two is giving wrong value and lp2 and lp3 were giving correct. I am suspecting using the variable lp has something to do. I am not sure about that but above proves it so right now I am using lp2.
View 1 Replies
May 21, 2007
I was reading the 'Isometric Transformations' tutorial by Danko Kozar and I have a few questions. I understand what all the code does, but not how it does it. First of all, how does the following code work:
transforms x,y,z coordinates into Flash x coordinate
xFla = function (x, y, z) {
// cartesian coordinates[code].....
I understand that it converts 3d coordinates to 2d coordinates, but I don't understand how. What numbers whould be punched into x, y, and z to acquire certain desired effects?Also, what's the difference between moveTo and lineTo:
red line
style(1, "0xFF0000", 100);
plot(0, 0, 0);
draw(200, 0, 0);
View 4 Replies
May 3, 2010
Im making a little app in flash using papervision I want to make a regular movieClip show up in the same place as a papervision object. The coordinates seem like perspective is affecting the number displayed.
View 2 Replies
Jan 11, 2008
not sure if this is possible but i'd like to get the X,Y coordinates of a button I drag. here's my problem:
PHP Code:
public function backbuttonDown(e:MouseEvent)
{
[code].....
View 10 Replies
Jun 27, 2011
this is probably something thats solved verry easy, but I tried all kinds of google terms etc and I can't find a solution.On my stage, I have a symbol, in this symbol (button) the following code:
Code:
on(press)
{
[code].....
View 2 Replies
Feb 23, 2011
I have a movieclip inside another movieclip.[code]...
I can get mc_inside._x and mc_inside._y properties relative to the container movieclip, but how can I get the mc_inside._x and mc_inside._y relative to the _root (the stage)?
View 1 Replies
Nov 4, 2009
I am trying to change the cursor with coordinates.
I have attached the cursor to the mouse, which is a Red Circle
what I want to happen is when it gets beyond the half way point on the screen for it to turn blue.
I can do it as a rollover but I need to make it to it with if statements and coordinates.
Below is the code I have used to attache the cursor to the mouse
circle_mc.onEnterFrame = function(){
this._x = _xmouse;
this._y =_ymouse;
Mouse.hide();
};
View 6 Replies
Nov 24, 2009
I'm having a helluva time trying to figure out why I can't load a display list object, (multiple times) at different coordinates specified in my xml file.tremendous as I am not the most accomplished with AS3. Here's the code I'm working with...
for(var i:int = 0; i < xmlLen; i++){
addChild(myCapitol);
myCapitol.name = 'capitol'+ i;
[code]....
View 1 Replies
Dec 8, 2010
How can you get x and y coordinates of an instance? My instance is called "rock". This is what I have tried:
PHP Code:
onClipEvent(enterFrame){
trace(rock.x);
trace(rock.y);
}
but it does not work.Next, how can I make this instance go up by a certain angle?
View 3 Replies