开发者

Why would a symbol's height (in code) seem different than its height (in design)

开发者 https://www.devze.com 2023-02-03 12:56 出处:网络
Here\'s the situation: I have a bit of graphical content inside a symbol that I\'ve created in Flash CS5. Let\'s call it FunGraphics_Art, it\'s set to export, and it extends MovieClip.

Here's the situation:

  • I have a bit of graphical content inside a symbol that I've created in Flash CS5. Let's call it FunGraphics_Art, it's set to export, and it extends MovieClip.
  • When I edit the symbol in Flash and I hit control-A, the properties panel tells me that all of the content has a height of 72 pixels, positioned at 0,0.
  • The content consists of a few (classic) textfields, and a couple of Checkbox components and a few bits of vector art.
  • All the content is on a single frame, no layers.

So far, so good. I export my art as a .svc and am able to use it all in code just fine. However I then add the following bit of code to my .as file...

var myArt:FunGraphics_Art = new FunGraphics_Art();
trace("My piece of art开发者_运维知识库 is " + myArt.height + " pixels high!");

And I receive the output...

My piece of art is 147 pixels high!

Somehow, there's something strange going on that's causing Flash to think my exported symbol is about 75 pixels higher than it actually is. I've looked around for invisible "blank" textfields, but haven't found anything yet.

What in the world could be causing this discrepancy?


Flash includes objects hidden with masks in the calculation of the width/height of the parent. Some components use masks, so try temporarily deleting some elements to see if it changes the height, and to see who is causing the issues.


So I discovered the problem went away when I removed the checkboxes, quite possibly due to the masking issue that Adam mentions above.

With a more specific google search, I was able to turn up this thread that has a halfway decent workaround (6th post in)... http://actionscript.org/forums/showthread.php3?t=178933

0

精彩评论

暂无评论...
验证码 换一张
取 消