Solved

Request "qwery String" variable ..?

Posted on 2003-12-08
9
192 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
 

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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now