Solved

Request "qwery String" variable ..?

Posted on 2003-12-08
9
197 Views
Last Modified: 2010-04-03
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

0
Comment
Question by:silki
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 9

Expert Comment

by:OBCT
ID: 9896871
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
0
 

Author Comment

by:silki
ID: 9919125
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

*****************************************************
0
 
LVL 9

Expert Comment

by:OBCT
ID: 9919225
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
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:silki
ID: 9941527
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 ..


0
 
LVL 9

Expert Comment

by:OBCT
ID: 9941826
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
0
 

Author Comment

by:silki
ID: 9948257
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 ??
0
 
LVL 9

Accepted Solution

by:
OBCT earned 250 total points
ID: 9948300
This is a load vars function. At the moment in a current work project I have used it at least 40 times. I bow down to this function hehe.
What it does is load up any variables you set from your asp page.
If you want to load up a specific variable (which i assume you do) you would use this code:

myLoad = new LoadVars();
myLoad.variable = variable;
myLoad.onLoad = function(success)
{
     if (success)
     {
          //Add code here
     }
     else
     {
           //Add error message here
     }
};
myLoad.load("127.0.0.1/page1.asp?ref=1123", myLoad, "GET");

If you have any trouble using this function the first place I suggest you look is in the Actionscript dictionary. If your still having trouble just give me a yell.
I appologize for not being much help, I'm not very good at explaining things.

Cheers

-OBCT
0
 

Author Comment

by:silki
ID: 9948841
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
0
 
LVL 9

Expert Comment

by:OBCT
ID: 9948855
Yep thats fine with me.

Cheers!

-OBCT
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question