Skip navigation
Currently Being Moderated

How to make a button generate a random word from a list

Mar 26, 2013 11:14 PM

Tags: #air #help #flash #pro #3.0 #ios #action_script_3 #flash_professional #actions #cs6 #please #flash_cs6

Hey guys


I'm new at this so please use words I will understand.


Here are two images I will be refering through without this post:







XIdea 2.png


So basically, when I click the generate buttonon the first image it takes you to the second image. What I want is when I click the generate button it comes to this screen, aswell as choose a random word from each list that I will make (Who List, What List, When List, Where List, and Why List) and place the word next to its position. When you click New Idea I want it to also generate another set of random words from the lists. How can I do this?





  • Currently Being Moderated
    Mar 27, 2013 4:22 AM   in reply to xXZoloXx

    To make a random selection from a list you first have to have the list.  An array makes a good list, so for each category create an array and fill each with whichever choices you intend.


    To randomly pick one of the items in the list you can use the Math methods that Actionscript is supported by.


    var whoList:Array = [1,2,3];


    var randomWho = whoList[Math.floor(Math.random()*whoList.length)];



    Please don't start new postings for the same topic

    Mark as:
  • Currently Being Moderated
    Mar 31, 2013 8:16 AM   in reply to xXZoloXx

    It sounds like you are very new to Flash. Which version of Flash are you using and which version of Actionscript are you using in Flash? Are you going to be using the timeline, or will you make everything in code?


    If you are working in the timeline, you will need to add a dynamic text field to the stage for each new word that you want to show. You can make all of the words show with one button, or one button for each word, that's a design choice that you make. I'm guessing that the "Back" button will remove all of the existing words.


    The arrays are variables and you can define them in an Actionscript window where you define the button function. As Ned showed you, you will also need to get a random word from each array. Once you have that word, you can put it into one of the dynamic text fields on the stage.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points