Nope. Wish it was, too! David stiller (at) quip (dot) net "Luck is the residue of good design."
NSurveyor, I haven't read through all your code yet, but are you saying it creates as many text fields as there are words, so that each word can be checked because it exists as its own text field? If so, that is a workaround (about the only one I can think of). I would wonder, though, how much that would cause the CPU to chug, given the possibility for thousands of words. David stiller (at) quip (dot) net "Luck is the residue of good design."
Aha. Nice approach. The more I think about that, that's a *really* nice approach. As it turns out, you may be able to use the TextFormat.getTextExtent() method instead of going to the trouble of creating a new text field. This is an idea worth toying with. Good inspiration! David stiller (at) quip (dot) net "Luck is the residue of good design."
Look at TextFormat.getTextExtent(). You can pass a string to that method and get the length of that string based on font family, font size, and so on. In the Flash 7 Player, you can even specify the width of the text field. David stiller (at) quip (dot) net "Luck is the residue of good design."
Hello guys. Is it possible to find the x and y position of a given character into a textField? I mean, if I know the position of that caracter in terms of the total number of caracters, can I find its _x and its _y, like in Director? Thanks so much. :music;
I'm not quite sure if this script works competely, but it's worth a shot: charXY(INSTANCENAMEOFTEXTBOX,INDEXOFCHAR)._x;//This is the _x of the char at the INDEXOFCHAR charXY(INSTANCENAMEOFTEXTBOX,INDEXOFCHAR)._y;//This is the _y of the char at the INDEXOFCHAR function charXY (st,theCharAt) { createTextField("testText",1,st._x,st._y,st._width,st._height); testFormat = new TextFormat(); for(props in st){ testText[props] = st[props] } for(item in st.getTextFormat()){ testFormat[item] = st.getTextFormat()[item] } testText.setNewTextFormat(testFormat); ctext = testText.text; partText = new String(); for(ccount = 0;ccount<=theCharAt;ccount++){ partText+=ctext.charAt(ccount); } testText.text = partText; coor = new Object(); coor._y = testText.textHeight+testText._y; coor._x = testText.textWidth+testText._x; testText.text = ctext; delete(textText); return coor; }
It's a long work around, that probably doesn't work competely. Basically, it duplicates a text box, but this textbox will only have the characters up to the given index. Then, it adds the _x of the textbox with the textWidth of the new textbox, and it adds the _y of the textbox with the textHeight, and returns those two values as, charXY(myTextbox,someIndex)._x and charXY(myTextbox,someIndex)._y
No, only one textfield is made. It make a textbox identical to the original, but only contains up to a certain amount of characters. Then I used _x+textWidth and _y+textHeight to figure out where the last charachter in the textbox is (and because it is limited to a specified character, the last character is the specified character)
But, I think this script will only work on textboxes with Left-Alignment, because the abscence of characters in a textbox with Center Alignment and Right Alignment will change the _x and _y of most characters.
Actually, I don't think my script really works. the textHeight and textWidth of multilined textboxes will not really help me get the last character of that line's x and y. And that's what I was trying to do. Oh well, it almost worked...
Don't see what you're looking for? Try a search.
|