A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 30 of 30

Thread: getURL POST & GET won't work

  1. #21
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,317
    Sounds like _root.loaderInfo.url is not holding any data.
    What are you expecting to see?

    Can you post your fla?
    Got to get to the bottom of this.
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  2. #22
    Junior Member
    Join Date
    May 2008
    Posts
    14
    Ok, I tried the LoadVars. I wouldn't quite know where to place the code, as it isn't as evident as an event handler. I just deleted the code in my previous event handler and placed the code somewhere that reads "link : Frame 1". The code goes:

    var picho:String;
    botonurl.onRelease = function() {
    picho = _root.loaderInfo.url;
    sendVar(picho);
    };

    function sendVar(param) {
    lv = new LoadVars();
    lv.picho = param;
    lv.sendAndLoad("http://myweb/index.php",lv,"POST");
    lv.onLoad = function() {
    tracer.text = this.varReceived;
    };
    };


    This doesn't even open a popup (nor no-popup) window with http://myweb.
    Last edited by marexposed; 05-06-2008 at 10:16 AM.

  3. #23
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,317
    What is it your trying to do with the variables being passed?
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  4. #24
    Junior Member
    Join Date
    May 2008
    Posts
    14
    webdreamer I'm expecting to see the address of the webpage which has loaded the swf and is playing it.
    Let's say you have 2 webpages http://webA, http://webB, loading the same swf from a third host. I need the swf, on click, to say "I'm playing on a browser navigating webA" or "I'm playing on a browser navigating webB".

  5. #25
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,317
    I dont see a problem. i have it working here

    code:

    but1.onRelease = function() {
    trace("clicked one_btn");
    trace(this._url);
    getURL("http://www.scotflash.co.uk/test/index.php?urlVar="+this._url);
    };

    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  6. #26
    Junior Member
    Join Date
    May 2008
    Posts
    14
    Yes webdreamer, but this._url refers to the address where the swf is hosted, not the address of the container. I'm looking for the address of the container (http://webA or http://webB).

  7. #27
    Junior Member
    Join Date
    Mar 2009
    Posts
    1

    This worked for me, except one thing

    I was having similar problem, except that I NEED to get the data in POST method to prefill another webform. toltec7's code worked miracle for me, only thing I needed to change is adding "_blank" in the getURL call.

    Code:
    movClip.getURL("http://myurl/index.php", "_blank", "POST");
    THANK YOU!

    Quote Originally Posted by toltec7 View Post
    you should do that code in timeline I guess...
    so name you button (instance name)
    and do this on _root or some other timeline...

    button.onRelease = function () {

    var movClip:MovieClip = _root.createEmptyMovieClip("mov", _root.getNextHighestDepth());

    movClip.picho = "hola";
    movClip.getURL("http://myurl/index.php", "POST");

    }

    that really should work if you wanna send with POST.
    you can send with GET by adding a query string like the other guy explained...

  8. #28
    Banned
    Join Date
    Mar 2009
    Posts
    153
    marexposed, It has to be _url. You are missing the underscore.
    Last edited by e_tit; 04-01-2009 at 11:27 AM.

  9. #29
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    It's impossible to retrieve the url that the swf is embedded on without some Javascript trickery. And it'll only work if the swf is embedded with the "allowscriptaccess" variable set to "always".
    PHP Code:
    import flash.external.ExternalInterface;

    var 
    r:String ExternalInterface.call("function(){return window.location.href}");
    trace(r);  //r will be exactly what it says in the browser's address bar. 
    Last edited by MyFriendIsATaco; 04-01-2009 at 12:00 PM. Reason: Typo

  10. #30
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    Quote Originally Posted by x_liu View Post
    I was having similar problem, except that I NEED to get the data in POST method to prefill another webform. toltec7's code worked miracle for me, only thing I needed to change is adding "_blank" in the getURL call.

    Code:
    movClip.getURL("http://myurl/index.php", "_blank", "POST");
    THANK YOU!
    You should always use some form of sendAndLoad. Using getURL is real old. To do what you want to do, you'd use almost the same exact syntax, but instead of sendAndLoad, you'd use just send. LoadVars.send().

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