design. business. life.

Information

This article was written on 30 Jul 2009, and is filled under Flash.

Current post is tagged

, , , ,

onClick buttons in Actionscript 3

Actions are no longer applied directly to buttons in Actionscript 3. Instead all code can be placed on the main timeline. For a basic getURL you first createa function, then you add an Event Listener to the button instance. Code below:

———————————————–

function gotoPage(event:MouseEvent):void
{

var targetURL:URLRequest = new URLRequest(“http://www.sitedesignmagazine.com/”);
navigateToURL(targetURL,’_self’);

}

skip_btn.addEventListener(MouseEvent.CLICK,gotoPage);

———————————————–

Replace skip_btn with the instance name of your own button.

NOTE: For some reason WordPress converts my quotes (both single and double) to smart quotes or whatever. You will need to change those when you paste or you’ll get syntax errors.

3 Comments

  1. Engineering
    March 4, 2011

    as the previous says, we appreciate your knowledge of Actionscript…

  2. Web design links
    May 14, 2011

    Thanks for this script! Just what i needed.

  3. Twittle App
    February 3, 2012

    Some genuinely nice stuff on this website, I like it.

Leave a Reply