Flash :: Find Position Of An Object Relative To Stage?

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


Similar Posts:


Find The Position Of An Object On Stage?

Aug 29, 2010

I have built a site in AS2 and would like to know the position of a ball so that I can move a sign to it always.The whole website is in AS2, but I think I have written an incomplete code below for AS3. I need it for AS2 because the whole site is in AS2. The get position of ball is wrong, but I just wanted to throw in some ideas eg.

Code:

// get position of ball
ball_mc.addEventListener(<what goes here?>, ball_pos);
function signMove(Event:MouseEvent):void{[code]..........

View 3 Replies

ActionScript 3.0 :: Get Position Relative To Stage?

Oct 27, 2009

I have a movieclip thats inside another movieclip..lets call them mc1 and mc2..

the problem is that I want to get the position of mc2 relative to the stage...and not to mc1..is there any simple way to do this?

View 1 Replies

ActionScript 3.0 :: Position Array Relative To Stage?

Aug 10, 2011

way to position an array containing movie clips relative to the stage? Here's what I was trying...

import flash.display.MovieClip;
var one:MovieClip = new One();
addChild(one);

[code].....

View 5 Replies

Professional :: How To Set MovieClip Position Relative To Stage With Classes

Mar 1, 2011

I'm developing my first flash app. I'm trying to use classes because they'll be very important in my future app. I created a simple movieclip with a star. However, instead of putting it directly on the stage, I'm calling it from library, using the addChild method to place the star in the stage. To do that, I simple right click over the movieclip icon->properties->check export to action script->and I give a name to the class (for example: myMC)

Then, inside the class I wrote:
package {
import flash.display.*;
import flash.events.*;
public class myMC extends MovieClip {
var star:myMC=new myMC();
public function myMC() {
[Code] .....

As I am placing the two variables origin_x and origin_y inside the constructor, I'm expecting to get 250 and 200 respectively. After drop the star, I want to send it to it's original place, and that's why I need to keep this values. And here's the problem, origin_x and origin_y are both ZERO, instead of 250 and 200... The value is not relative to stage. I managed a little bit and I found this post : [URL]. Unfortunately I tried to replace by the suggested code, but both values remain zero. An interesting thing, is that if I put the star directly in the stage instead of calling it from the library as I am doing, I get correct values in origin_x and origin_y.

View 1 Replies

ActionScript 3.0 :: Position MovieClip Relative To Stage From Within Classes

Aug 5, 2011

I have a Flash file for an xml driven menu. There is the document Class, called Main. There is also a Navigation class. In the Navigation class, I position the location of main buttons and sub menu buttons for the menu. I want to position the buttons in the Navigation class relative to the stage. Currently, they are just fixed at certain positions (like 20); To do this, I have read that because this is not happening in the document class.

I must add an event listener to the constructor that listens for the added to stage event. I am not sure how to do this, as when I try and add an event listener for added to stage in the Navigation class nothing happens, (or all menu items diaspear). How to position movie clips relative to the stage (i.e. stage.stageWidth - 50) from a class that is not document class? How to do so in the document class, too.

View 2 Replies

ActionScript 2.0 :: Panning Object Relative To Mouse Position?

Jan 28, 2010

I have an flash file which is 740px wide and a movie object inside it which is 1100px wide. What I want to happen is for the movie to scroll left or right depending on the mouse position and to stop when it reaches the start or end of the movie object. It all works fine except when it gets to either end, the _x position is outside the boundaries I have set in the if statement so it wont scroll back again.Code is below:

ActionScript Code:
onClipEvent (load)
{

[code]....

View 2 Replies

Actionscript 3.0 :: Position The Tooltip Relative To The Object That Triggered It?

May 9, 2009

I have made a tooltip class for my project and I want to position the tooltip relative to the object that triggered it.e.g.

Code: Select all_button = new CustomButton("CLICK ME");
_button.addEventListener(MouseEvent.ROLL_OVER, showTooltip);
private function showTooltip():void
{

[code]...

How can I access the _button without hardcoding it like that?

View 9 Replies

Flash :: Keep Object Position When Resizing Stage?

Nov 4, 2010

im trying to keep a object in a certain position in the screen, without resizing it too (with the stage)

function Resize(e:Event = null):void
{
if ((stage.stageWidth)/(stage.stageHeight) > fundos.width/fundos.height)
{

[Code]....

my stage is resizing all ok (keeping the aspect ratio) and im trying to add a nav img that would stay in the same position as i resize the browser screen

View 3 Replies

ActionScript 3.0 :: Find Nested Movieclips Current Position Relativ To Stage

Oct 6, 2009

I have a movieclip, which attaches to another movieclip, which scrolls.On click I want to be able to drag that movieclip away from the one it was attached to. When I just removeChild it, it's position changes. I want it to stay in the same spot until it's dragged.Any suggestion, on how I can give it that same position, when not attached?

View 1 Replies

Actionscript 3 :: Tween Position Relative To Current Position?

Jan 23, 2010

I have a tween set on a timer:

var manTimer:Timer = new Timer(1000,14);
manTimer.addEventListener(TimerEvent.TIMER, moveMan);
function moveMan(e:TimerEvent):void {[code]....

I just need to make the tween's position relative to it's current position, as opposed to starting at the stage's 0 position then moving the the stage's -40 position. It needs to start at its current position the move -40 from that position.

View 1 Replies

AS3 :: Flash - Relative Points - Translate The X / Y Position Of The Crosshair?

Aug 21, 2011

So I have a Crosshair on the Stage and I have an Enemy with nested child limbs, when the below function is called I want to create a hit mark and attach it as a child to the Enemies Limb but how do I translate the X/Y position of the Crosshair to the Enemies Limb bearing in mind the Limb may also be rotated?

[Code]...

View 1 Replies

IDE :: Position MovieClips Relative To Flash Movie Size?

Nov 21, 2011

How to position Objects in flash so that they stay like 10px from left no matter the size of flash movie. Something like in flex.

And how to embed Flash movie in HTML so that it all worked correctly?

View 2 Replies

ActionScript 3.0 :: Object Position On Stage Without Using Stage.align

Apr 23, 2010

I have a stage bigger than the size of a browser, and I have a camera to navigate around the area.Now when I click on a button, I will have something pop up blocking the whole browser, like a lightbox effect with another box on top of the blocker.The problem now is, when the blocker pops up, its position is not on the TOP LEFT corner of the browser. I've tried stage.align, but it would makes the camera or other object on stage position run.So is there any other way I could get the blocker to position according to the browser, not the stage?[code]

View 1 Replies

ActionScript 2.0 :: Find MC Center Relative To Edges?

Aug 31, 2010

I don't seem to be able to find the right wording to find my answer anywhere.How do I determine where an MC's center is relative to its edges?I'm developing a tool that a variety of noobs (as if I'm not still a noob) will be using, and I don't trust them to keep art with 0,0 being the top left corner.How do I figure out that the left edge is now at -111px, and the top at -52, and the right at 12, and the bottom at 334?

View 3 Replies

ActionScript 3.0 :: Get The Absolute Stage Position Of An Object?

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

ActionScript 3.0 :: Referencing An Object's Stage Position?

Dec 11, 2010

i'd trying to build an interactive tree that allows the user to move the tree's branches and nodes. the lines (branches) of the tree are drawn programmatically between points (nodes and tips). i'd like for the user to click on points to drag them while having connected lines and points move correspondingly. i've gotten this to work to some extent using the code below:

ActionScript Code:
function startMoveOa(evt:MouseEvent):void {
thisPtOa = Sprite(evt.currentTarget);

[code].....

View 2 Replies

ActionScript 2.0 :: Fine Tuning MC Position Using Stage Object?

Oct 25, 2006

I'm using the stage object to align multiple MC's. My question is how do I affect a MC's position if I want to have it be centered on both axis but 100px away from the bottom margin instead of the top relative to the size of the window?here's my positioning code:

[AS]
navBar._y = Stage.height;
navBar._x = Stage.width/2;
tpShadow._x = Stage.width/2;

[code].....

Also if i'm using an empty MC to load external swf's, do the external swf's have to have AS for positioning as well or do I position the empty MC in the base movie?

View 1 Replies

ActionScript 3.0 :: Distinguishing Relative Z Position?

Dec 10, 2009

Imagine that I make a movie clip that looks like a chess board, and that inside that move board I place other movie clips that look like pieces.Now imagine that I tilt the chessboard so that you are no longer looking at it top down and rotate it so that the dark pieces are first in front of you and and this slowly changes until the white ones are, etc.In order to make this look right I have to rearrange the stacking order of the movie clips (which pieces are "on top" of which other pieces when they are drawn). But when the clip rotates, the mc.z value for all the clips does not change. Neither does the width or height which I thought I could use instead even though they are clearly looking bigger or smaller onscreen.I think that I might just be getting the z point relative to the other children of the rotating movieclip. Is there any way to get the z point relative to the stage?

View 3 Replies

ActionScript 3.0 :: Moving Image Relative To Position?

Jan 6, 2010

I had coded a different file similar to this and had a movieclip move along the x axis relative to where the mouse position is.

The idea is the movie clip is a panoramic photograph (eg. 6000x900) and it would move dependant on where the mouse it. ie. if mouse is in the centre it will be stationary and when it moves left and right the image will move accordingly (faster when further away from the centre).

The code below works moving the movieclip's x position but when I try and do it with TweenLite (using the quotations for relative positioning) the movieclip snaps immediately to -107374182.4

ActionScript Code:
import com.greensock.easing.*
import com.greensock.*

[Code]....

There is obviously something fundamental I am missing but cant see it at the minute. I had this working previously but then tried to progress it and write my own class for the panning (that now turns out I do not have time for) but I saved over the code and cant not go back.

I have put together an example zip with a .fla and the greensock tweening platform.

View 2 Replies

ActionScript 2.0 :: Browser Scroll Bar Position Relative To .swf?

Jan 6, 2011

To make this more clear I have a flash website coming near to the end of the design stage. I have a multi-layered scene with a resolution of about 700x1200 (so you would scroll down the page with the browser scroll bar). Basicly I want these layers to correspond to your scrollbar position as though the perspective changes. ie: scrolling down would push the fore ground at the normal rate but only pushing the background at a slower rate, (thus giving a 3D effect).I would imagine since the .swf would then need to talk to the scroll bar, there would be a need for another language as well as action script.

View 0 Replies

ActionScript 2.0 :: Sliding MC Position Relative To Contents?

Feb 29, 2008

I have a movie clip that I have given the a "sliding" variable to move it across the X axis. So far I have been using a variable of

Code:
movieClip.newX = -250;

but what i need to do is have the movieclip slide to a position which is relative to an object inside of it.

As i need the slider to move to a position that centers the object which the slider contains on centered on the screen - i have tried:

Code:
movieClip.newX = movieClip.ContentsObject.Stage.width/2;

but with no response. I realise that code is incorrect, but need something that will work in that way. I presume i need some sort of listener to follow the _x position of the specific movie clip.

View 7 Replies

ActionScript 3.0 :: Get Mouse Position Relative To Screen?

Feb 13, 2010

I would like to know if there is any way that when mouse leaves screen, the mouse coord from the Main Movie Clip (mouseX and mouseY) keeps updating! Is there any way to get the mouse pos relative to the screen pos?For example when mouse leaves screen and goes 30 pixels up, its position would be (X,-30)

View 1 Replies

ActionScript 2.0 :: Scaling Relative To Mouse Position?

Feb 20, 2004

I have a dragable movie clip that on release I want to scale, depending on the mouse position, the further the mouse up the screen (y) then the smaller the clip scales on release.

View 6 Replies

ActionScript 2.0 :: Relative Mouse Position With Easing

Jul 20, 2004

Here is my cool code....

Code:
onClipEvent(enterFrame)
{
_x -= (-20) - ((0.1 * _xmouse) - 60);

[Code]....

How can I make the easing start fast then go slow? Right now it starts slow and speeds up. Well not really, because it speeds up and then slows down once it gets closer to the mouse position. But becuase the mouse position is greater than that of the movement, it seems like it speeds up then just stops!

Here is the effect I am after....

look at the images inside of [URL]

View 7 Replies

ActionScript 3.0 :: Text Position Relative To Browser Resize?

Dec 13, 2009

I am having problems changing text x,y position in a browser window as the browser is resized. Ultimately I plan on positioning an image but just using the text for now. I use the following code:

Code:
stage.addEventListener(Event.RESIZE, wResize);
function wResize(e:Event):void {

[code]......

View 0 Replies

ActionScript 2.0 :: Shift / Scale Relative To Position At Click

Aug 19, 2006

I've recently taken Krilnon's tutorial on interactive image panning, and have a need for more complexity. My image to be panned (relative to user's mouse movement) has several 'hot spot' buttons placed within. Each hot spot, when clicked, is to smoothly zoom and shift within the mask, with pertinent info displayed next to each, once zoom and shift is complete. almost like I'm making a motion tween, where the final position is known, but the start position is wherever the BG image is when the user clicks the nested button. I need to determine the x-position at the moment of click of the button (different for each button), and then, I think, use a simple-math "stagger-step" method of moving and scaling, until I've reached my final dest. here's the link to the tutorial I originally referenced:Url...

View 8 Replies

ActionScript 2.0 :: Position Clips Relative 2 Browser Window?

Jan 10, 2007

I want to position a clip near the end of the browser window and to make it fixed there, no matter on which screen resolution my site is viewed. I've tried already doing it using the external movie with fscommand, as well as with Stage.align, but then it applies to all the loaded movies. The rest of the content should be centered.

View 1 Replies

ActionScript 2.0 :: Motion Path Relative To Mouse Position

Nov 10, 2007

im using MX 2004 although i do have Flash 9 atm if anyone has an example in that
Anyway, im trying to slow down and speed up an orbit of an mc relative to where the mouse position is. So basically i need some sort of radial "field" where when the mouse gets close to the outside of the orbit the movie clip stops and when it is farther away the movie clip speeds up.

[Code]...

View 1 Replies

ActionScript 2.0 :: Image Pan - Want To Center/scale Relative To Position At Click?

Aug 19, 2006

I've recently taken Krilnon's tutorial on interactive image panning, and have a need for more complexity. My image to be panned (relative to user's mouse movement) has several 'hot spot' buttons placed within. Each hot spot, when clicked, is to smoothly zoom and shift within the mask, with pertinent info displayed next to each, once zoom and shift is complete. almost like I'm making a motion tween, where the final position is known, but the start position is wherever the BG image is when the user clicks the nested button. I need to determine the x-position at the moment of click of the button (different for each button), and then, I think, use a simple-math "stagger-step" method of moving and scaling, until I've reached my final dest. here's the link to the tutorial I originally referenced:If anyone knows of a tutorial or example out there, I'd love directions to it(them). or,

View 1 Replies







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