Skip to main content
Participant
July 28, 2008
Question

Size of sprite different in AS3 and Flash

  • July 28, 2008
  • 2 replies
  • 794 views
When i do a Select All of my symbol in Flash I get a height (lets say 300x300). Even if there are multiple items, it groups them together to give me the total size.

In AS3 I never get the same size. I have tried calling getRect(), width/height, etc... I get a different size, it's close but still invalid, sometimes smaller, sometimes larger.

To replicate this:
1. Create a new sprite with some text, add some paint brushes, etc..
2. Add the sprite to the stage and notice its width and height
3. Give the sprite an instance name (in this case I called it "block")
4. Add a document main source file and add the following code to the constructor (from the bottom of the script)

You will see that the size the code tells you and the size the flash editor gives are different. Is this a bug?
This topic has been closed for replies.

2 replies

kglad
Community Expert
Community Expert
July 28, 2008
1. you're using code to create your sprite and child objects, correct?
2. how are you "noticing" the sprite's properties in the flash ide?
lqdiceAuthor
Participant
July 28, 2008
I'm not adding the sprites dynamically. I am doing it through the Flash editor.

I am noticing the size of the sprite by just what Flash says when I have it selected on the stage.
July 28, 2008
Is the sprite on the stage? If it is, is it on a whole pixel?
lqdiceAuthor
Participant
July 28, 2008
1) yes the sprite is on the stage. It is accessible by AS3 just the size is wrong.

2) no, the sprite is not always a whole pixel, sometimes the size in Flash may be 300.50 x 210.90 etc..