Re: [Flashcoders] TextField width bizarrenesss
The only reason for the naming convention was that it's a button and it has simple behaviour / presence. Besides, packages make name collisions less likely and we don't import flash.display.* here - that's for suckers ;) But if any suckers turn up, I am armed with some nifty JSFL and FD's search/replace facility. Henrik Andersson wrote: Glen Pike wrote: It's a subclass of a subclass of Sprite, both of which are handrolled. Sprite-SimpleButton-ComposeButton You do realize that flash already has a class called SimpleButton, right? It is far from impossible to make one with the same name, but you are asking for name collisions. I hope that you have a good reason for the name. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] TextField width bizarrenesss
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
Re: [Flashcoders] TextField width bizarrenesss
StupuidQuestionSoPleaseDon'tHitMeI'mTryingToHelpEvenThoughThisIsLame... Has there been a scaleX applied to any of the items (_bg, _text, this). That's the only way I could reproduce your results. Jer ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] TextField width bizarrenesss
Thanks - I don't think so - I have checked through the code for scaling, but not apparent. I even resized my graphics for the clips so the children are not scaled at all in the IDE... Jer Brand wrote: StupuidQuestionSoPleaseDon'tHitMeI'mTryingToHelpEvenThoughThisIsLame... Has there been a scaleX applied to any of the items (_bg, _text, this). That's the only way I could reproduce your results. Jer ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] TextField width bizarrenesss
Yeah, I tried different ways of scaling the mc's in the IDE and couldn't reproduce the results -- scaling in the IDE is just adjusting width/height not scalex/y. Nother stupid question, but this is a MovieClip instance type or an actual Button instance type? I assumed MC, just because I haven't used Buttons in years. Don't know if it helps, but your code does exactly what it's supposed to do for me. Jer ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] TextField width bizarrenesss
It's a subclass of a subclass of Sprite, both of which are handrolled. I thought it was possibly to do with 9slice scaling or something, but no. It's bizarre - I might clear out my FLA and see.. Sprite-SimpleButton-ComposeButton Jer Brand wrote: Yeah, I tried different ways of scaling the mc's in the IDE and couldn't reproduce the results -- scaling in the IDE is just adjusting width/height not scalex/y. Nother stupid question, but this is a MovieClip instance type or an actual Button instance type? I assumed MC, just because I haven't used Buttons in years. Don't know if it helps, but your code does exactly what it's supposed to do for me. Jer ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] TextField width bizarrenesss
Glen Pike wrote: It's a subclass of a subclass of Sprite, both of which are handrolled. Sprite-SimpleButton-ComposeButton You do realize that flash already has a class called SimpleButton, right? It is far from impossible to make one with the same name, but you are asking for name collisions. I hope that you have a good reason for the name. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders