Link to home
Start Free TrialLog in
Avatar of silki
silki

asked on

Request "qwery String" variable ..?

Hi

Im a complete novice with flash and actionscripts etc ... i do have a background in ASP,VB etc though ...

In Flash MX how do I request a value pass via a URL eg:

www.mydomain.com/page1.asp?ref=1123

So pass ref into my swf file ??

Also How do i create a totally unique name in flash to use as a file name??
I good way iv found of doin this is asp is to count the files in a dir and add one to this number then use it for my file name ... is this poss is flash ???

Thanks

SILKI

Avatar of OBCT
OBCT

You can load your variable using either of these two functions:

loadVariables("www.mydomain.com/page1.asp?ref=1123", 0, "GET");
or
loadVariablesNum("www.mydomain.com/page1.asp?ref=1123", 0, "GET");

For more information on these, have a look here:
http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary425.html
and
http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary426.html

Cheers

-OBCT
Avatar of silki

ASKER

OBCT,

Thanks for the feedback, sorry im a complete novice with flash so:

I added this into teh actionscrupt windows for the first scene but it returns "undefined"  into the textbox

*****************************************************
var karl = "";
var karl = loadVariables("127.0.0.1/page1.asp?ref=1123", 0, "GET");

textbox.text = karl

*****************************************************
I don't know any asp but if possible use whatever function you can to print out the ref variable on your page. In php you could use:
echo "ref=" + $yourvariable;
print "ref=" + $yourvariable;

Once you have that working, give the dynamic text box the var name of "ref"
loadVariables("127.0.0.1/page1.asp?ref=1123", 0, "GET");
That is all the code you really need for this. If that doesn't work then we'll try something else.

Cheers

-OBCT
Avatar of silki

ASKER

Hi

sorry about the delay in my replys ... Iv got a actionscrupt on my first frame like this:

****************************************
loadVariables("127.0.0.1/page1.asp?ref=1123", 0, "GET");
****************************************

and i have a textbox called ref

now if i save the file and publish it then rename the html page created to page1.asp and follow the link there is no value in the textbox in the swf ?????

Thanks for all your help ..


Can I ask why you want to have the ref number in a text box from a query.
If your going to use the same query string everytime you use the program then your best off just printing the variable out on your asp page then using a LoadVars function to get that number into the textbox
Avatar of silki

ASKER

HI,

 I need to knoe how to pass a value from the qwery string into my flash file ... Im trying to create a video Emailer ... i have created a player that needs a file name to play and i want to pass different varibles ie different videos to play ...

So where am i goin wrong ??
ASKER CERTIFIED SOLUTION
Avatar of OBCT
OBCT

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of silki

ASKER

Great,

I wont be able to try this right away so ill give you the points and check out the Actionscript dictionary ... if there is any questions just littl eones i post it here if thats ok ...

Thanks again for your time

SILKI
Yep thats fine with me.

Cheers!

-OBCT