ActionScript 3.0 :: Determine Absolute (stage) Coordinates Of A Movie Clip
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
Similar Posts:
Oct 27, 2009
What is the simplest way to determine absolute object coordinates in AS3?
View 1 Replies
Oct 30, 2009
I have a series of movie clip images lined up horizontally inside a parent clip on stage.I need to move the clip left/right and keep a certain portion of the content it on screen the whole time. Like a horizontal scroll bar but with buttons.When you've gone too far to the left... the content container should stop - and vice versa.
View 0 Replies
Apr 13, 2011
I have a group of movie clips, each placed randomly on the stage. I want to be able to click one of the movie clips and move them around. They are stored in an array.
View 5 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
Oct 23, 2010
it seems simple enough but i have no idea on how i could get a movie clip to slowly move to the coordinates of another existing movie clip
View 5 Replies
Mar 26, 2006
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.
View 4 Replies
Jan 27, 2009
im adding some button movieclips to a swf and for some reason its programmed to always have the dynamic hovers on top, i need to add a few static buttons on top of the dynamic hovers. here is what i tried but it still isnt working
Code:
this.attachMovie("placeholder_mc", "placeholder_mc2", 1000, {_x:150, _y:200});
is there a way to attach the placeholder_mc at the absolute top layer even over the hovers?
View 1 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
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
Apr 4, 2012
i've got 4 coodinates an need to fit a fit movie clip to them, so each corner of the movieclips is on one coordinate.The only thing i could find it tranforming it with a matrix and angles (see example), but these cant be the best solution for my problem to calculate all the angles etc.
var degX:Number = 0;
var degY:Number = 0.3;
//Get the transform matrix for the object to skew
var m:Matrix = bild.transform.matrix;
[code]....
View 1 Replies
Nov 28, 2009
what i am trying to do is create a game that works on the same bases as battle ships but the difference is that its just at a single grid size scale so basically you only have to hit 5 squares in the 8x8 square grid. The trouble i am having is that i have set it up as a movieclip and i cant seem to get it to same the positions on the side that i select on (named the players side) it works fine for the otherside and will hit the 'enemy squares' and you can win the game but never loose the game that the problem.
View 0 Replies
Apr 20, 2004
I am drawing a set of connected lines in a MC that is created using createEmptyMovieClip. The lines start at (0,0) within the MC and move into the negative x values when the lines move left. The problem I am having is when repositioning the MC. When I tell the MC to move to _x=0 and _y=0, it doesn't move to the stage's (0,0), it still hangs off the left side of the stage. The following image shows the MC positioned to (0,0) (note: the green is the stage):shouldn't the MC containing the drawn lines use its left-most point when being repositioned so that it doesn't hang off the left side of the stage?
View 5 Replies
Jan 2, 2010
Basically its an onPress event handler on a movie clip that attaches another movie to it when pressed.The problem is, I only want the movie clip to be attached once in the designated x,y coordinates, no matter how many times the main object is pressed. I'm essentially trying to write my own FreeTransform script, that allows users to resize the object.
Below is the my source code:
ActionScript Code:
chair_mc.onPress = function() {
var bounds:Object = chair_mc.getBounds(this);
//
[code]...
View 5 Replies
Nov 13, 2009
I have a movieclip in frame 1 doing an animation. I would like to use a listener to determine when the movie clip is finished then move to the next frame.
View 2 Replies
Sep 16, 2010
I'm making a game where an airplane loads using attachMovie, with a randomly assigned y coordinate and a constant x. The airplane then moves across the screen. You hit another button, and a parachutist is loaded using attachMovie, with the coordinates being set equal to the current coordinates of the airplane. The parachutist loads but he doesn't load to the coordinates of the airplane. If I feed the parachutist numerical coordinates, he loads to those coordinates, but for some reason Flash seems to be completely ignoring my attempts to feed the plane's coordinates to the parachutist. Here's the relevant code, which is of course nested in an onEnterFrame function:
if (Key.isDown(Key.DELETEKEY)){
if (jumped == false){
attachMovie("jumperWhole", "jumper", 0);
[Code].....
As I've said, the jumper loads, he just loads in the upper corner of the game, as if the plane's coordinates are ignored and Flash attaches jumper to the default coordinates of the program. If I try to attach the jumper to the using the coordinates of something that's not in motion, it works, so I'm wondering if this has something to do with the motion of the plane.
View 1 Replies
Sep 22, 2009
I was thinking that it will be an easy task but something is not right. Here is what I am trying to do. I want to be able to run a function if the mouse is moved over certain areas of the movie clip on stage. Based on which area of the movie clip the mouse is moved I'd like to be able to trigger different behaviour. Below is the code which I was thinking shoud do it:
Code:
var posY:Number;
var mouseListener:Object = new Object();
mouseListener.onMouseMove = function() {
[Code].....
For some reason, the trace statement is ran always when the mouse moves regardless if it is over the movie clip or not. It also only shows the first trace statement. It is never chaged even if the mouse is in the different areas of the movie clip.
View 5 Replies
Sep 23, 2009
I was thinking that it will be an easy task but something is not right. Here is what I am trying to do. I want to be able to run a function if the mouse is moved over certain areas of the movie clip on stage. Based on which area of the movie clip the mouse is moved I'd like to be able to trigger different behaviour. Below is the code which I was thinking shoud do it:
ActionScript Code:
var posY:Number;
var mouseListener:Object = new Object();
[code]......
View 0 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
Oct 20, 2004
I want to load a random movie clip from the library to an empty clip on the stage called (bg_graphics). the clips in the library are called (green, blue, yellow).
View 5 Replies
Jul 16, 2009
How can I get the absolute stage position of an object within a custom flex component that I exported from flash? In my Flex application I'm using the component and resizing it by setting its height and width properties. I want to place another component on the stage but I want it to appear at the same x and y coordinates of a text field in my custom component.
newComponent.x = customComponent.myTextField.x
newComponent.y = customComponent.myTextField.y
Because the customComponent is resized, the coordinates don't match up.
View 1 Replies
Mar 11, 2006
i need to make a movieclips _x and _y absolute to the stage so that i can duplicate a movie clip to the _x and _y of the mc without it just duplicating to the top of the stage (did anyone get that or was my english too bad?)
View 7 Replies
Aug 29, 2006
im trying to achieve a Full Browser Flash and i want my bgimage to remain in the centre of the stage whilst other objects move round it depending on mouse movements but how would i go about centering the bgimage through AS?
View 2 Replies
Sep 19, 2011
I have some (Eg. 10) Movie Clips on bottom of the Stage (aligned horizontally) with different sizes (different width & height). I want them to align vertically on middle of the stage with same gap (irrespective of their sizes) in between 2 Movie Clips. Is it possible using AS3 code?
View 3 Replies
Jul 5, 2009
I could code in movie clip by clicking on movie cilp on the stage but in As3 I could not do . Is this restricted to code on movie clip ?
View 7 Replies
Dec 28, 2009
I'm trying to reach a body of text which i turned into a movie clip which is on the main stage, and have it scroll up/down whenever it rolls over the designated hot spots. Here's what i have.
stage.addEventListener(MouseEvent.MOUSE_MOVE,down1,false,0,true);
function down1(e:MouseEvent):void {
if (mouseX>=0 && mouseX<=42 && mouseY>111.1 && mouseY<146.1) {
[code].....
View 3 Replies
Sep 27, 2009
Making a Comic book/Video game with Flash Action Script 2.0. Check out my blog ive uploaded a couple of demos on it.Anyways i want to make a movie clip appear on stage when the user finds a key. The movie clip would be used as a trigger to send the player into an other version of the second level where a door would now be unlockable (only if he has the key).I know how to make the hittest work its making the movie clip appear on stage with an action that is giving me problemes.
View 2 Replies
May 21, 2009
I'm having a little trouble with the following code. When a user clicks on a button, I would like to add the corresponding movie clip to the stage, and remove the previous movie clip. This code works, but I know I am adding all the movie clips onto the stage at once, which isn't what I want. I don't want the movie clips to tween onto the stage, I want them to just play.
var arrNavigation:Array = [{button:about_mcButton, page:about_mc},{button:n2_mcButton, page:services_mc},
{button:n3_mcButton, page:products_mc}]
for(var i=0;i<arrNavigation.length;i++){
[code].....
View 2 Replies
Jul 27, 2009
i am still quite beginner. How come i cannot see the movie clip on the stage even though i tried to drag and drop the explosion movie clip from the library?
Another question: How to import and test by scrubbing the playhead between 0 and 20 frames to show the animation of explosion on the stage, not testing in flash format.
View 1 Replies
Sep 16, 2009
I'm having problems with a combobox that I've got set up to add a movie clip to the stage. What I'd like to happen is when a user selects an item from the comboBox the MovieClip is added to the stage. It kind of works but you have to click on the item twice for the MC to be added.Here's my code:
Code:
var IronsMC:Irons = new Irons();
product.addEventListener(ListEvent.ITEM_CLICK, ItemClickHandler);
function ItemClickHandler (event:ListEvent):void {
[Code].....
View 1 Replies