Skip navigation
Currently Being Moderated

Accessing url encoded variables in flash as3

Apr 26, 2012 2:34 AM

I don't know if its the right way to call this problem but pls bear with me.

 

http://mydomain.com/trackUser.php?userId=001

 

I want to get the variables included in the url above to be used in my flash project.

 

I have a code in my flash that determines if the user is a male or female and output back the same url but with additional variables on it.

 

http://mydomain.com/trackUser.php?userId=001&score=9

 

 

 

Any reply is much appreciated.

 
Replies
  • Currently Being Moderated
    Apr 26, 2012 4:32 AM   in reply to xxxheeroxxx

    Here are a few approaches to getting the query string data...

     

    AS3 Get URL Variables
    ---------------------

    http://mikethenderson.com/2009/02/as3-return-query-string-value-versio n-2/#more-105

     

    OR

     

    In your HTML:


    var flashvars = {};
    if (swfobject.getQueryParamValue("chosenCLIP")) {
      flashvars.clip = swfobject.getQueryParamValue("chosenCLIP"); 
    }
    swfobject.embedSWF("myMovie.swf", "myContent", "550", "400", "9.0.0", "", flashvars);


    And the clip variable will be available as a FlashVar to your movie:

    var theClip = loaderInfo.parameters.clip;


    OR

     

    In the swf... Try:

    ExternalInterface.call("window.location.href.toString"); 

     

    and parse the string

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 26, 2012 7:24 AM   in reply to xxxheeroxxx

    ?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 26, 2012 7:59 AM   in reply to xxxheeroxxx

    Search Google using terms like "AS3 PHP MySql tutorial"

     
    |
    Mark as:
  • Currently Being Moderated
    May 31, 2012 5:19 AM   in reply to xxxheeroxxx

    Hi,

    Im going to go with what Ned said about using

    ExternalInterface.call("window.location.href.toString");

     

    so the above will pull somthing like this in as a string...

     

    http://www.aidanmack.co.uk/?var1=goo

     

    Then im going to use split to split the string on the =

    and that will give me the datas im after!...

     

     

    Just seems a bit crude?...

    No built in class or anything we can use in flash?

     

    meh it does what i want it to do anyway!

     
    |
    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