Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AS3: Resizing Sprite without resizing its children

Status
Not open for further replies.

maguskrool

Technical User
Dec 11, 2006
77
PT
Hi.

I have a class called GalleryItem that extends Sprite. Each GalleryItem has a Loader that loads an image of variable dimensions into it. Now, I want to be able to change the GalleryItem's dimensions without affecting its contents' dimensions. How can I do that?

Thanks in advance.

[a href="[URL unfurl="true"]www.vivoeusebio.com"[/URL] alt="vivóeusébio - design collective" title="vivóeusébio - design collective"]vivóeusébio - design collective[/a]
 
If you resize a Sprite, all of its children will be resized too.

But Sprite is just a transparent container, it doesn't make sense to resize it - the size of a Sprite is the size of its contents.

Or does your Sprite have the background and you want to resize that? If that's the case, instead of drawing the background to the Sprite's graphics, create a child Sprite and draw the background to it. Then you can resize this child Sprite without effecting other siblings in the parent Sprite. (Or redraw the background again in new size.)

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top