|
-
Changing MovieClip height without scaling?
Ok, I've tried this several ways and can't seem to find a workaround for what I want. Here's the scenario...
I have a movieclip in the library that contains a RadioButton component and a TextField; it serves as a container. I pull the clip out of the library at runtime and populate the text into the TextField. I don't know what height the TextField within the movieclip will be but I want the movieclip's height to be the same as the height of the text in the TextField so I can position it appropriately. However, the container movieclip always wants to be some other default height (I think 100px) and when I try to change it thru code after the text is set, it scales the whole thing (TextField & RadioButton) and looks like garbage! I need to set the height dynamically without the stupid scaling.
You would think the movieclip would resize based on it's content but it doesn't! bogus! please help me find a workaround...again, I've tried pulling it from the Library, I've tried doing everything thru code, but neither changes the height vs. scaling issue.
-
It's the textfield that's causing the problem - its text doesn't actually control the size of the field. Give this a try:
PHP Code:
txtField.text = 'whatever';
txtField.height = txtField.textHeight;
Please use [php] or [code] tags, and mark your threads resolved 8)
-
sorry, I should've said that I've already accounted for that...the RadioButton is tracing at 14px in height, the TextField (textHeight) is tracing at 26px in height, and the container clip is tracing at 105px in height....and the only contents are these two items. any other ideas???
-
Trace both the textfields height and textHeight - that's where the disconnect is.
Please use [php] or [code] tags, and mark your threads resolved 8)
-
I've already done what you're suggesting...the TextField's height and textHeight are equal at 26px, that is the tallest object in the container and the container STILL traces at 105px in height. I'm baffled.
-
It is most likely because the RadioButton component has not drawn itself yet and it's default height is 100. It probably won't update until the next Event.RENDER or Event.ENTER_FRAME is dispatched. Try forcing it draw with:
PHP Code:
container.radioButton.validateNow();
trace( container.height );
-
I think you're right...it has something to do with the RadioButton's height, or it's Label height...when I remove it, the container sizes itself appropriately.
I tried the "validateNow" approach and nothing...components are great if you don't have any special requirements, then they're a curse! other ideas?
-
Try attaching a Event.ADDED_TO_STAGE listener to the container, then get the height from the event handler. I have had to do similar with ScrollPane and List componets in order to get at properties after the componet has fully initailized.
-
it was the RadioButton, thanks for all your suggestions! here's what I did in succession to get it to work properly (where "radio" is the RadioButton name and "choice" is the container clip...and I'm not using the built-in RadioButton TextField, using my own):
PHP Code:
choice.radio.invalidate("textField");
choice.radio.drawNow();
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|