Make Your First App in Flash

flash 8 appThis is a simple tutor for those who are newbies in the cool world of Adobe Flash (formerly Macromedia Flash). Few days ago Adobe unveiled the new version of Flash i.e. Flash CS5, in this version Adobe has added many new features. But according to the Flash pros Flash 8 is known as the easiest version to understand and code your app, it’s like a boon for beginners who are about to crawl in the Flash world. We’ll start with the simple “Multiplication App” which displays the multiplication table of the given number.

  1. first app in flashStart the Flash 8 software, click on “Flash Document” in “Create new” section
  2. In the “Properties” panel choose the “Size” option, set the width to 200 and height 400.
  3. Well.. now our stage is ready to drag the components on it, go to “Windows >> Components” menu, it displays the component dialog box.
  4. Now drag a combo box, a button and a list box component respectively from the component dialog box. Arrange the components as shown in Fig-1.
  5. Go to “Parameters” panel below and change the instance name of each component to “combo1”, “button1” and “list1” respectively. Set the combo box’s “editable” parameter to “true” in the parameter panel. Also change the button’s label parameter to “GO”. Follow fig-2
  6. Now it’s time to add some coding stuff. Click on the first frame and click on the “Actions” panel located at bottom and enter the code given belowfirst app in flash

function multiplication(){
list1.removeAll();
combo1.addItem(combo1.text);

for(i=1;i<=10;i++){
list1.addItem(combo1.text + ” X ” + i + ” = ” + combo1.text*i);
}

}

this.button1.addEventListener(“click”,multiplication);

That’s it. Let’s go bit deeper in the code. function multiplication(){} Is the function where we multiply the number with 1 to 10 by using “For Loop” statement.  list1.removeAll(); means clears the list box before showing the multiplication table. combo1.addItem(combo1.text); adds the combo’s text to combo’s list for further usage (as google save’s our search query in its search combo box).  Finally this.button1.addEventListener(“click”,multiplication);  code tells the button to execute the “multiplication” function in “click” event.

That’s it buddies.. Your first app built in Flash 8 is ready to multiply the specified number. Hit “Ctrl+Enter” to test your app.. It’s easy no? :-D