Code.GeekInterview.com
  I am new, Sign me up!
 
Code Samples Flash
 

Addition of Two Numbers Using User Defined Class


Code ResourceAuthor: lavanyarani  

Difficulty Level: Intermediate

Published: 6th Jan 2010   Read: 734 times  

Filed in: Flash
Add Comment


 


Addition of two numbers interactively.

 


Sample Code
  1. Step-1: Select the action script file while opening the flash.
  2. Step-2: Write the following code in the script pane.
  3.  
  4.              class Mathss
  5. {
  6.                 var a:Number;
  7.                 var b:Number;
  8.                 var c:Number;
  9.                 public function addition(m,n):Number
  10.                 {
  11.                         a=m;
  12.                         b=n;
  13.                         c=a+b;
  14.                         return c;
  15.                 }
  16. }
  17. Step-3: Save the above file as Mathss.as  
  18. Step-4: Select the flash document while opening the flash.
  19. Step-5: Create 3 input boxes(texts) and name them as n1, n2, r1.
  20. Step-6: Create a button with the text on it as “ADDon it.
  21. Step-7: Select the buttonaddand open the script pane and write the
  22.              following code.
  23.              on (release)      
  24.         {
  25.                 var ob:Mathss=new Mathss();
  26.                 r1.text=ob.addition(Number(n1.text),Number(n2.text));
  27. }
  28. Note: 1) Flash document should be saved with the same name      
  29.             “Mathss.fla
  30.           2) Class name and action script file name should be same.
  31.          3) Both action script (.as) file and flash document (.fla) should be  
  32.                in the same folder.
  33.  
  34.  
Copyright GeekInterview.com


Next Article: Import Audio File


 

Latest Code Samples

 

Popular Code Samples

 

Related Code Samples

 

Post Comment


Members Please Login

Name:  Email: (Optional. Used for Notification)

Title:
 
Comment:
Validation Code: <=>  (Enter this code in text box)





Popular Coders

# Coder NameHits
1. lavanyarani8209

Active Coders

# Coder NameCodes
1. lavanyarani13

Refined Tags

 

Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact  

Copyright © 2005 - 2010 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape