CheckBox Component Tutorial

Published :
Author :
Adam Khoury
In this Flash AS3 video tutorial and free fla source file download beginners can learn how to use the flash checkbox component to dynamically create checkboxes for allowing a user to select or deselect items. The checkbox component is ideal for certain information gathering situations you would come across in your Flash ActionScript 3.0 projects. import fl.controls.CheckBox; cart_txt.text = "Your Shopping Cart Contains:"; var checkbox1 = new CheckBox(); var checkbox2 = new CheckBox(); checkbox1.addEventListener(MouseEvent.CLICK, updateList); checkbox2.addEventListener(MouseEvent.CLICK, updateList); checkbox1.label = "Milk"; checkbox2.label = "Bread"; checkbox1.x = 80; checkbox1.y = 60; checkbox2.x = 80; checkbox2.y = 80; addChild(checkbox1); addChild(checkbox2); function updateList (event:MouseEvent):void { cart_txt.text = "Your Shopping Cart Contains:\n\n"; if (checkbox1.selected == true) cart_txt.appendText(checkbox1.label + "\n"); if (checkbox2.selected == true) cart_txt.appendText(checkbox2.label + "\n"); }