Okay teddy bears, I may be doing something really dumb here, but I have
checked my code through thoroughly and can't find any stupid mistakes,
maybe you can spot the deliberate one??
I have a button with a background and a text field.
The button is resized dynamically according to the length of time it
represents and the "resolution".
The size is applied to both the background and the text field.
For some reason, my text field width always ends up 1.5 x the width of
the background ????
Here is some code below - as you can see the _renderWidth is calculated
and applied to both _text and _bg - the trace always shows the text is
1.5 x the _renderWidth - any ideas???
protected function _styleButton(xmlConf:XML):void {
switch(_btnType) {
case CLIP_DRAG_TYPE:
case TIMELINE_TYPE:
//Button maybe sized according to length and has
icon or text label.
this._bg.height = TIMELINE_BTN_HEIGHT;
this._numText.visible = false;
_attachIcon(xmlConf, TIMELINE_BTN_HEIGHT);
//resize button!
var dur:int = duration;
if (_minDuration > duration) {
dur = _minDuration;
}
_renderWidth = int(PIX_PER_SEC * int(Math.max((dur /
_minDuration), 1)));
this._bg.width = _renderWidth;
this._text.width = _renderWidth;
this._text.x = Math.floor((this._bg.width -
this._text.width) / 2);
break;
}
_initialised = true;
trace("ComposeButton::_styleButton " + this.name + " type "
+ _btnType + " width " + this.width + " _numText width " +
this._numText.width + " _text width " + this._text.width + "
_renderWidth " + _renderWidth);
}
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders