ActionScript 3.0 :: Getting Line Index From TextField Word?
Aug 23, 2010Is there a way to get the line index from a specific word in a textfield?
View 1 RepliesIs there a way to get the line index from a specific word in a textfield?
View 1 RepliesHow can I break the last word of a line in a textField so that it will break with a "-" if the word is too long.
The width of the textField is fixed.
I want to search a word in a textfiled which is multi line , finding it is not a big deal but am i able to scroll to that position , like notepad when you click find next it will jump to that point
var textInput:String="String To Search";
txt.text=textInput; // txt is a dynamic textfield
var currentIndex:int = 0;
[Code].....
in as3 how do i get the text of a textfield to know when to line break according to the width of the textfield.
View 4 RepliesI want to draw a squiggle line below misspelled word in a Flex Spark RichEditableText component.
View 1 RepliesSo I have this text field that I am able to transform, AND I want it to stop at a certain width. The width I want it to stop at is the longest word in a text field. Essentially stopping the text from wrapping around and cutting the words in half or splitting them up. In theory if you set the width of the text field to low enough it would have a word on each line, but would never cut the words up.
This text field has a TextFormat attached to it by the way. AND so far the only idea I can come up with is to create a second textfield hidden away and put the longest word (not sure how you'd get that) into that field and measure the width. What I'm wondering though is if there is anything in possibly the getBounds method or something simular that does this already!?
I searched the forums and couldn't find anything relevant to my issue.I'm creating 3 textfields and loading XML into them. What i need is to add a "label" before each textfield on the stage. For instance i'm pulling a city name from the XML file,i want to insert the word, "Location" on the stage before the textfield with the city's name in it. Here's a snippet from my code where i'm loading one of the variables into one of the dynamic textfields.
Code:
var where:TextField = new TextField();
where.text = eventsXML.Event[0].City;
where.x = 85;
where.y = 81;
I want it to appear on the stage as: Location: Sydney, Australia
Is possible to make a word as button within the dynamic textField in flash as3?
View 4 RepliesIs there a way to show a long text in a dynamic text field with multiline attribute = on, without word wrapping? E.g., A dynamic text field contains 2 lines, and multiline is set to on. If I try to display a text in the text field, it is wrapping at the word, thereby losing some space in the text field (see code below):
my_fmt.size = 50;
this.createTextField("my_txt", 1, 100, 100, 280, 150);
my_txt.multiline = true;
my_txt.wordWrap = true;
my_txt.border = true;
my_txt.text = "One Hundredyears of solitude";
my_txt.setTextFormat(my_fmt);
The display is showing only "One Hundredyear" in two lines, and the rest of characters are below the visible text area. The issue here is in the first line there is only "One" displayed, leaving a lot of space. If I can accommodate more characters in the first line, without word wrapping, the second line can accommodate the rest of the characters.
I've been searching around the web for a very long time but I can't seem to find a good solution for this pickle:I have a dynamic textfield on AS3 and would like to add a tooltip to some words within the text. I already got the tooltip class, so the problem lies in fact on 'how to listen to mouse over events on specific texts inside a textfield'I've been trying to follow some methods from the livedocs but all I can get so far is a rectangle object of a single character using getCharIndexAtPoint and getCharBoundaries. It works if I just needed to add a tooltip to a single character (since it can detect which character I'm currently pointing at), but I need to search for actual words. It would be nice to have some sort of getMouseAt(text:String) but that doesn't seem to exist.
View 2 RepliesIs there any command line tools to move an h264/mp4 index to the beginning so that flash will start playing the file quicker over the net? I am aware of the tool QTIndexSwapper however it is not command line.
Alternatively is there an ffmpeg command to place the index at the front during an encoding?
I'm trying to figure out how to get this started. I'd like to type a word in a textfield and have it search for a match through a list of words in xml. There would be 26 xml files containing a list of words starting with a letter of the alphabet.
View 2 RepliesI programmatically created a textfield and I added it to the stage. I placed the textfield close to a dropdown menu that expands when a user hovers over it. Whenever I hover over the drop down menu, some options are hidden because the textfield behaves as if it has a CSS z-index greater than the css z-index of the drop down menu.
I do not have access to the code that created the drop down menu. How do I make it so that my textfield is behind the drop down menu?
Notes the reason I can't programmatically access the dropdown is because I don't have access to the code of the main flash object, whcih is hosted by a 3rd party company. I'm building a plugin. The remote server looks for plugins on my computer and hooks it in.
Sample Code
package {
import flash.system.Capabilities;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
[Code]....
I'm new to ActionScript and I'm having trouble creating a navigational index for my company's catalog. I've created 6 dynamic TextFields on the stage, given each of them a unique instance name (one, two, three, etc.) and have assigned to each of them the same eventListener and pageJump function via AS. My intent is to allow a user to jump to a specific page by clicking on the corresponding TextField. My question is how do I tell the function which TextField has been clicked? Nothing I've tried has worked thus far. If there's
var navList:Array = new Array(one,two,three,four,five,six);
function setFieldParam():void {
var i:int = 0;
[code].....
All I have in the fla is this code
Code:
stop();
var t; var f;
[code]....
I have been building a simple word game. It is smple but works fine. I am now trying to enhance some of the features.I would like to see if I can display one letter of each word so the Player has a hint. Think of this as a beginners level.The words are random from a text list. Either I can make the letters invisible and the game starts without a hint or I am able to select a letter using charAt() or creating a new variable substring()from the word which is the displayed repeatedly on the stage(not what I want) I have not been able to find a way to display one letter and display it in the correct order within the word and keep the remaining letters invisible.
import flash.net.URLLoader;
import flash.events.Event;
import flash.display.MovieClip;
import flash.text.TextField;
[code]...
I am doing drag-the-word quiz. When you match the word with correct part, the message pop out, saying Bingo! If the word is matched with wrong part, the "Sorry. Try Again" message pops out, says "Sorry. Try Again". I managed to make the "Sorry. Try Again" message disappear. However it dun work anymore after that. Sometimes it is quite funny. When I play it, the "Sorry. Try Again" message dun pop out at all.
Another problem - I am not sure how to make the word fit into the white box. I only know how to make the word drop on the white box. Can you tell me how to do it? I will be adding voiceovers to the quiz when the word is matched with the part. For e.g it will say "bingo" or "Sorry. Try Again". How to attach the voiceovers to it?
create the word which changing many time and in the end become a clear word like what's happend exactly in horizintal menu in [URL] That's what i wanted the changing in words like that menu?
View 3 RepliesI have a Dynamic TextField defined in the Flash Authoring Tool set to be multiline (cause the app can receive data from outside and it can be either 1 line or 1000 lines) but unfortunately the flash player just renders 1 line in the TextField, of a total that would have upwards of 100 lines.
I tried the following property:
textField.multiline = true;
but without success.
I use Flash CS4
i have a text field with text within it. Im wanting to get the line number of that text element once its clicked. Using an event listener I can get a specific value
PHP Code:
function clickHandler(event:MouseEvent):void {
trace(myTF.getLineText(0));
}
Of course I would have to use either an if statement or an if statement within a for loop, but what would I check it against?
Ok so If I load a list of like 2000 words from a text file into a text box like this
ActionScript Code:
var url:String = "dictionaries/"aa.txt";
var loadit:URLLoader = new URLLoader();
loadit.addEventListener(Event.COMPLETE, completeHandler);
[Code]....
how could I randomly choose a word from the list and have it as a variable
I have a Dynamic TextField defined in the Flash Authoring Tool set to be multiline (cause the app can receive data from outside and it can be either 1 line or 1000 lines) but unfortunately the flash player just renders 1 line in the TextField, of a total that would have upwards of 100 lines.I tried the following property:textField.multiline = true;but without success.Does anyone know how can I solve this problem?
View 2 Repliesthe example of my problem is:
I have 2 textFiled there are:
1. myTextFied ( to store the original text )
2. displayText ( to show some line of original text )
I try this:
myTextField.htmlText = '<B>THIS IS A TEXT LINE 1</B>
' +
'<I>THIS IS A TEXT LINE 2</I>
' +
[Code]....
I have a bunch of text I am working with from XML and when I import it into my text field it becomes automatically indented on the first line. Is there a way to lose this indent? If I take off word wrapping it does make the indent go away, but then of course the text spans across further than the text field horizontally.
Here are some of the properties I have assigned to the text field I am using:
ActionScript Code:
myTextField.htmlText = txtPath; //txtPath is the loaded and parsed XML
myTextField.multiline = true;
myTextField.wordWrap = true;
I have a text field on the stage with an instance name and is set as a Multiline text field. I'm populating it with data from an XML file.When I test my movie...the text field cuts off the text at the end of the text field and does not wrap to a new line like the Multiline setting.I even added a line of code to say
ActionScript Code:
myText_txt.wordWrap = true;
and still got nothing.
I'm trying to create a background for a textfield like this: When I access the textWidth property it always seems to be the total width. Which is fine for all the lines expect the last. So it possible to access the width of the last line text?
View 8 RepliesI need to send the contents of an input textfield by GET to a php script. The problem is the input must be multiline, but cannot allow line breaks orelse it messes up the GET query. Is there anyway for me to replace the line breaks with a html encoded line break (I tried restricting the textfield to specific characters, but the return still caused line breaks)?
View 2 Replieshow do you erase last line of text from a multiline dynamic textfield, or last couple of lines?
View 3 Replieswhen I put WordWrap on in an input textfield, all characters off the width of the textfield get put on the next line. However, when I look at the htmlText property of that textfield, I see no evidence of such a line break.I've learned that's because it's a soft line break, and not a hard line break. My app has a feature that requries me to know the number of lines in the textfield. I had been calculating this by simply scanning through the htmlText property of the textfield and counting up the presence of "</p>". However, the wordwrap soft line breaks don't leave any evidence of such in the htmlText property
View 2 RepliesDoes anyone know a way, to return the length, preferably in pixels, of a specific line in a multiline textfield. In this case, I need to know the length of the last line.
View 1 Replies