ActionScript 3.0 :: Determining Stage Coordinates After Scrolling?

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

Similar Posts:

Actionscript 3.0 :: Determining Which Mc Is On Stage And Positioning It?

May 19, 2011

I have a series of movieclips acting as buttons that load different flashvars video srcs onto the stage.When the swf loads --- the first button is added to the stage after a 20 sec Timer completes.As you click through each button, the one just CLICKED is removed and a new button is added in its place.All the buttons are set to dynamically be centered on the stage. However, the function that is positioning them is called BEFORE the first button is on stage, throwing the error (Error #2007: Parameter child must be non-null.)here is the code inside of the windowResize method which positions the buttons.

Code: Select allprivate function onWindowResize(e:Event):void
//position hidden buttons[code].....

Even though I've set up a boolean var and set it to true after the first button has been added to the stage -- the method still tries to find the first button and gives me a error saying that it must be non-null.Basically I want to make sure that it doesn't try and position the first button before it has been added to the stage. I'm not sure if encapsulating this method inside of another Timer is a good idea.

View 1 Replies

Actionscript 3 :: Determining When A DisplayObject Has Been Removed From The Stage?

Mar 3, 2012

The REMOVED_FROM_STAGE event is fired before the object is actually removed from the stage. I'm looking for a performant way to know when the object is finally removed.

View 3 Replies

ActionScript 3.0 :: Determining The Current Stage Alignment?

Jul 20, 2011

I have following javascript and want to test whether the swf is aligned correctly. Please help me what function I should use to test it.


View 3 Replies

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

Flash :: Get Coordinates In Parent But Not In Stage?

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

ActionScript 2.0 :: Cannot Get Coordinates In Respect To Stage?

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:

trace( _root.stageX(this) );
where it is defined on the main timeline as:


View 1 Replies

ActionScript 3.0 :: Change Stage Coordinates Of A Project?

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

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 1/2 :: Passing Coordinates Relative To Stage Into A Nested MC?

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.


View 1 Replies

ActionScript 3.0 :: Use Stage Coordinates As Registration Point For Transform?

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

ActionScript 3.0 :: Store An MC's X,y Coordinates Relative To The Stage As A Variable?

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

ActionScript 3.0 :: Check An Objects X,y Coordinates Based On Where It Is On The Stage?

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

ActionScript 3.0 :: Intercept The Coordinates Of A Nested MC Respect To The Stage?

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

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

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 :: How Does Flash Determine The Coordinates Of Movieclip In Relation To The Stage

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

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

ActionScript 3.0 :: Play Mc NextFrame And PrevFrame As Mouse Coordinates Change Up And Down On Stage

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

ActionScript 2.0 :: Loading Named Buttons Onto Stage With Coordinates From An External File

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

ActionScript 2.0 :: Loading Named Buttons Onto Stage With Coordinates From An External File?

Jan 15, 2005

i have 20 buttons, and i want to design an external file that holds the coordinates for each named would i go about this, since the external file would be read as a string by flash?

View 3 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 2.0 :: Place 35 Movie Clips In Random Order On Stage In Specific XY Coordinates?

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:

var myXArray=[57, 187, 317, 447, 577, 707, 837]; //cordordinates for x
var myYArray=[53, 183, 313, 443, 573, 573, 573]; //cordordinates for y


View 8 Replies

Actionscript 3 :: Convert Global Coordinates To Local Coordinates Of A UIComplenent In Flex Project?

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

ActionScript 2.0 :: Converts 3d Coordinates To 2d Coordinates - Difference Between MoveTo And LineTo?

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

ActionScript 3.0 :: Converting Papervision Coordinates Into Cartesian 2D Coordinates?

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

Professional :: Scrolling Buttons On Stage?

Feb 1, 2011

Anyhow, I have a few buttons (six of them) to scroll from left to right non-stop via looping.  Those buttons are in the up state. What I want to achieve is that when someone hovers over one of the buttons, the entire scrolling temporarily stops and perhaps the hovered button becomes larger as well.  I'm sure you've seen something similar on ebay listings before shown as slideshows.

my Over buttons are managed via movie clips, but not the Up state buttons.

View 2 Replies

ActionScript 3.0 :: Stop Scrolling Off The Stage?

Jun 10, 2011

stage.addEventListener (MouseEvent.MOUSE_WHEEL, MouseWheel, false, 0, true);
function MouseWheel (e:MouseEvent) {
if ( > 0) {[code]..........

What I want to do is simply to disallow scrolling when the top or bottom end of testMC hits the top/bottom of the stage. What occurs right now is that I can basically scroll completely off the stage and it doesn't stop.

View 1 Replies

ActionScript 3.0 :: Keep Object In Stage Center While Scrolling?

Feb 9, 2011

I have a situation where i have a horizontal scrolling container that has a video object inside it. the video object has to stay inside the scrolling content for another reason i don't want to get into here. Now the client wants me to keep the video in the center of the stage even when the clip its inside of is scrolling. Normally I would just take it out of the scrolling clip and place it above the scrolling content but i cant do that here. I tried this math but it didn't work exactly. on an enter frame when the video is open I have this code;

Actionscript Code:
if( vid ) vid = ( stage.stageWidth/2 - vid.width/2) - scrollingContainer.x;

View 4 Replies

Copyrights 2005-15, All rights reserved