TTh, CLA 4-27
1:00 PM -2:50 PM
CRN 71857
CIS 421 › Flash> AS3 navigate sections
//initialize frame label variable
var nextSection:String = "";
//add button event listeners
section1.addEventListener(MouseEvent.CLICK, navigate, false, 0, true);
section2.addEventListener(MouseEvent.CLICK, navigate, false, 0, true);
section3.addEventListener(MouseEvent.CLICK, navigate, false, 0, true);
//define the function each button will call
function navigate(evt:MouseEvent):void {
//the destination frame label is derived from the name of the button clicked
nextSection = evt.target.name;
play();
}
This information and the SWF movie is drawn Chapter 5 from the excellent book Learning ActionScript 3.0: A Beginner's Guide, by Rich Shupe with Zevan Rosser (2007). It is available in Safari books online through the Cal Poly Library. Downloads for this book's examples are available on-line