ActionScript 2.0 :: Leading Wont Work If AutoSize Is On
Sep 19, 2008why 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]...
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]...
According to the Flash 8 Actionscript Bible, it is possible to set a style that will affect all instances of a certain component class by typing the following code:
ActionScript Code:
import mx.controls.*;
import mx.styles.CSSStyleDeclaration;
_global.styles.componentClassName = new CSSStyleDeclaration();
_global.styles.componentClassName.setStyle("styleAttribute", "value");
A disclaimer says that "[this style technique] will work with almost all of the component classes. However, the following classes will not allow you to set a class style object: List, DataGrid, Tree, and Menu." (ch 29, pg 644)
So why does the following do nothing:
_global.styles.Label = new CSSStyleDeclaration();
_global.styles.Label.setStyle("autoSize", "true");
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";
problem stated in my title. Attach is my code.
Code:
this.createTextField("myText",this.getNextHighestDepth(),23,72,300,400);
//bgPic._alpha = 25;
var titleS:TextFormat = new TextFormat();
titleS.font = "TradeGothic";
[Code]...
How do you set the leading of a block of static text in flash?? As I couldn't find a "leading" control in the panel... (only kerning)
Is there such way to do so without using actionscript such as myText in html format...?
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]....
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 Repliesi 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 RepliesI 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.
I have tried
ActionScript Code:
fontCombo.textField.autosize= TextFieldAutoSize.RIGHT;
ActionScript Code:
[code]......
I've looked in the user manual and I can't find any reference to toString() for syntax information. Isn't there a parameter for me to use to specify the string lenght? And whether to add leading zeros or not?Here's the code I need to add leading zeros:
playbutt.addEventListener(MouseEvent.CLICK, playSound);
function playSound(e:Event){ SoundMixer.stopAll(); var num:Number = Math.ceil(Math.random()*43); bigNum.text = num.toString(); var path:String = "Track No" +
[code].....
I tried the line spacing button, but even setting it at 0 does not get the leading small enough.
View 1 RepliesWhen I set leading to 0 with Verdana (and others to) for a Flex TextArea I get strange results:
fontsize -> space between baselines
8 -> 10 (125%)
10 -> 12 (120%)
[code].....
I'm a noob to actionscript so this should be easy:How do I delete leading characters from a string? I have a string that contains (at times) both numeric & non-numeric characters. If I want to delete all the leading 9's, how would I do that?var testVar:String = '999998gjek74k'; want the testVar to be 'gjek74k'.So far, I have (though not working):
var testVar:String = '999998gjek74k';
testVar.replace(/^0/g, "");
Is there a way to make NumericStepper shows leading 0 to numbers which is below 10 ?
(like 01, 02, 03 ... 09, 10, 11)
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] .....
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].....
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.
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.
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.
I am loading text dynamically (that works), but it won't use the autoSize at all. Below is my code.
[Code].....
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?
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 RepliesI'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.
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]...
Im returning the time as a string from a function like so
return minutes + ":" + seconds + ":" + millisec;
But I need each part to always display with two digits and show leading zeros.
i see this sometimes in tutorials, in some places a variable is referred to as "world" and other places "_world". what is the difference and when do you use which?
View 1 RepliesI 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?
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.
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]...