1 Reply Latest reply: Mar 27, 2013 4:22 AM by Ned Murphy RSS

    Make Button load Words from List

    xXZoloXx

      Hey Guys!!!


      Just a note, I dont know about proramming and I am new to flash so please say you responses in the simplest way possible, thankyou!

      So I am making an app that when you click a button it will randomly select a Who, What, When, Where, and Why from a list that I make.

       

      So say there is a button that says New Idea.

       

      When I click the button there is:

       

      Who:

       

      What:

       

      When:

       

      Where:

       

      Why:

       

      Say a small list of who is 1, 2, and 3

      A small list of what is 4, 5, and 6

      A small list of when is 7, 8, and 9

      A small list of where is 10, 11, 12

      And a small list og why is 13, 14, and 15

       

      How can I make it so when I click the New Idea Button it will select (by random) a who, what, when, where, and why from their lists?

       

      Please help me saying what to do from making the button make get a word from a list, to what I am asking!

       

      Please!!!

       

      Thankyou!!!

        • 1. Re: Make Button load Words from List
          Ned Murphy MVP

          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