Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

Closed Thread
Results 1 to 3 of 3
  1. #1

    Default ActionScript Help - Button and input text

    Hey there,

    I'm trying to create a button that sends you to a webpage which you enter in an input text field on the button itself. I made the button(named teamLiquid_mc) and the textfield(named yourLink_txt) on the stage, since I'm not quite sure how to code that yet :P

    I tried to put the input text into the URLRequest but that doesn't work(at least not the way i wrote it). So basically i wonder, what's wrong with my code? should i use classes instead, or write more separate functions for what's happening(and in that case, how would I go about that? ^^)?



    var _loadTL:URLRequest = new URLRequest("http://www." + yourInput);
    var yourInput:TextField;


    yourInput = yourLink_txt;



    teamLiquid_mc.addEventListener(MouseEvent.CLICK, runLiquid);
    teamLiquid_mc.addEventListener(MouseEvent.MOUSE_OV ER, startLiquid);
    teamLiquid_mc.addEventListener(MouseEvent.MOUSE_OU T, stopLiquid);

    function runLiquid(event:MouseEvent):void {
    navigateToURL(_loadTL);
    }

    function startLiquid(event:MouseEvent):void {
    teamLiquid_mc.alpha = 0.5;
    }

    function stopLiquid(event:MouseEvent):void {
    teamLiquid_mc.alpha = 1;
    }

    teamLiquid_mc.buttonMode = true;
    I realize this is probably a pretty newbie question, but if anyone could help me out i would really appreciated it! I just recently started learning flash on my own and just can't wrap my head around to finding a solution to my problem, and what's wrong with what i already have :/ thanks a lot in advance!

    Kind regards, bloodstyle

    edit: oh I just saw there was a newbie section.. if it should go there instead I'm sorry :/
    Last edited by bloodstyle; 02-27-2008 at 09:25 PM.

  2. # ADS
    Join Date
    Always
    Posts
    Many
     
  3. #2
    Join Date
    May 2004
    Location
    U.S.A.
    Posts
    2,890

    Default

    Hi,

    That appears to be AS3 code. The way I would go about it in AS2 would be something like...

    input textfield with instance name of "site"....movieclip with instance name of "myButton"...

    Code:
    myPath = "http://www.";
    myButton.onRelease = function() {
    	getURL(myPath+site.text);
    }
    A mind once stretched by a new idea never regains its original dimensions.
    - Oliver Wendell Holmes

  4. #3

    Default

    Thanks! ^^

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Sponsors
Create Speaking Characters for your website and Flash movies. 15 Day Free Trial