Skip navigation
Currently Being Moderated

Actionscript 3.0 question

Apr 25, 2013 11:17 AM

Tags: #newbie #flash_cs6 #actionscript3_0

Hi, all

 

I absolutely do not know Actionscript 3.0 syntax and need to fix this FAST (of course).

 

I named my instance, and used this code snippet. It works:

 

thirtyYearFixed.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage_3);

 

function fl_ClickToGoToWebPage_3(event:MouseEvent):void

{

    navigateToURL(new URLRequest("http://www.adobe.com"), "_blank");

}

 

 

 

this is the previous code, actionscript 2.0 which is pulling dynamic data from the xml:

 

on(release) {

    getURL(clickTAG + "?*", "_blank");

 

THE QUESTION:

 

how do I get it to link to the clickTAG, dynamic data (instead of http://www.adobe.com)

 

tia,

 

jarnot

 
Replies
  • kglad
    72,235 posts
    Jul 21, 2002
    Currently Being Moderated
    Apr 25, 2013 11:52 AM   in reply to jarnot9

    where (or how) is clickTAG in the actionscript 2.0 version.

     

    once that's converted to as3 (or, if it's already done), use:

     

     

    thirtyYearFixed.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage_3);

     

    function fl_ClickToGoToWebPage_3(event:MouseEvent):void

    {

        navigateToURL(new URLRequest(clickTAG + "?*", "_blank"));

    }

     
    |
    Mark as:
  • kglad
    72,235 posts
    Jul 21, 2002
    Currently Being Moderated
    Apr 25, 2013 2:36 PM   in reply to jarnot9

    if each button is supposed to do the same thing, use:

     

     

     

     

     

    thirtyYearFixed.addEventListener (MouseEvent.CLICK, buttonSymbol_click);

    fifteenYearFixed.addEventListener(MouseEvent.CLICK, buttonSymbol_click);

    fiveOneArm.addEventListener(MouseEvent.CLICK, buttonSymbol_click);

    seeMoreRates.addEventListener(MouseEvent.CLICK, buttonSymbol_click);

    buttonMovie.addEventListener(MouseEvent.CLICK, buttonSymbol_click);

     

    function buttonSymbol_click (evt:MouseEvent):void {

    trace(loaderInfo);

    var clickTAG:String = loaderInfo.parameters.clickTAG;

         // Check for malicious code injections, only use URLs if they begin with http: or https:

         if ((clickTAG.substr(0, 5) == "http:") || (clickTAG.substr(0, 6) == "https:"))

                  {

                  var req:URLRequest = new URLRequest(clickTAG);

                  navigateToURL(req, "_blank");

                  }

    }


     
    |
    Mark as:
  • kglad
    72,235 posts
    Jul 21, 2002
    Currently Being Moderated
    Apr 25, 2013 4:15 PM   in reply to jarnot9

    you're welcome.

     

    p.s.  there are easier ways to code that (though i wouldn't change now if i were you):

     

    var stateA:Array = ["AL","AK","AZ","AR","CA","CO",...];

    for(var i:int=0;i<stateA.length;i++){

    stageA[i].addEventListener(MouseEvent.CLICK,onClick);

    }

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points