ActionScript 2.0 :: Search + Return A New String Containing Parameter Along With A Couple Of Words
Oct 8, 2006
i'm trying to write a function but with no luck. seems my brain capacity's limited the function will take two parameters: a term to search for, and a string to be searched. what i want the function to return is a new string containing the term (the parameter) along with a couple of words before and after it (as found in the search string).
I'm looking for the best way to search an 8 char string in AS3 to see if it contains a word or words. I've already got a dictionary of words loaded into Flash, with.[code]...
i have a input text field on stage called textfield and a button called btn i want to be able to search for key words from the users input i found this code but it doesnt work,
1.Read in a text file. e.g containing text like this, teacher/student/1/sn/2/3/4/5/9/f/tn/02/
2.pass it to a string.
3.then beable to extract different parts of the string and place them in different arrays.
The bit I dont know how to do is the extracting specific parts of the string? Is it possible to search for / and to treat what comes after it as a specific peice of information until the next / is read? Or perhaps there is a more efficient approach?
I have a dropdown box that is used to select a Category. I need the Flash Application to send the value of Category plus the search string in my textbox to my Access query and return results for each product meeting selection criteria. The Flash Application is calling an ASP.NET web service which in turn queries an MS Access database.
To start, how do I define the category ID and search value in my Actionscript 3 code?I've placed a series of 12 or so objects that will be populated with the product description, title and price. How do I setup each field to be dynamic text associated with the title description and price from my query results? If there are more than 12 products returned by the query, how do I add an additional page of objects to house more than 12 query results?
String.prototype.replace = function(find,replace){ return this.split(find).join(replace).toString(); } // Example: foo = "Let's replace all the e's in this sentence with an o."; trace(foo.replace("e","o"))
How would I replace the first "e" with "a", the second "e" with "b", etc...
For a word matching game, when a player moves a piece I need to check the entire dictionary to see if the the word that the player made exists in the dictionary. I need to do this as quickly as possible. simply iterating through the dictionary is way too slow.
What is the quickest algorithm in AS3 to search a long list like this for a match, and what datatype should I use? (ie array, object, Dictionary etc)
I'm planning to make a game that gives players the choice to search a word when selecting a character, and if that word is found, they get to play as them. I don't even have a clue what, where and how I am gonna put the list in the game for something to search it. I'll try to give an example:
A user puts "horse" into the input field, presses the "Search" button, and Flash searches the word "horse" in a list of maybe 30 or so words. If it returns no results, a message says, "keyword not found". If it is found, a picture of a horse comes up in the character preview box.
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.
For a rather complex search function I need to get the first letter of each word entered into an input field. At first glance this may not seem like a big problem if every word is neatly seperated by a space.
Although people can enter whatever they want into the field I only want to work with the words that start with a-z or A-Z.
I'm having a bit of trouble figuring out how I can determine if a character in the string falls into this selection. One of the possibilities is to use charCodeAt(), but that's rather rough. I can walk through the string using indexOf() but I may have trouble finding the next word if characters other than a space come into play.
For a rather complex search function I need to get the first letter of each word entered into an input field. At first glance this may not seem like a big problem if every word is neatly seperated by a space. Although people can enter whatever they want into the field I only want to work with the words that start with a-z or A-Z. I'm having a bit of trouble figuring out how I can determine if a character in the string falls into this selection.One of the possibilities is to use charCodeAt(), but that's rather rough. I can walk through the string using indexOf() but I may have trouble finding the next word if characters other than a space come into play. Say I have a string like: Super "big hamburger"notice the 'accidental' double space after super) What I want to get out of it is: Super big Hamburgerhich I later decrease to: s b h
var shapeString:String = "Princess,Round,Radiant,Princess,Heart,Round,Radiant,Emerald,Radiant,Radiant,Pear";
I need to figure out how to return the the 3 items that occur most in the order of highest to lowest. In this example it would end up being.
newString = "Radient,Princess,Round";
I imagine I would use indexOf somehow but I am not going to know what pattern I am searching for in the string so it is just based on the items that end up in shapeString based on a bunch of selected elements.
Is it possible to split a string like "Lorem ispum dolor, sit amet. Howdy doody." into an array of words without commas and periods, in one operation?I've tried words:Array = startString.split(String.fromCharCode(32,44,46));i guess the reason my example doesn't work is because it searced for " ,." to split the string.
How do I create an array of strings from a string, eg."hello world" would return ["hello", "world"]. This would need to take into account punctuation marks, etc.There's probably a great RegEx solution for this, I'm just not capable of finding it.
I have a string provided to my flash file that I need to break into a max of 3 sentences(strings).
I have written some actionscript to break it up by set lengths, but I also need it to not break words up.
To test you can place the following code in a blank as2 file.
Code: var personalMessage:String = "You got this far so we reckon that you could be curious enough to learn a little more, we�ll contact you shortly to answer any questions you may have."; _root.myArray = new Array(); _root.myArray = personalMessage.split("");
I am learning action script 2.o. and i want to create a programme to "find the multiple alphabets in a input string". but i haven't any idea. Please give me an logic for it.
I know that as3 has some powerful new text search capabilities, especially when combined with regex. I don't even know if this is possible, but I would like to somehow, search any block of text, and return all nouns, adjectives and verbs. What would be the best(most efficent) way to do this? Is regex an option? or would I have to load in some sort of open sourced dictionary 9as used in spellcheckers) to compare with or?? After, I've pulled all the nouns, adjectives and verbs, I need to count and prioritize by their frequency.
treeROOT = []; // loop through all markers in the XML and place into ROOT array for each (var xmlNode in xmlData.category) {
[code].....
tho i get an error here : and pretty sure it's from some bad use of .indexOf (because if i comment out that indexOf conditional, it works fine).i'm confused by the AS reference for indexOf, as it appears to be used for both Arrays and Strings.[URL]
I'm trying to create a simple xml search function that searches an xml file for a string, and if that string is found in the xml, display the node which contains that string in a text box.I have the simple search function working, but what I can't do is return the specific node. Right now, the function is returning all the xml data instead. If someone could take a look and possibly lend some guidance as to how to return the specific daya, I would be much oblidged. Hope this makes sense, if not, let me know and I'll do my best to clarify.[code]
I have a TextArea that allows user input. I also have TextInput that the user can type a string into and I want to be able to search through the TextArea for the string in the TextInput. I've never done anything like this before, searching for strings, so I don't know which functions to use or how to go about it.EDIT:
protected function searchBtn_clickHandler(event:MouseEvent):void { text = mainTextField.text;
I was wondering if there is an easy way to search a string for a keyword. I am working on a twitter piece which searches strings for keywords and have found a way of loading all the data properly.
so i search for keywords ofc, but...doing this isn't really my thing:input.text.indexOf("spam") != -1 && input.text.indexOf("more") ! -1 && ... etc I'd like to make it some what like:input.text.indexOf(<database>) != -1