Code.GeekInterview.com
 
Code Samples Flash
 

Creating Loops


Code ResourceAuthor: lavanyarani  

Difficulty Level: Beginner

Published: 10th Nov 2009   Read: 2666 times  

Filed in: Flash
Add Comment


 

 

Sponsored Links


 

 
For loop is used for the generation of mathematical table for the number given by the user.
 


Sample Code
  1. Step-1: create an input box and in the properties panel give the instance  
  2.              name for the input box as “n1”
  3. Step-2: Give the label for the input box(text) as “enter any number”.
  4. Step-3: create a button with the textenteron it.
  5. Step-4: Select window-components we will get a list of components.
  6.              drag and drop the text area component and give the instance
  7.              name as “a” in the properties panel.
  8. Step-5: Select the button and open the action panel and write the
  9.              following code in the script pane.
  10.               on(release)
  11.               {
  12.                 var i:Number;
  13.                  var n:Number;
  14.                  var r:Number;
  15.                   n=Number(n1.text);
  16.                   for(i=0;i<=10;i++)
  17.                 {
  18.                         r=n*i;
  19.                         a.text+=n+”*”+i+”=”+r+newline;
  20.                   }
  21.               }
  22. Step-6: press ctrl+enter to test the movie.
  23.  
  24.  
Copyright GeekInterview.com


Next Article: Assigning actions to an object and button


 

Latest Code Samples

 

Popular Code Samples

 

Related Code Samples

 

Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    



Popular Coders

# Coder NameHits
1. lavanyarani35688

Active Coders

# Coder NameCodes
1. lavanyarani13

Refined Tags