RE: [Flashcoders] Using parent Sprites coordinates
hmmm unless I am misunderstanding localToGlobal seems to relate to points - not sprites From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Henrik Andersson [he...@henke37.cjb.net] Sent: Tuesday, February 23, 2010 4:03 PM To: Flash Coders List Subject: Re: [Flashcoders] Using parent Sprites coordinates Lehr, Theodore wrote: Is there a way to have a child sprite reference the parent sprite when seeting it's x and y say I have a Sprite: You must have missed localToGlobal and globalToLocal. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Using parent Sprites coordinates
Yep. You will have to instantiate a point object with the x and y properties of your sprite, apply any localToGlobal/globalToLocal changes*, and then set your sprite's x (and y) to the new point's x and y. Once you do this a few times it might be time to write yourself a few helper functions - ex. a function that takes a sprite and global x and global y and positions the sprite, for example. -jonathan *The way I'm writing this makes it sound like the localToGlobal() function alters the point it's passed, when actually I think it returns a new altered point. Don't get caught by this. On Thu, Feb 25, 2010 at 7:04 AM, Lehr, Theodore ted_l...@federal.dell.comwrote: hmmm unless I am misunderstanding localToGlobal seems to relate to points - not sprites From: flashcoders-boun...@chattyfig.figleaf.com [ flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Henrik Andersson [ he...@henke37.cjb.net] Sent: Tuesday, February 23, 2010 4:03 PM To: Flash Coders List Subject: Re: [Flashcoders] Using parent Sprites coordinates Lehr, Theodore wrote: Is there a way to have a child sprite reference the parent sprite when seeting it's x and y say I have a Sprite: You must have missed localToGlobal and globalToLocal. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Using parent Sprites coordinates
Thanks - I will look into it... From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Henrik Andersson [he...@henke37.cjb.net] Sent: Tuesday, February 23, 2010 4:03 PM To: Flash Coders List Subject: Re: [Flashcoders] Using parent Sprites coordinates Lehr, Theodore wrote: Is there a way to have a child sprite reference the parent sprite when seeting it's x and y say I have a Sprite: You must have missed localToGlobal and globalToLocal. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Using parent Sprites coordinates
Is there a way to have a child sprite reference the parent sprite when seeting it's x and y say I have a Sprite: var bgDad:Sprite = new Sprite(); then I add a child: var bgSon:Sprite = new Sprite(); bgSon.graphics.lineStyle(1,0x00); bgSon.graphics.moveTo(0,0); bgSon.graphics.lineTo(100,100); bgdad.addChild(bgSon); I would like those coordinates [0,0 and 100,100] to be in relations to bgDad - not the stage... is this possible? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Using parent Sprites coordinates
Lehr, Theodore wrote: Is there a way to have a child sprite reference the parent sprite when seeting it's x and y say I have a Sprite: You must have missed localToGlobal and globalToLocal. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders