ActionScript3

From virtualMV2015wiki
Jump to: navigation, search
 Home  Flash11 (CS5) Flash10 (CS4) <

Created By Shelvin [2007002975]

Create a Actionscript 3 File.


Then create a button, or use one from the presets library. Once the button has been created, give it a instance name. The instance name is what identifies the button and should be unique.

This code is to be added to the first frame on the main timeline.


// event handler

cycling.addEventListener(MouseEvent.CLICK, clickSection);

home.addEventListener(MouseEvent.CLICK, clickSection);


function clickSection(evtObj:MouseEvent){

// trace action, shows what happens

trace (" "+evtObj.target.name+" link Clicked")

// goto link

gotoAndStop (evtObj.target.name); }


The event handler listens for mouse clicks. Instances should have the same name whats on the "labels" on the timeline so that the "evtObj.target.name" links correctly.

Currently the code shows 2 buttons. A home and cycling instance/label. To add more buttons, just change the instance name, thats all.

Icon References.png References


ActionScript3. (2017). In virtualMV's ( Michael Verhaart ) wiki. Retrieved December 18, 2017, from http://www.virtualmv.com/wiki/index.php?title=ActionScript3    (zotero)