ActionScript 3.0 :: Creating An Array Of Words From A String?
Jun 25, 2010creating an array of words from a string?
View 8 Repliescreating an array of words from a string?
View 8 RepliesIs 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.
View 6 RepliesHow 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.
View 7 RepliesI need some help creating an array from a string send via POST from a php loop.The string looks sorta like this: keyword=key1val &
text=text1val & keyword=key2val & text=text2val
(spaces added for readability)
I have a little bit of control over how the string is sent. So I could add numbers to the keys in the string, so they read like this
keyword1=key1val & text1=text1val & keyword2=key2val
basically I want to then end up with an array
noteCards[0] = ["key1val", "text2val"];
noteCards[1] = ["key1val", "text2val"];
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.
[Code]...
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
View 4 RepliesIs it only possible by counting the number of white spaces appearing in the string?
View 4 RepliesI'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]...
View 3 Replieshere's my string....
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.
creating a preloader that displays the numbers spelled out instead of the actual numbers?
[Code]....
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("");
[Code].....
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.
View 1 Repliesi 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,
[Code]...
my objective is:
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'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).
View 2 Repliesvar answer_array:Array = new Array();
var wordsLoader:XML = new XML();
wordsLoader.ignoreWhite = true;
[Code]....
All of the values in my array are coming up "undefined".
I have a sentence that's basically items from an array, and I have this line that when I type one of those words on it, that word is removed from that sentence/array. And I'm having trouble coming up with a function, I'm trying to make it an if statement.so far I tried: and I know I need to put splice in, but this is just to see if it works or not.
ActionScript Code:
if(enterWordLine.text == sentenceLine.text)
{
[code]......
I want something where I click a button, and it replaces words with other synonyms automatically. My thoughts are:
set up array
(array1=array2)
array1="word1","word2","word3"
array2="word1","word2","word3"
search text for word in array1
if find in text= word in array1
replace with random word in array2
Would anyone know how to set this up, or point me in the right direction?
I have a text file that has a large list of words. Each word is on its own line but has no commas or any punctations in between.Can I turn this file into an array with each word being a string in the array?Can I do this without manually putting commas in between each word?
View 1 Repliesis it possible to have an array of words, and then, with another set of code, to have those words randomly animating (perhaps from the distance, to closer up, like a zooming non-blurred effect) on the stage?
View 3 RepliesI need to flash a series of words for 2.5 seconds with a pause for .5 seconds. The words are drawn from an array that is assigned, but I need to have these words flash in a particular order.For example, if the "words" were A, B, C, D, E (each of which I've assigned a stored value), I might need to show A C E B A A F.
View 3 Repliesso 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
I am looking for a way to check if any sting of the Array is matched to the string that in the TextField. In the code it should be something like that:
Code:
var TestString:Array = new Array ("chicken", "cat", "dog");
function LookStringArray(){
if (TestArrayTextfield_txt.text == (anyString.TestString)){
[code]....
I have two arrays. One contains numbers and the other contains strings. I want to do a sortOn(DECENDING) for the number array and then have the string array sort to match. if my string array is
[Code]....
I put my mc's in an array.I have another array with strings.when the mc is clicked I want to get its position in the mc array and return the string from the same position in the string array.How do I do that?
PHP Code:
var numBtnArray:Array = new Array;
function addNumButtonsToStage():void{
[code].....
I have an array called dropTarg1 which stores dropped-in items.I want to loop through this array and in a textfield, display each array item on a new line of this text fieldI think I need to use something like Array.join("/n") but I can't get it working properly. I hope that the /n would create a new line of the text field called reviewBoxContentText.
for(var i:Number = 0; i<dropTarg.length; i++){
with(reviewBoxContent.reviewBoxContentText){
autoSize = true;
[code].....
I have a string that contains a full name input, and I would like to spilt them into 2 parts and save them inside an array, first name and last name. How do I do it with string.split? My current code is myNameArray = str_adminInput.split(" "); This code only works if the names are : Jack Lee, June Poh. This code does not work if the names are: Lee Tok Kong, Tan Beng Seng.
View 7 RepliesI'm trying to add a custom object to the stage by calling a function like this:
Code:
var effectName:String = new String("Explosion");
var thisObject:MovieClip = //some movie clip class, like an enemy
addFX(effectName, thisObject);
[code]....
How can i turn a string value into a movieclip?
Can I create an instance of a class from AS3 just knowing it's name? I mean string representation, like FlagFrance.
View 2 RepliesI want to create a few buttons which users can choose from to change the XML file for my RSS Reader in Air for Android. This is what the button will need to update:
var rssURL: URLRequest = new URLRequest("http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml");
The above XML is the default one I have chosen. What code would I need for them to do this?