Got a little project I'm working on... My goal is to load a text file, create text field(s), and format them... What I have come up with so far... [Q]this.loadVariables("text.txt", "0"); this.createTextField("text1", 1, 100, 50, 150, 14); text1.background = true; text1.backgroundColor = 0xFFFF00; text1.multiline = true; text1.autoSize = true; text1.wordWrap = true; text1.border = true; //text1.text = "this is even more text to see if this text also appears over multiple lines based on length when created dynamically"; embedFonts = "true"; text1.font = "Arial"; text1.size = "12"; text1.textColor = 0x000088; text1.bold = "true"; text1.variable = "text"; stop(); [/Q] This works partly... I can't seem to embed the fonts or Bold! In addition, this is created in a MC 12 frames long... How would I change the text field for the second frame to load the next part of the text file? Move to a new X/Y cord? With out having to copy, paste and edit the above to each... Or do I need to removeTextField...(think that's right). Would this be possible in an array? If so please do show a sample, I suck at arrays... (haven't had time to learn and profect them)
okay, the code that I sent on the other thread was only a start point... you are setting a lot of attributes of a textFields format... this can all be done in TextFormat() some issues arise because of the order in which your code executes... this.createTextField("text1", 1, 100, 50, 150, 14); text = "this is even more text to see if this text also appears over multiple lines based on length when created dynamically"; applyThisToText = new TextFormat(); applyThisToText.font = "Arial"; applyThisToText.size = "12"; applyThisToText.textColor = 0x000088; applyThisToText.bold = "true"; embedFonts = "true"; with(text1){ background = true; backgroundColor = 0xFFFF00; multiline = true; autoSize = true; wordWrap = true; border = true; } text1.text = text; // note that this is a variable set earlier text1.variable and text1.text CAN BE interchangeable text1.setNewTextFormat(applyThisToText); Now if you go to a different frame and add this... text = "This is some other text that comes from a different variable and should display in the field accordingly"; text1.text = text; you will see the difference in the textFormat but the text value will change... I hope that helps some, cheers,
Don't see what you're looking for? Try a search.
|