Solved

Request "qwery String" variable ..?

Posted on 2003-12-08
9
195 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
  • 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Where to download Adobe Flash Player 11.9.900.170 5 1,346
Add 'birds singing' to homepage 5 109
bandwidth 5 71
I'm running a risk by using Adobe Flash in my site ? 9 119
This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

778 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