A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: [RESOLVED] Trying to create a Simple Button, Used to be geturl

  1. #1
    Junior Member
    Join Date
    Oct 2010
    Location
    Motor City
    Posts
    6

    resolved [RESOLVED] Trying to create a Simple Button, Used to be geturl

    It's been a while since I used Flash and Actionscript 3 is...obviously a lot different than it's predecessors. Here's my code,

    var getTech:URLRequest = new URLRequest("http://www.mysite.com");
    techbtn.addEventlistener(MouseEvent.CLICK, bClick);

    function bClick(event:MouseEvent):void{
    navigateToURL(getTech);
    }

    I'm not sure what I'm doing wrong here, but I keep getting the following error.

    1061: Call to a possibly undefined method addEventlistener through a reference with static type flash.display:SimpleButton.

    Little help anyone?

  2. #2
    Senior Member
    Join Date
    Jun 2008
    Posts
    549
    addEventListener has a capital 'L'

  3. #3
    Junior Member
    Join Date
    Oct 2010
    Location
    Motor City
    Posts
    6

    Thumbs up

    Hah. That did it. Thank you so much. I'm a little rusty, but I've been doing more with Flash as of late. Thanks for the advice. This was it.

    Cheers

  4. #4
    Junior Member
    Join Date
    Oct 2010
    Location
    Motor City
    Posts
    6

    Question

    1 more question. How do I get these to launch in the same window? Right now this is pulling _blank.
    Last edited by NateBalcom; 10-01-2010 at 01:09 PM. Reason: spelling error

  5. #5
    Senior Member
    Join Date
    Jun 2008
    Posts
    549
    use "_self"

    Note: this will not work in flash because its not a browser, but will work when you embed in a html page

  6. #6
    Junior Member
    Join Date
    Oct 2010
    Location
    Motor City
    Posts
    6
    Ok here's what my new links look like,but I'm still getting errors.

    var getTech=new URLRequest("http://www.mylink.com","_self");

    1137: Incorrect number of arguments. Expected no more than 1.

    I guess I'm still doing something wrong.

  7. #7
    Junior Member
    Join Date
    Oct 2010
    Location
    Motor City
    Posts
    6
    Not working either, but I feel like I'm getting close.

    var getTech=new URLRequest("http://mylink.com");
    navigateToURL(targetURL, "_self");
    techbtn.addEventListener(MouseEvent.CLICK, bClick);

    function bClick(event:MouseEvent):void{
    navigateToURL(getTech);
    }

  8. #8
    Junior Member
    Join Date
    Oct 2010
    Location
    Motor City
    Posts
    6
    Ah I got it. Was right in front of me.

    //--- Get url ---\\
    var getTech=new URLRequest("http://mylink.com");
    techbtn.addEventListener(MouseEvent.CLICK, bClick);

    function bClick(event:MouseEvent):void{
    navigateToURL(getTech, "_self");
    }

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