开发者

Center static textfield with jsfl: strange results

Using Flash CS3, I'm trying to center a static textfield with jsfl after I've altered its text, like so:

textElement.setTextString( text );

fl.outputPanel.trace( 'text width: ' + textElement.width );
textElement.x = -( textElement.width / 2 );
fl.outputPanel.trace( 'text x: ' +开发者_JAVA百科 textElement.x );

fl.outputPanel.trace( 'text height: ' + textElement.height );
textElement.y = -( textElement.height / 2 );
fl.outputPanel.trace( 'text y: ' + textElement.y );

The traces all give me the correct numbers. However when I open the relevant symbol with said textfield from the library the textfield's position is off by some amount of pixels:

x: varies depending on the text width

y: always -2, no matter the text height

I've even tried the _sans font to see if that made a difference, but it didn't.

Any idea what might be going on here?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜