A Flash Developer Resource Site

Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Nov 2008

    Newbie moving from AS2 to AS3, button action

    Hi, I am a newbie and I am working my way through an old bit of flash i have but just can't get my head around this.I was hoping someone might show me how to convert this from AS2 to AS3.

    on (release) {
    if(links.length > 0)
    getURL(links[clicked++], "_blank");
    if(clicked >= links.length)
    clicked = 0;


  2. #2
    Senior Member
    Join Date
    Nov 2012
    Your question has 3 items you will need to learn:
    1) You need to learn how to addEventListeners to an object to handle the "click" All code in AS3 is not on the object any more but handled in an actions layer in the main timeline or an external .as file. You will need to give your object an instance name and then listen for MouseEvent.CLICK.

    2) You need to declare and data type your variables
    a) I am guessing you have an array called "links" that holds different URLs. In AS3 it is best practice for you to declare your variables like this var links:Array = new Array(.......... your content in here ..........) or short hand var links:Array = [.......... your content in here ..........]
    b) the same thing for your "clicked" variable, you will need something like var clicked:uint = 0;

    3) You will need to find the AS3 method for going to a website. I havent looked in the code, but I think it will be something like navigateToURL(new URLRequest(links[clicked]))

    If you have Flash Professional CS6, they may have some code snippets to help you out with this.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.