RE: [Flashcoders] finding x of sprite
Your sprite position is 0 and IN there, there is the rectangle at 15 px. trace(mSprite.width); // //set mSprite's x mSprite.x = 15; -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: donderdag 25 februari 2010 13:29 To: Flash Coders List Subject: [Flashcoders] finding x of sprite given the following: var msprite:Sprite = new Sprite(); mSprite.graphics.beginFill(0x00,.1); mSprite.graphics.drawRect(15,337,646,207); mSprite.graphics.endFill(); addChild(mSprite); trace(mSprite.x = +mSprite.x); I would think that I should be tracing mSprite.x = 15 instead I get mSprite = 0 Anyone know why? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.733 / Virus Database: 271.1.1/2707 - Release Date: 02/24/10 08:34:00 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] finding x of sprite
No, mSprite.x = 0 refers to the x-position of mSprite in the coordinate space of mSprite's parent (which is (0,0) by default if you never set it). The expected x=15 is the position of the newly drawn rectangle in the coordinate space of mSprite. localToGlobal does not refer to Points per se (as mentioned in your earlier post) but it lets you swap the local coordinate space of an object with the global coordinate space (i.e. the coordinate space of the stage) Willem On 25-feb-2010, at 13:28, Lehr, Theodore wrote: given the following: var msprite:Sprite = new Sprite(); mSprite.graphics.beginFill(0x00,.1); mSprite.graphics.drawRect(15,337,646,207); mSprite.graphics.endFill(); addChild(mSprite); trace(mSprite.x = +mSprite.x); I would think that I should be tracing mSprite.x = 15 instead I get mSprite = 0 Anyone know why? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= Geografiek is a Dutch, Utrecht-based map and chart design company. Willem van den Goorbergh can be contacted by telephone: (+31) 30-2719512 or cell phone: (+31)6-26372378 or by fax: (+31)302719687 snail mail: Hooghiemstraplein 89 3514 AX UTRECHT Visit our website at: http://www.geografiek.nl =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] finding x of sprite
wow - this is something I am ging to have to wrapped my head around I set the x,y of the sprite at creation to: 15, 337 (with a w,h of 646,207) BUT the x/y traces as 0,0 if I do: spret.x = 15; it moves it 15 as related to the original 15... so it is REALLY at 30 on the stage AND then when I move it 15 (which should really be 30) it traces to 15 It just occired to me that maybe I should create it at 0,0 and then move it to where I want it to be From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor [c...@chello.nl] Sent: Thursday, February 25, 2010 7:38 AM To: 'Flash Coders List' Subject: RE: [Flashcoders] finding x of sprite Your sprite position is 0 and IN there, there is the rectangle at 15 px. trace(mSprite.width); // //set mSprite's x mSprite.x = 15; -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: donderdag 25 februari 2010 13:29 To: Flash Coders List Subject: [Flashcoders] finding x of sprite given the following: var msprite:Sprite = new Sprite(); mSprite.graphics.beginFill(0x00,.1); mSprite.graphics.drawRect(15,337,646,207); mSprite.graphics.endFill(); addChild(mSprite); trace(mSprite.x = +mSprite.x); I would think that I should be tracing mSprite.x = 15 instead I get mSprite = 0 Anyone know why? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.733 / Virus Database: 271.1.1/2707 - Release Date: 02/24/10 08:34:00 ___ 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] finding x of sprite
Correct: drawrect(0,0, yourwidth, yourheight); Unless you would like to add more then one thing in the sprite. Look at the sprite as a container/holder/box. You can move the thing in the box around without moving the position of the box itself. HTH Cor -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: donderdag 25 februari 2010 13:58 To: Flash Coders List Subject: RE: [Flashcoders] finding x of sprite wow - this is something I am ging to have to wrapped my head around I set the x,y of the sprite at creation to: 15, 337 (with a w,h of 646,207) BUT the x/y traces as 0,0 if I do: spret.x = 15; it moves it 15 as related to the original 15... so it is REALLY at 30 on the stage AND then when I move it 15 (which should really be 30) it traces to 15 It just occired to me that maybe I should create it at 0,0 and then move it to where I want it to be From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor [c...@chello.nl] Sent: Thursday, February 25, 2010 7:38 AM To: 'Flash Coders List' Subject: RE: [Flashcoders] finding x of sprite Your sprite position is 0 and IN there, there is the rectangle at 15 px. trace(mSprite.width); // //set mSprite's x mSprite.x = 15; -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: donderdag 25 februari 2010 13:29 To: Flash Coders List Subject: [Flashcoders] finding x of sprite given the following: var msprite:Sprite = new Sprite(); mSprite.graphics.beginFill(0x00,.1); mSprite.graphics.drawRect(15,337,646,207); mSprite.graphics.endFill(); addChild(mSprite); trace(mSprite.x = +mSprite.x); I would think that I should be tracing mSprite.x = 15 instead I get mSprite = 0 Anyone know why? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.733 / Virus Database: 271.1.1/2707 - Release Date: 02/24/10 08:34:00 ___ 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 No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.733 / Virus Database: 271.1.1/2707 - Release Date: 02/24/10 08:34:00 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] finding x of sprite
Play around with this: var mSprite:Sprite = new Sprite(); mSprite.graphics.beginFill(0x00,.1); mSprite.graphics.drawRect(0,0,200,100); mSprite.graphics.endFill(); mSprite.graphics.beginFill(0x99,.3); mSprite.graphics.drawRect(100,50,200,100); mSprite.graphics.endFill(); mSprite.x = (stage.stageWidth-mSprite.width)*.5; mSprite.y = (stage.stageHeight-mSprite.height)*.5; addChild(mSprite); -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: donderdag 25 februari 2010 13:58 To: Flash Coders List Subject: RE: [Flashcoders] finding x of sprite wow - this is something I am ging to have to wrapped my head around I set the x,y of the sprite at creation to: 15, 337 (with a w,h of 646,207) BUT the x/y traces as 0,0 if I do: spret.x = 15; it moves it 15 as related to the original 15... so it is REALLY at 30 on the stage AND then when I move it 15 (which should really be 30) it traces to 15 It just occired to me that maybe I should create it at 0,0 and then move it to where I want it to be From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor [c...@chello.nl] Sent: Thursday, February 25, 2010 7:38 AM To: 'Flash Coders List' Subject: RE: [Flashcoders] finding x of sprite Your sprite position is 0 and IN there, there is the rectangle at 15 px. trace(mSprite.width); // //set mSprite's x mSprite.x = 15; -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: donderdag 25 februari 2010 13:29 To: Flash Coders List Subject: [Flashcoders] finding x of sprite given the following: var msprite:Sprite = new Sprite(); mSprite.graphics.beginFill(0x00,.1); mSprite.graphics.drawRect(15,337,646,207); mSprite.graphics.endFill(); addChild(mSprite); trace(mSprite.x = +mSprite.x); I would think that I should be tracing mSprite.x = 15 instead I get mSprite = 0 Anyone know why? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.733 / Virus Database: 271.1.1/2707 - Release Date: 02/24/10 08:34:00 ___ 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 No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.733 / Virus Database: 271.1.1/2707 - Release Date: 02/24/10 08:34:00 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] finding x of sprite
In the code example below it looks like you set the x,y of the rectangle that is IN the sprite to 15,337. The sprite default position of the sprite is 0,0 Sprite.x = 0; Sprite.rectangle.x = 15; -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: Thursday, February 25, 2010 7:58 AM To: Flash Coders List Subject: RE: [Flashcoders] finding x of sprite wow - this is something I am ging to have to wrapped my head around I set the x,y of the sprite at creation to: 15, 337 (with a w,h of 646,207) BUT the x/y traces as 0,0 if I do: spret.x = 15; it moves it 15 as related to the original 15... so it is REALLY at 30 on the stage AND then when I move it 15 (which should really be 30) it traces to 15 It just occired to me that maybe I should create it at 0,0 and then move it to where I want it to be From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor [c...@chello.nl] Sent: Thursday, February 25, 2010 7:38 AM To: 'Flash Coders List' Subject: RE: [Flashcoders] finding x of sprite Your sprite position is 0 and IN there, there is the rectangle at 15 px. trace(mSprite.width); // //set mSprite's x mSprite.x = 15; -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: donderdag 25 februari 2010 13:29 To: Flash Coders List Subject: [Flashcoders] finding x of sprite given the following: var msprite:Sprite = new Sprite(); mSprite.graphics.beginFill(0x00,.1); mSprite.graphics.drawRect(15,337,646,207); mSprite.graphics.endFill(); addChild(mSprite); trace(mSprite.x = +mSprite.x); I would think that I should be tracing mSprite.x = 15 instead I get mSprite = 0 Anyone know why? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.733 / Virus Database: 271.1.1/2707 - Release Date: 02/24/10 08:34:00 ___ 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 mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] finding x of sprite
Lehr, Theodore wrote: wow - this is something I am ging to have to wrapped my head around I set the x,y of the sprite at creation to: 15, 337 (with a w,h of 646,207) BUT the x/y traces as 0,0 if I do: spret.x = 15; it moves it 15 as related to the original 15... so it is REALLY at 30 on the stage AND then when I move it 15 (which should really be 30) it traces to 15 It just occired to me that maybe I should create it at 0,0 and then move it to where I want it to be No, you set the rectangle that you drew INSIDE the sprite to be at (15,337). You didn't move the sprite from (0,0). The rectangle and sprite are different things. You can draw the rectangle inside the sprite wherever you wish. Then you can move the sprite if you wish. The sprite is a container for the rectangle. Paul From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor [c...@chello.nl] Sent: Thursday, February 25, 2010 7:38 AM To: 'Flash Coders List' Subject: RE: [Flashcoders] finding x of sprite Your sprite position is 0 and IN there, there is the rectangle at 15 px. trace(mSprite.width); // //set mSprite's x mSprite.x = 15; -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: donderdag 25 februari 2010 13:29 To: Flash Coders List Subject: [Flashcoders] finding x of sprite given the following: var msprite:Sprite = new Sprite(); mSprite.graphics.beginFill(0x00,.1); mSprite.graphics.drawRect(15,337,646,207); mSprite.graphics.endFill(); addChild(mSprite); trace(mSprite.x = +mSprite.x); I would think that I should be tracing mSprite.x = 15 instead I get mSprite = 0 Anyone know why? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.733 / Virus Database: 271.1.1/2707 - Release Date: 02/24/10 08:34:00 ___ 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 mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] finding x of sprite
yeah - but the goofy thing is that when I trace the height and width I get the height and width of the rectangle IN the sprite... my assumption would be that I would basically get back the dimensions of the stage if that is how big the sprite is From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Ross (N-SGIS) [ross.l...@lmco.com] Sent: Thursday, February 25, 2010 8:12 AM To: Flash Coders List Subject: RE: [Flashcoders] finding x of sprite In the code example below it looks like you set the x,y of the rectangle that is IN the sprite to 15,337. The sprite default position of the sprite is 0,0 Sprite.x = 0; Sprite.rectangle.x = 15; -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: Thursday, February 25, 2010 7:58 AM To: Flash Coders List Subject: RE: [Flashcoders] finding x of sprite wow - this is something I am ging to have to wrapped my head around I set the x,y of the sprite at creation to: 15, 337 (with a w,h of 646,207) BUT the x/y traces as 0,0 if I do: spret.x = 15; it moves it 15 as related to the original 15... so it is REALLY at 30 on the stage AND then when I move it 15 (which should really be 30) it traces to 15 It just occired to me that maybe I should create it at 0,0 and then move it to where I want it to be From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor [c...@chello.nl] Sent: Thursday, February 25, 2010 7:38 AM To: 'Flash Coders List' Subject: RE: [Flashcoders] finding x of sprite Your sprite position is 0 and IN there, there is the rectangle at 15 px. trace(mSprite.width); // //set mSprite's x mSprite.x = 15; -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: donderdag 25 februari 2010 13:29 To: Flash Coders List Subject: [Flashcoders] finding x of sprite given the following: var msprite:Sprite = new Sprite(); mSprite.graphics.beginFill(0x00,.1); mSprite.graphics.drawRect(15,337,646,207); mSprite.graphics.endFill(); addChild(mSprite); trace(mSprite.x = +mSprite.x); I would think that I should be tracing mSprite.x = 15 instead I get mSprite = 0 Anyone know why? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.733 / Virus Database: 271.1.1/2707 - Release Date: 02/24/10 08:34:00 ___ 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 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] finding x of sprite
the sprite width and also the height is the max width/height of all its content -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: donderdag 25 februari 2010 14:27 To: Flash Coders List Subject: RE: [Flashcoders] finding x of sprite yeah - but the goofy thing is that when I trace the height and width I get the height and width of the rectangle IN the sprite... my assumption would be that I would basically get back the dimensions of the stage if that is how big the sprite is From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Ross (N-SGIS) [ross.l...@lmco.com] Sent: Thursday, February 25, 2010 8:12 AM To: Flash Coders List Subject: RE: [Flashcoders] finding x of sprite In the code example below it looks like you set the x,y of the rectangle that is IN the sprite to 15,337. The sprite default position of the sprite is 0,0 Sprite.x = 0; Sprite.rectangle.x = 15; -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: Thursday, February 25, 2010 7:58 AM To: Flash Coders List Subject: RE: [Flashcoders] finding x of sprite wow - this is something I am ging to have to wrapped my head around I set the x,y of the sprite at creation to: 15, 337 (with a w,h of 646,207) BUT the x/y traces as 0,0 if I do: spret.x = 15; it moves it 15 as related to the original 15... so it is REALLY at 30 on the stage AND then when I move it 15 (which should really be 30) it traces to 15 It just occired to me that maybe I should create it at 0,0 and then move it to where I want it to be From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor [c...@chello.nl] Sent: Thursday, February 25, 2010 7:38 AM To: 'Flash Coders List' Subject: RE: [Flashcoders] finding x of sprite Your sprite position is 0 and IN there, there is the rectangle at 15 px. trace(mSprite.width); // //set mSprite's x mSprite.x = 15; -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: donderdag 25 februari 2010 13:29 To: Flash Coders List Subject: [Flashcoders] finding x of sprite given the following: var msprite:Sprite = new Sprite(); mSprite.graphics.beginFill(0x00,.1); mSprite.graphics.drawRect(15,337,646,207); mSprite.graphics.endFill(); addChild(mSprite); trace(mSprite.x = +mSprite.x); I would think that I should be tracing mSprite.x = 15 instead I get mSprite = 0 Anyone know why? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.733 / Virus Database: 271.1.1/2707 - Release Date: 02/24/10 08:34:00 ___ 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 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 No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.733 / Virus Database: 271.1.1/2707 - Release Date: 02/24/10 08:34:00 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] finding x of sprite
Lehr, try this code, hopefully it should explain... function drawDot(targetSprite:Sprite, size:int):void { targetSprite.graphics.beginFill(0); targetSprite.graphics.drawCircle(0,0,size/2); targetSprite.graphics.beginFill(0); } var originOfStage:Sprite = new Sprite(); addChild(originOfStage); drawDot(originOfStage,5); var spriteAt100x100y:Sprite = new Sprite(); spriteAt100x100y.x = 100; spriteAt100x100y.y = 100; addChild(spriteAt100x100y); drawDot(spriteAt100x100y,5); var childSpriteAt100x100y:Sprite = new Sprite(); childSpriteAt100x100y.x = 100; childSpriteAt100x100y.y = 100; spriteAt100x100y.addChild(childSpriteAt100x100y); drawDot(childSpriteAt100x100y,5); you will see a dot at 0,0, another one at 100,100 and a third at 200,200. a child's position is automatically relative to it's parents position, the child of the spriteAt100x100y has it's x and y set to 100, but seeing as it's parent is at 100,100 relative to the origin it appears at 200,200. hth. On 25 February 2010 14:35, Cor c...@chello.nl wrote: the sprite width and also the height is the max width/height of all its content -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: donderdag 25 februari 2010 14:27 To: Flash Coders List Subject: RE: [Flashcoders] finding x of sprite yeah - but the goofy thing is that when I trace the height and width I get the height and width of the rectangle IN the sprite... my assumption would be that I would basically get back the dimensions of the stage if that is how big the sprite is From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Ross (N-SGIS) [ross.l...@lmco.com] Sent: Thursday, February 25, 2010 8:12 AM To: Flash Coders List Subject: RE: [Flashcoders] finding x of sprite In the code example below it looks like you set the x,y of the rectangle that is IN the sprite to 15,337. The sprite default position of the sprite is 0,0 Sprite.x = 0; Sprite.rectangle.x = 15; -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: Thursday, February 25, 2010 7:58 AM To: Flash Coders List Subject: RE: [Flashcoders] finding x of sprite wow - this is something I am ging to have to wrapped my head around I set the x,y of the sprite at creation to: 15, 337 (with a w,h of 646,207) BUT the x/y traces as 0,0 if I do: spret.x = 15; it moves it 15 as related to the original 15... so it is REALLY at 30 on the stage AND then when I move it 15 (which should really be 30) it traces to 15 It just occired to me that maybe I should create it at 0,0 and then move it to where I want it to be From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor [c...@chello.nl] Sent: Thursday, February 25, 2010 7:38 AM To: 'Flash Coders List' Subject: RE: [Flashcoders] finding x of sprite Your sprite position is 0 and IN there, there is the rectangle at 15 px. trace(mSprite.width); // //set mSprite's x mSprite.x = 15; -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: donderdag 25 februari 2010 13:29 To: Flash Coders List Subject: [Flashcoders] finding x of sprite given the following: var msprite:Sprite = new Sprite(); mSprite.graphics.beginFill(0x00,.1); mSprite.graphics.drawRect(15,337,646,207); mSprite.graphics.endFill(); addChild(mSprite); trace(mSprite.x = +mSprite.x); I would think that I should be tracing mSprite.x = 15 instead I get mSprite = 0 Anyone know why? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.733 / Virus Database: 271.1.1/2707 - Release Date: 02/24/10 08:34:00 ___ 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 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 No virus found in this incoming message. Checked by AVG - www.avg.com
RE: [Flashcoders] finding x of sprite
thanks! From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of tom rhodes [tom.rho...@gmail.com] Sent: Thursday, February 25, 2010 8:54 AM To: Flash Coders List Subject: Re: [Flashcoders] finding x of sprite Lehr, try this code, hopefully it should explain... function drawDot(targetSprite:Sprite, size:int):void { targetSprite.graphics.beginFill(0); targetSprite.graphics.drawCircle(0,0,size/2); targetSprite.graphics.beginFill(0); } var originOfStage:Sprite = new Sprite(); addChild(originOfStage); drawDot(originOfStage,5); var spriteAt100x100y:Sprite = new Sprite(); spriteAt100x100y.x = 100; spriteAt100x100y.y = 100; addChild(spriteAt100x100y); drawDot(spriteAt100x100y,5); var childSpriteAt100x100y:Sprite = new Sprite(); childSpriteAt100x100y.x = 100; childSpriteAt100x100y.y = 100; spriteAt100x100y.addChild(childSpriteAt100x100y); drawDot(childSpriteAt100x100y,5); you will see a dot at 0,0, another one at 100,100 and a third at 200,200. a child's position is automatically relative to it's parents position, the child of the spriteAt100x100y has it's x and y set to 100, but seeing as it's parent is at 100,100 relative to the origin it appears at 200,200. hth. On 25 February 2010 14:35, Cor c...@chello.nl wrote: the sprite width and also the height is the max width/height of all its content -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: donderdag 25 februari 2010 14:27 To: Flash Coders List Subject: RE: [Flashcoders] finding x of sprite yeah - but the goofy thing is that when I trace the height and width I get the height and width of the rectangle IN the sprite... my assumption would be that I would basically get back the dimensions of the stage if that is how big the sprite is From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Ross (N-SGIS) [ross.l...@lmco.com] Sent: Thursday, February 25, 2010 8:12 AM To: Flash Coders List Subject: RE: [Flashcoders] finding x of sprite In the code example below it looks like you set the x,y of the rectangle that is IN the sprite to 15,337. The sprite default position of the sprite is 0,0 Sprite.x = 0; Sprite.rectangle.x = 15; -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: Thursday, February 25, 2010 7:58 AM To: Flash Coders List Subject: RE: [Flashcoders] finding x of sprite wow - this is something I am ging to have to wrapped my head around I set the x,y of the sprite at creation to: 15, 337 (with a w,h of 646,207) BUT the x/y traces as 0,0 if I do: spret.x = 15; it moves it 15 as related to the original 15... so it is REALLY at 30 on the stage AND then when I move it 15 (which should really be 30) it traces to 15 It just occired to me that maybe I should create it at 0,0 and then move it to where I want it to be From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor [c...@chello.nl] Sent: Thursday, February 25, 2010 7:38 AM To: 'Flash Coders List' Subject: RE: [Flashcoders] finding x of sprite Your sprite position is 0 and IN there, there is the rectangle at 15 px. trace(mSprite.width); // //set mSprite's x mSprite.x = 15; -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: donderdag 25 februari 2010 13:29 To: Flash Coders List Subject: [Flashcoders] finding x of sprite given the following: var msprite:Sprite = new Sprite(); mSprite.graphics.beginFill(0x00,.1); mSprite.graphics.drawRect(15,337,646,207); mSprite.graphics.endFill(); addChild(mSprite); trace(mSprite.x = +mSprite.x); I would think that I should be tracing mSprite.x = 15 instead I get mSprite = 0 Anyone know why? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.733 / Virus Database: 271.1.1/2707 - Release Date: 02/24/10 08:34:00 ___ 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 mailing list Flashcoders@chattyfig.figleaf.com
Re: [Flashcoders] finding x of sprite
Lehr, Theodore wrote: given the following: var msprite:Sprite = new Sprite(); mSprite.graphics.beginFill(0x00,.1); mSprite.graphics.drawRect(15,337,646,207); mSprite.graphics.endFill(); addChild(mSprite); trace(mSprite.x = +mSprite.x); I would think that I should be tracing mSprite.x = 15 instead I get mSprite = 0 Anyone know why? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Check out the getBounds method. It will really help you here. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders