A stageX, stageY property for MovieClips - how do you do it?

Getting the absolute position of dynamically created, moving MovieClips can be a real pain, especially if you use radomization and don`t know where or how deeply nested they spawn.
The localToGlobal function can make your code really unreadable, so I tried to come up with a functionality that would give me access to any Sprite/MovieClips position on the stage no matter where.
Kind of a property that some Events have (stageX, stageY).
Basically my goal would be to have no localToGlobal/GlobalToLocal conversions in my document class, but doing all that stuff inside the instances themselves.
What I have so far:
import flash.display.MovieClip;
import flash.geom.Point;
var _nestLevel:int = 0;
var l:int = 0;
var parentList:Array = new Array();
getAbsolutePoint(this);
function getAbsolutePoint(_mc:MovieClip):void
    if (_mc != MovieClip(root))
        _nestLevel++;
        getAbsolutePoint(MovieClip(_mc.parent));
    else
        while (l<_nestLevel)
            l++;
            parentList.push("parent");
            trace(parentList);
          //traces correctly depending on the nesting Level (e.g. parent,parent,parent)
        //this throws a 1010 Error
        trace("Global coords : " + _mc[parentList].localToGlobal(new Point(_mc[parentList].x,_mc[parentList].y)));
Any ideas how to get this to work?

if you answered yes and if the final shape is at 0,0, you can use returnF to return the movieclips position relative to the global coordinate system:
var stageX:int=this.x;
var stageY:int=this.y;
defineF(this);
function defineF(mc:MovieClip):void{
stageX+=mc.parent.x;
stageY+=mc.parent.y;
if(mc.parent.parent is MovieClip){
defineF(MovieClip(mc.parent));
function returnF():Array{
return [stageX,stageY];

Similar Messages

  • When buying an Ipod Touch,just for music, how do you gauge which capacity machine you need?

    When choosing an ipod touch just for music, how do you gauge which capacity you need?

    Well, you'll be able to see how much material you already have by looking at the bottom of the iTunes window (eg "2000 songs, 2GB" or whatever). Then you can gauge whether that represents about as much as you expect to have in the near future, with a little headroom, or if you think you will dramatically increase that amount, either through ripping CDs, or by purchasing downloads.
    Calculate a 4-minute song in AAC format / 256k as being 10MB. A 128k track would be around 5MB. Most MP3 tracks will generally be a little smaller for the same time length, but better to give yourself more room than you think you'll need.
    So for the 8GB iPod - 800 tracks at 256k, or 1600 at 128k.
    32GB: 3200 @ 256k or 6400 @ 128k.
    64GB: 6400 @ 256k or 13000 @ 128k.
    Current tracks from iTunes Store are 256kb/s. Bitrate for tracks you rip yourself are set using iTunes Preferences.
    Hope that helps.
    Matt

  • HT204266 When in setting's on display list is option for radio how do you get it to work or is this not possible. When i press centre button it puts a tick beside it

    When in settings on display list is option for radio how do you get it to work or is it possible. When centre button is pressed a tick appears beside it.

    The Palm Desktop is available to download from the Palm site:
    http://www.palm.com/us/support/macintosh/mac_desktop.html
    though this doesn't list the Clie devices and you may need to check which version you should be using. The Desktop will run on 10.4.
    The 'Apple' key is the Command key.
    You may need USB Overdrive - a useful program - unless the mouse comes with a Mac driver (some Miscrosoft mice do). Apple's Might Mouse will work fine.
    USB overdrive usefully allows you to assign the same mouse click to do different things in different programs.

  • Pages for ipad2 - how do you get text to wrap around the contours of a picture? Not the simple square wrap, but I saw text following the contours of a bike wheel at the Apple store demo

    Pages for ipad2 - how do you get text to wrap around the contours of a picture?  Not the simple square wrap, but I saw text following the contours of a picture of a bike wheel at the Apple store demo

    Sjazbec,
    Thanks for the reply.
    I did read the help and went through the tutorial - the butterfly text wrap (and the wrap around the curved contour of the bicycle wheel at the Apple store) is the reason I am asking this question.  I don't know how to use one of my own pictures and tell Pages what contour to wrap around.  Is there some additional image editing software that I need to "creatively crop" one of my own pictures, so that Pages will be able to wrap around that contour?
    Thanks / Danke!!

  • For the ones that use Muse as their main tool to build websites for clients, how do you win them over? (+bonus question)

    Couple times a year I always get insanely interested in Adobe Muse. I've used it before, then I got even more interested when all the new in browser editing features rolled out. The idea seemed nice, but I was very disappointed when I noticed it was really only text and images that you can edit. I hope this is not an actual argument when talking things over with a client, but how do you win your client over if he asks "can I edit the videos on the site? can I edit x?, etc" Which would probably then lead to "Why should I use you when I can just use a website builder like squarespace, wix, etc and actually have control over my website?"  What is your response?
    I REALLY want to get into Muse, and I want to be convinced! It seems like a dream for designers like myself. That, what I wrote above, is the only thing that holds me back.
    Bonus question:
    Say, the answer is "it's just not possible" to change the videos, etc.. What is the alternative? A bunch of iframes with say, tumblr blogs made specifically to just hold a video? Sized specifically for it, etc.
    I'd just like to build websites for clients and really end it there. Move onto the next project! Even if paid, I'm just not interested in managing websites after I build them. I wouldn't really be able to convince a client to pay me every time he wants a change too.

    Couple times a year I always get insanely interested in Adobe Muse. I've used it before, then I got even more interested when all the new in browser editing features rolled out. The idea seemed nice, but I was very disappointed when I noticed it was really only text and images that you can edit. I hope this is not an actual argument when talking things over with a client, but how do you win your client over if he asks "can I edit the videos on the site? can I edit x?, etc" Which would probably then lead to "Why should I use you when I can just use a website builder like squarespace, wix, etc and actually have control over my website?"  What is your response?
    I REALLY want to get into Muse, and I want to be convinced! It seems like a dream for designers like myself. That, what I wrote above, is the only thing that holds me back.
    Bonus question:
    Say, the answer is "it's just not possible" to change the videos, etc.. What is the alternative? A bunch of iframes with say, tumblr blogs made specifically to just hold a video? Sized specifically for it, etc.
    I'd just like to build websites for clients and really end it there. Move onto the next project! Even if paid, I'm just not interested in managing websites after I build them. I wouldn't really be able to convince a client to pay me every time he wants a change too.

  • My macbook start up disk is full and i have to delete files to make room for updates. how do you make room on start up disk?

    how do you delete files from start up disk on my mac book?

    Freeing Up Space on The Hard Drive
      1. See Lion's Storage Display.
      2. You can remove data from your Home folder except for the /Home/Library/ folder.
      3. Visit The XLab FAQs and read the FAQ on freeing up space on your hard drive.
      4. Also see Freeing space on your Mac OS X startup disk.
      5. See Where did my Disk Space go?
      6. See The Storage Display.
    You must Empty the Trash in order to recover the space they occupied on the hard drive.
    You should consider replacing the drive with a larger one. Check out OWC for drives, tutorials, and toolkits.
    Try using OmniDiskSweeper 1.8 or GrandPerspective to search your drive for large files and where they are located.
    Please read my user tip to learn all about "Other:" What is "Other" and What Can I Do About It?- Apple Support Communities.

  • PipxelPipe for Aperture: how do you install it?

    I've downloaded PixelPipe for Aperture 2 but that's as far as I've gotten. Is there a certain way that it has to be installed into Aperture for it to work? All I have been able to do is install it, but I am not able to find the actual program anywhere on my computer. This is probably something real simple and I am probably totally missing it too. Any help would be great, thanks!

    Oh thanks, I didn't even think about right-clicking. I've had this mac (my first one too and I love it) for close to a year now and I am still learning new things about it, which is awesome! I still find myself having to get used to how intuitive things are as well. When I right-clicked some images, a bunch of potions did come up and under export the pixelpipe was not present. It is a dmg file on my desktop and I already went through all of those steps and it said it was installed and all but I am still unable to find it. Could it be a type of plug-in file that I need to install in Aperture's folder? (See, I think I am still going about it un-intuitively because for certain things I am still used to Windows and doing things the roundabout way instead of the way that makes sense.)

  • AUNetReceive. what is it for and how do you use it?

    i can't find anything online or in my books or manuals about it.
    anyone?
    thanks,
    tony

    It's a plugin that comes with OSX Tiger, and it sends audio across a network, which can be received by the AUNetReceive plugin.
    http://www.rogueamoeba.com/utm/posts/Article/autiger-2005-05-19-21-00

  • Me love the new 4, even after standing in line for hours, how about you?

    i got it! (after multiple hours of line standing at valley fair mall. Santa Clara, CA.) -Apple was great about it though they catered the lines with Cheesecake factory delivering us with rations, such as Cheescake, Pizza, potstickers, lemonaide and Dreyers Ice Cream.
    Any Ways, Its Delightful & worth the wait.
    synched up to the Wi/Fi and its jamming.
    what do u think?

    I live in a smaller town of about 28,000 and i got to our local Walmart store at 5:00 Am, I was 4th in line and they only had 7 units... They started activation at 8:00 and besides some complication in SIM activation that took about 30 mins to fix at my local AT&T store im running good and loving it... Im glad i didnt have to wait too long in line... lucky i guess
    Plus no service issues, i get full bars most of the time.
    Message was edited by: D.Williams

  • ONCE YOU SEARCH FOR SOMETHING HOW DO YOU RETURN TO THE HOMEPAGE WITHOUT EXITING

    I DONT SEE THE BACK ARROWS

    You can open a new tab to return to the about:newtab page with the thumbnails of visited web pages.<br />
    If you have set the home page to this about:newtab page then you can click the home button on the right end side of the Navigation Toolbar.<br />
    You do not get an enabled back button to go back to the about:newtab page if other pages are opened from this page.

  • Property for Planning is not alowed to change in a query

    Hi all,
    I need your help, I am new on IP, but I was working on BPS. I am trying to create a query by Business Explorer but the query does not allow to Set the property for Planning "Start query in Change Mode"-  this option appears grey.
    The same ocurrs with  the 'Key Figure' Planning Property to set "Can be changed Manually or via Planning Functions" for the appropriate KeyFigures.
    I have a real time cube, I have 3 agregation level ( I created it by IP wizard).
    What do I need to create a query to  allow to Set the property for Planning?
    Thank you very much.
    Victoria

    Hi,
    cf. the documentation
    http://help.sap.com/saphelp_nw70/helpdata/en/43/1d023a41130bd5e10000000a422035/frameset.htm
    i.e. you have to define the query on an aggregation level or a MultiProvider that contains at least one aggregation level as a partprovider.
    Regards,
    Gregor

  • How do you add page breaks in pages for iCloud

    I have been using pages in the beta for iCloud, how do you add a page break?

    Right-click (CTRL-click) where you want the break then select Page Break.

  • HT3529 how to you fix when it keeps saying waiting for activation

    when i go to Imessage and i turn it on it keeps saying waiting for activation how do you fix this

    Hi rsooch,
    If you are having issues with iOS Messages activation, you may find the following article helpful:
    iOS: Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/ts4268
    Cheers,
    - Brenden

  • HT1766 How do you back up or save videos that were imported from another source

    I'm having battery issues with my iPhone 5 (6.1.3), and therefore need to back up as much data etc. as I can. I imported several videos from my previous blackberry phone, which are stored in the video folder on the iPhone however I don't appear to be able save these on to my laptop and they aren't included on iCloud or iTunes?

    I am sorry to be so rude but if you work for APPLE how can you be ignorant about its products. So I guess I will have to be snotty and rude and give you an education on products you should already be aware of. NO ORIGINAL iPads (meaning iPad1) CAME WITH A STILL CAMERA OR VIDEO CAMERA. THERE IS NO WAY PHYSICALLY POSSIBLE TO ORIGINATE PHOTOS OR VIDEO WITH THIS DEVICE!!!! ALL THE PHOTOS WERE DOWNLOADED OVER THE WIFI FROM THE INTERNET!!!! Why can I only back up 500 pictures from the internet and not all 5700 photos and videos from the internet? if You can not answer this then help me get my wifi to work with some software fix. I cannot get on the internet because it rejects the password which I know it is right because all other 6 devices still work on the wifi. I cannot change the wifi because it is provided by property managment company. And, as I stated, all my other non-apple products work on the wifi just not the iPad. 

  • How can you modify the displayed columns on a Related Information List?

    How can you modify the displayed columns on a Related Information List? For example, how could you add the "Type" column to the List of columns displayed for Service Requests when you are viewing the Contacts Detail page?
    Thanks

    I'd have to say I think this is one of the biggest flaws in the OnDemand system currently. The solution I have come up with is to create reports and put them in webapplets showing the data I want to show. I have then removed the standard Related Info List Objects and added weblinks to create new records as the button on the List object is also gone.
    Keep in mind that doing this does slow things down a little, so it may not work if you have a big user base.
    RWB.

Maybe you are looking for

  • How to set property nodes for each of the multiple y-axes?

    In Labview 6i, I have set up multiple y-axes on an xy graph. I want to change certain properties of each of the 2 y-axes independently. I believe I can do this using "property node". However, after I have created a property node for the xy graph, I r

  • Unable to import IPhoto 6 slideshows to IDVD 6

    When I try to send a SLIDESHOW with captions and music prepared in iPhoto 6 to IDVD to burn to a DVD by choosing Share>Send to IDVD i get the following message "An error occured while exporting the slideshow, the export movie file could not be create

  • Where to find deltas in generic extraction

    hi experts, could you please explain me tcodes which are used to find the delta data while we go for generic extraction. Also can anyone explain me the full process of extracting the data using   infoset query and function module. Cheers, Pragya.

  • Problem in Virsa 4.0 in Mitigate Users

    Hi ... We have patched Virsa 4.0( 400_620) on our production server.  After patching, we are facing problem with Mitigate Users. After logging in CC4.0, under the Mitigation Tab, Mitigation Control ->Mitigate Users -> New Entries. Here when we add or

  • Error at the time of Terminating Service Contract

    Getting the following error at the time of terminating the contract in Oracle Service Contracts Module. OKC_CONTRACTS_REQUIRED_VALUE(COL_NAME=QP CALL FAILURE Routine"QP_PREQ_GRP.INSERT_LINE_ATTRS2 ORA-01400: cannot insert NULL into ("QP".QP_PREQ_LINE