Professional Web Applications Themes

Passing a variable to a URL - Macromedia Flash Actionscript

Hello, I want to have an input field that writes to, say, "input1" input at the beginning of the movie, and then all hyperlinks clicked on from the movie will have that "input1" value added to the end of the url. Could anyone offer suggestions on getting the variable added to the end of the url? Thanks!...

  1. #1

    Default Passing a variable to a URL

    Hello,

    I want to have an input field that writes to, say, "input1" input at the beginning of the movie, and then all hyperlinks clicked on from the movie will have that "input1" value added to the end of the url. Could anyone offer suggestions on getting the variable added to the end of the url?
    Thanks!


    Starleys webforumsuser@macromedia.com Guest

  2. #2

    Default Re: Passing a variable to a URL

    If by hyperlinks you mean HTML Text in a textfield, you can use the asfunction method:

    <A HREF='asfunction:myFunction,argument_1'>Click here</A>

    like

    myTextField.html = true;
    myTextField.htmlText = "<A HREF='asfunction:_root.getLink,http://myURL.com'>Click here</A>"
    input1 = "data";
    getLink = function(myURL){
    var myLink = myURL + "?myVar=" + input1;
    _root.getURL(myLink);
    }

    this will send input1 as a URL encoded variable called myVar. you should see [url]http://www.stcassociates.com?myVar=data[/url] in the url box of your browser.

    If you just want to use buttons:

    myButton.onRelease = function(){
    _root.getLink("http://www.stcassociates.com");
    }

    input1 = "data";
    getLink = function(myURL){
    var myLink = myURL + "?myVar=" + input1;
    _root.getURL(myLink);
    }

    hope this helps.

    check out the STC fontBrowser

    STC Associates

    jerome@STC webforumsuser@macromedia.com Guest

Similar Threads

  1. Passing a variable
    By Angie2099 in forum Coldfusion - Getting Started
    Replies: 2
    Last Post: June 26th, 02:33 PM
  2. URL Variable Passing
    By DManson in forum Macromedia ColdFusion
    Replies: 0
    Last Post: April 27th, 03:18 PM
  3. passing variable
    By Troy in forum ASP Components
    Replies: 2
    Last Post: June 16th, 07:48 PM
  4. Passing a second value in a variable
    By Bob Barrows in forum ASP
    Replies: 1
    Last Post: August 22nd, 12:52 AM
  5. Replies: 7
    Last Post: July 17th, 04:54 AM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139