ActionScript 2.0 :: Choosing Random Word Within Text
Jan 27, 2011What coding would I write so when a user presses a button, it selects a word from the words within the text?
View 21 RepliesWhat coding would I write so when a user presses a button, it selects a word from the words within the text?
View 21 RepliesWhat coding would I write so when a user presses a button, it selects a word from the words within the text?
View 3 RepliesI'm trying to achieve the following:
On my stage are 8 movieclip, respectively called squid1 to squid8. I'm trying to make actionscript designate one of these 'actors' at random once in a while, and make it pop up/do something. Dont know what exactly yet. Here's what I'm working on...
Code:
function chooseActor() {
var pickNumber = (Math.floor((Math.random()*8)));
var result:Object = new Object();
[Code].....
Now chooseActor funtion does what I intend it to do, i.e. generate a variable consisting of the word 'squid' combined with a number. I expected I could simply use this variable as the name of a movieclip and then just unleash all sorts of wackiness on it. But it doesnt work.
So I have a movie with 20 frames...on each frame...there is a question...so I want the user to access that pool of questions...when it pops up...it will randomly choose a Frame to go to...Now...how do I go about...when that Frame is chosen...take it out of the pool of the random questions...so it doesn't land on that frame again...I'm thinking with variables maybe...but I actually don't know how to even begin to write the code for that.
View 1 RepliesI m choosing random numbers. I want to be able to choose any number from 1 to 10. Let's say for example, 4 is chosen. I then want to be able to choose any number from 1 to 10, aprart from 4. Let's say 6 is chosen. I then want to be able to choose any number from 1 to 10, apart from 4 and 6. And etc, until all of the numbers are chosen. I was hoping someone could recommend the best way to code the above.
View 4 RepliesHow to do math calculations in AS2? I only need + and -. Aswell, how to choose a random number inbetween 2 and 6 and put in a variable form. After this, I need to do a calculation like:
Code:
"currenthealth" - "random"
I have problem with getting a random word from an array and the putting that word to a text field.
I setup the array for my words like this:
Code:
// a string of words
this.somewords = "wind breeze storm stormy tornado text space";
// convert the string of words into an array of words
this.wordList = new Array();
this.wordList = this.somewords.split(" ");
And I want to put randomly these words to a movieclip that I'm attaching to the stage about 50 times.
I need some code that takes a word from an array, and replaces that word with a random word from another array. My code:
for(i=0;i<wordsintext1.length;i++){
var word=wordsintext1[i];
if(fav6e5.indexOf(word)>-1){
[Code]....
I have a text input field and I need a combo box for choosing the font size for the text by px maybe.
View 1 RepliesI am using this random code below to choose a quote to display and I want to move the quotes list to a text file.
Code:
quotes = [Fish are the last to recognize water.","I am my brains publisher.", "Every tool carries with it the spirit by which it has been created.","Curiosity is the mother of intelligence.","Thinking is drawing in your head.","A person without imagination is like a teabag without water.","Realism is a corruption of reality.","Its always better to be looked over than to be overlooked.","The hardest thing to see is what is in front of your eyes.","The soul has no secrets that conduct does not reveal.","Creativity is the defeat of habit by originality.","Those who cannot remember the past are condemned to repeat it.","If you want to get lucky... it pays to get ready" ,"Realism is the corruption of reality","I'd give my right arm to be ambidextrous.","Music is noise submitted to order by wisdom.","God...invented the giraffe,the elephant,the cat.He has no real style.He just goes on inventing things.","The person you love is 72.8% water."]
qNum = Math.floor(riddles.length*Math.random());
partThree = quotes[qNum];
mainTxt = """+partThree+""";
I used to have a little text panel (that sat with the color, swatches, and align panels) that I was able to open up and edit text size, color, underline, etc with. It had a much better text editing ability then the properties panel, seeing as the properties panel does not even bother to allow me to underline text or to highlight and edit a single word in a whole text box. Now I don't have it, I can't find the damn thing anywhere, and I want it back. How can I get it?
View 1 RepliesAttachment 54101my problem is in bitmap explained:1. after loading external text into dynamic text field,2. how to call/make visible "button over text" on the Scene by pointing a mouse over specific word in loaded external text?3. javascript, html, actionscript (asfunction, variable)
View 8 RepliesI 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 RepliesOk 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'm working on a little game. The machanics are fine, but I'm curious on the best way to work the "cut scenes" between the action. This will involve some "text bubbles" for the conversations.
I guess there are several ways to do this. I could actually make frames for each conversation frame, leaving the text drawn on each frame. I'm tending towards this method, as I can see it all as it should be layed out.
Is it worth it trying to store all the text in a sperate file that is called upon when the text is needed? I have seen this done in many other games (non-flash), but in those games there is quite a lot of text.
I have a text properly read in from xml and displaying ok. But I'm trying to implement a link on one word in the text and that doesn't work. the xml node is [code] and should display;visit the website clicktext but displays;url... The code generating the html text field seems to work ok (it creates "arial font"), that specifc part goes;[code]
View 8 RepliesI am having a few problems atm with flash and wondering whether I am asking too much from flash or whether I am being stupid. Basically what I am trying to achieve is a box that is 300px by 300 px, within that box I have some text that I would like to place inside. As I would like to be able to regularly update this box (its a news feed) I have linked it too a .txt file. The problems that I have come across is that flash seems to have a limit on the amount of text it will allow in a dynamic text field. As even tho I have more text in my txt document, its is not displayed. This is how I have come to the presumtion that flash must be limiting the amount of text.
View 12 RepliesI am working on a text design appication in which i have to design the different type of text style with action script 2.0. I have achived most of them, but there are some word art type of design of the text.Following is the image of the shape required.
View 3 Replieshow do I load one word into a text field using actionscript. I don't want to load it from a xml file, or an external file, just from a frame on the time line.
View 2 RepliesIve got a dynamic text box that loads different strings into it under the msgText var right, but the text is like 3 lines long sumtimes. So how can i implement sort of a word wrap kinda thing.
View 2 RepliesI'm struggling to strip out the word 'Section' from a text box that loads from xml.
for(i=0; i<xmlNode.childNodes[1].childNodes[0].childNodes.length; i++)
if(xmlNode.childNodes[1].childNodes[0].childNodes[i].nodeName == "sections")
sectNo = xmlNode.childNodes[1].childNodes[0].childNodes[i].firstChild;
section_txt.text += sectNo;
When the node 'sections' returns 'Section 12' how can I strip out the word 'Section' and only have '12' load into the section_txt box?
I am really stuck. How can I get a word from one dynamic text field to update another.For example, current Text1.text = Crap I want the text in Text2.text = Kwap.[code]
View 2 RepliesI want to do a separate mouse over event for every word inside a text.
or at least get the string below the mouse cursor.
I have a submit button that I'm pulling in from XML.
It needs to be XML because it is translated.
Therefore... the length is varying depending on the language.
I simply want to add an arrow to the end of the word using Webdings #4 (it looks like a solid arrow, not like > but solid)..
How can I set up the LabelItemRenderer or use any other item renderer that wouldn't truncate the overflowing text but would word wrap it? [URL]
View 1 RepliesI made a flash application that gets the geolocation of a viewer ( city, state) and I'm trying to figure out how I could make the font smaller to fit in the container that I have it in depending on how big the name of the city is. For example, "Detroit" may fit, but "Los Angeles" may need to be a smaller font.
View 1 RepliesI created a text editor in AS3 to administer a site online, but i have a problem when i select a word, put it in bold, save the text and load it, all the text after this word becomes bold too. Here is my code
[Code]...
I am creating an interactive word prosessor. I would like to be able to format my text (font, size, style, aligning, etc) but I am unsure of the syntax envolved. my code is:
[Code]...