AS3 – Actionscript 3 – globalToLocal & localToGlobal
I’m hacking to pieces the Open Flash Charts in a project I am working on.
One bit required me to put a Sprite to the same position as another Sprite but under a different Parent DisplayObject. I was using the globalToLocal and localToGlobal methods but couldn’t get it to work. There wasn’t much on the net about how to use this except from basic programming principles.
What cracked it for me was you call the method localToGlobal on the PARENT of the Sprite you want to copy. As follows.
So I wanted to put my label in the same absolute position as the ‘clone’. So I called localToGlobal on it’s PARENT.
Hope this helps!
Related Posts
Posted on November 18, 2009 at 8:00 pm by Jordan Carter · Permalink
In: Actionscript 3 · Tagged with: DisplayObject, localToGlobal, Sprite
In: Actionscript 3 · Tagged with: DisplayObject, localToGlobal, Sprite
on January 14, 2010 at 11:03 am
Permalink
Thank you, You have just saved me from wanging my laptop out of the window!
on April 22, 2011 at 5:55 am
Permalink
it’s helpful!
thank for this post
on April 30, 2011 at 8:33 am
Permalink
Thanks ! You saved my hairs!
on May 2, 2011 at 12:12 pm
Permalink
and 1 year later, you saved my ass too. You are awesome!