ActionScript 3.0 :: Autosize MovieClip Box Containing TextField
Dec 1, 2009
I have a TextField that I'm going to populate dynamically in code. Imagine as a simple example a cartoon with the text bubble above the speaker's head, the bubble is a rounded rectangle with some embellishments like drop shadow and a border and such and I want the bubble to be a fixed width but a variable height to accomodate a few words or maybe a long sentence that wraps to three lines. I understand that TextField will do this with autosize and wordwrap, but how do I make the 'bubble' movieclip that contains it also resize accordingly, without writing various hacks involving counting the number of characters and resizing the bubble myself?
View 3 Replies
Similar Posts:
Oct 21, 2011
I want the width and height from the textfield to be set automatically. But if I use:
textField.autoSize = TextFieldAutoSize.RIGHT;
It runs perfectly on the computer. But if I transfer the app to my iPhone and I test it, the textfield turns in the size of one character so the rest I'm typing scrolls out of the textfield area. It's pretty hard to explain what happens, but it just looks like it doesn't set the height and width the right way. And even if I use the
textField.scrollV = 0;
it keeps scrolling.
View 1 Replies
Mar 3, 2010
Really not enjoying myself with AS3 - it's about as userfriendly as an airplane cockpit. I'm sure Flash the program is quite happy with it, but spending hours into weeks trying to implement pretty ordinary functionality is getting really tiring.
I have a textfield loading in html/CSS file. The textfield is in a container mc. I'm trying to use a scrollbar on the textfield, and I need to set the textfield to newsText.autoSize = "left";. When I do this, the textfield displays the entire contents of the html file in the swf, ignoring the textfield size AND the mc size, displaying all the lines in the file in howover many lines are in the html file.
I'm autocenting my swf in the browser, so this of course throws the whole thing off center.
[Code]...
View 1 Replies
Dec 5, 2009
I have text that loads into a dynamic text field that is on the stage. The movie clip("tile" in code below) in which the dynamic text field resides is placed on the stage via loop function.
I can load the text from the xml file just fine.However, since each text field in loop autosizes, which is what I want, (in height only-width is fixed), I want the next text in the loop to load in a Y position based on the previous text box height including a "cushion" of my choosing.
I'm very close, but can't seem to get the math right that is needed for the tiles Y position...I'm thinking this should be simple
Here it is:
Code:
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest("faq.xml"));
xmlLoader.addEventListener(Event.COMPLETE, onXMLLoad, false, 0, true);
[cod].....
View 5 Replies
Dec 21, 2005
how can i make a movieclip and a textfield to resize to the content of the text in the textfield? I mean, if I have a textfield with 3 letters font name XXX and then the content of the field change, how can i resize te textfield so the text dont autoadjust to the 3 letter space?
View 3 Replies
Oct 27, 2006
I have two dynamic text fields on the stage. How can set the text to autoSize? I have this, but it's not working.
Code:
w.text.autoSize = true;
w.text = "100";
h.text.autoSize = true;
h.text = "100";
View 1 Replies
Mar 19, 2012
I'm using a datagrid in my flash project to create a step action table that is populated by an XML file. The number of steps in the table will change from time to time, so I'd like to somehow make the datagrid length set to auto if possible. In the code below you see that grid.setSize(316,1100);. In it's current format the table will either be too long or too short when I update it's contents from time to time via the XML file. This will cause either a lot of extra white space at the bottom while scrolling or if too short it will cut off the table.
Actionscript Code:
import fl.controls.DataGrid; import fl.controls.dataGridClasses.DataGridColumn; import fl.data.DataProvider; import fl.controls.ScrollPolicy; var loader:URLLoader = new URLLoader(new
[code]....
View 2 Replies
Feb 10, 2010
i use a embeded font, and the text width is set to autosize, but some times when i go fullscreen or scale the stage, the text get croped, just a few px,are thre a way to make autosize more stable?
View 2 Replies
Mar 8, 2011
I downloaded an Interactive Map from Active Den ... it came with an XML file that allows me to change some parts, but the part thatI need to change is not covered in the XML ... it needs to be changed in the Action Script.[URL]Basically when a landmark is moused over ... a box pops up that contains hrml (images, text. links, etc)The XML file allows me to set the max width of the pop up box.
The issue is that i need a box that is 225 px wide ... I also need another box that is 400 px wide The XML only allows me the set one width ... so I need another box (one for vertical layout, and one for horizontal layout) I thought I could duplicate the pop up box mc, and the box's Action Script (give them different names) and that would work, but I don't know exactly which parts to edit. [URL]Also, there is a screen shot of all movie clips, but the only mc that has any actions attached to it is "zoom_pan" it's at the very bottom of the list.
View 1 Replies
Nov 15, 2009
I have tried
ActionScript Code:
fontCombo.textField.autosize= TextFieldAutoSize.RIGHT;
ActionScript Code:
[code]......
View 0 Replies
Feb 10, 2011
I am facing problem related to TextArea auto wrap. I used the following code I found on net to fix this however it is not working.
addEventListener(FlexEvent.CREATION_COMPLETE,onCre ationComplete);
protected function onCreationComplete(event:FlexEvent):void {
//textAreaControl is the id of the control you want to resize to contain it's text.
updateSize();
} protected function updateSize():void {
if(mx_internal::getTextField() != null) {
[Code] .....
View 2 Replies
Feb 10, 2011
I am facing problem related to TextArea auto wrap. I used the following code I found on net to fix this however it is not working.
[Code].....
View 6 Replies
Mar 21, 2011
In the past, I used the flash.text.textField object something like this:
tf = textField();
tf.autoWrap = true
tf.autoSize = "left"
tf.width = 100;
[Code]...
I'm coding this, so if you have some suggestions, please post them in code, not MXML.
but UITextfield is not a TLF component and the example for RichText does not cause the RichText height to grow with the text. What I need is a component that I can set the width, add TLF formatted text and get the height of the component once it has rendered. Just like a TextField does when you add text.
View 3 Replies
Apr 15, 2011
I have done lots of searching on this subject, but it seems what I am finding is either out of date or just does not seem to work.With TextFields in the past, you could set the TextField to a certain width, set wordWrap to true and you would end up with a textfield that changed height according to the text you added.Now I am trying to do this with either the Spark TextArea or RichText.I tried this HeightInLines = NAN, but that seems to be out of date.I also tried this routine:
var totalHeight:uint = 10;
this.validateNow();
var noOfLines:int = this.mx_internal::getTextField().numLines;[code]....
But the mx_internal is not in the Spark components.I am trying to do this with AS3, not MXML.
View 5 Replies
Sep 25, 2006
I am loading text dynamically (that works), but it won't use the autoSize at all. Below is my code.
[Code].....
View 8 Replies
Jun 25, 2007
Trying to accomplish the simplest thing ever.. with no success.I want to create a textfield (all scripted) with a specified width (420) and a varying height:
Code:
txt = this.createTextField("body_txt", this.getNextHighestDepth(), 0, 0, 420, 0);
txt.multiline = true;
txt.autoSize = true;
txt.text = text from xml going here........;
This code changes the width.If I remove "autoSize", I see no text (as the height is "0"); WTF? How do I keep the width the same as what I've set, and modify the height?
View 3 Replies
Jul 13, 2007
I know that the autoSize works fine for textfields (loading contents from a XML, for example), but and for movieclips? There's a way to set this?
View 6 Replies
Oct 7, 2007
I've been banging my head against the wall, on something that should be straight forward..granted Im a novice at this....
I have a text field that is fed by an array of titles. The longer title are geting cuttoff in the field box, and Ive tried to autoscale.
View 4 Replies
Sep 19, 2008
why I cant apply leading to a text field if autoSize is on? I am using a new TextFormat and applying the leading after I autoSize...
[Code]...
View 7 Replies
Apr 15, 2005
I have a problem with the text on them.I want the text to wrap, autosize and be multiline - ie I want the button to be a certain width and if the text is longer for a particular button the button will be higher with the text going onto the next line.The wierd thing is that it worked, I went and made a cup of tea, came back and it was not working! Maybe the cat changed my code but I cannot see where.
[code]...
View 3 Replies
Mar 23, 2010
I have a dynamic text field populated by xml which doesn't seem to like the autoSize property. The field populates correctly but doesn't auto size at all. The purpose of this text field is to inform the user of the url for an ad they can click on as they roll over it.
ActionScript Code:
popUpmc.popUpTxt.autoSize = true;
Setting autoSize while inside the XML onLoad() function and outside it made no difference. Please help, I'm sure I must be forgetting something? Does this have to be applied with a new text format or something?
View 0 Replies
Nov 14, 2010
I have the following code to populate a dynamic text box:
Code:
myData = new LoadVars();
myData.onLoad = function() {
trace ("The text box before autosize is: " + sailing_txt._height);
sailing_txt.htmlText = unescape(this.myVariable);
sailing_txt.autoSize = true;
trace ("The text box after autosize is: " + sailing_txt._height);
};
myData.load("sailing.txt");
The output of this is:
The text box before autosize is: 388.25
The text box after autosize is: 712.5
My problem is that I need to get the autosized height instead of the regular height of the text box before autosize. In a parent movie clip I have the following code to do some custom scrolling:
Code:
contentHeight = _parent.scrolledMC.sailing_txt._height;
trace("The content height is: " + contentHeight);
The output of this is:
The content height is: 388.25
So it's getting the size of the text box before it's autosized.
View 2 Replies
Feb 10, 2011
I am facing problem related to TextArea auto wrap.
I used the following code I found on net to fix this however it is not working.
[Code]...
View 3 Replies
Jan 23, 2009
I have a movieclip, with a dynamic text inside.This movieclip is already on stage.I have found several solutions to this TextFieldAutoResize, however, most of them requires to create a new text before implementing TextFieldAutoResize.LEFT or right or center or .... etcIs there any method to apply auto resize on dynamic text which are already placed on stage?
View 8 Replies
Jan 22, 2009
I have a problem with loading text from a *.txt file into a dynamic textfield which is located in a movieclip in another movieclip. It seems it can't find the textfield because it is in movieclips. I know I shouldn't work with the '_root' command but in my project it doesn't matter. Also tried making '_root' globalmain to 'this'. But that still doesn't do the trick.
Code:
tdata = new LoadVars();
tdata.onLoad = function(success) {
if (success) {
[code]....
View 2 Replies
Mar 20, 2009
I've got a MovieClip on the MainTimeline: mc_back I want to dynamcially add textfields to it:
[Code]...
It's not working. No errors, no nothing, but the textFields don't show up when I run it.
View 1 Replies
Aug 3, 2009
Code:
var tf:TextField = new TextField();
tf.text = "abc";
var mc:MovieClip = new MovieClip();
mc.addChild(tf);
trace(mc.tf.text);
Why does the trace statement throw me an error?
View 1 Replies
Apr 28, 2010
I'm just a beginner and I wanted to know if it is possible to change a textfield into a movieclip, and how could I do this.
View 3 Replies
Nov 12, 2008
I have a Movieclip which is abstract called ScreenItem. This is extended by MenuObject which creates several MenuItem objects which are a separate MovieClip class. I would like to display textFields inside my MenuItems but when I add them they just don't show up. If i set them as selectable then I get a text select cursor when i run the swf but no visible text. The same code works fine if i add the MenuItem directly to the main timeline.
View 6 Replies
Oct 21, 2009
I'm adding text to a movieclip as you can see below. The text is alomost not visible because it's so small. If I don't scale the movieclip then the text becomes clipped. I basically want the movieclip to be a tight container (the same size as the textfield) for the Textfield. The below does not work. How can I do this?
[Code]....
View 1 Replies