View Full Version : How to pass Html emb...to Flash ...please asap
This is my html code :
<html>
<head>
<title>Flash</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#000000">
<table width="600" border="0" height="500" align="center">
<tr>
<td><object classid="clsid:D27CDB6E-AE6D-11cf-96B8- 444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="600" height="500">
<param name=movie value="SCFlash.swf?querystr=<? echo $QUERY_STRING; ?>">
<param name="querystr" value="<? echo $QUERY_STRING; ?>">
<param name=quality value=high>
<embed src="SCFlash.swf?querystr=<? echo $QUERY_STRING; ?>" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="600" height="500">
</embed>
</object></td>
</tr>
</table>
</body>
</html>
How I can pass querystr variable to my Flash so that I can later send it to php script. What code I have to write in Flash to retrieve querystr into Flash and pass it to php script.
Thank you !!!!
to be more clear:
I know this is possible. I just don't know where to begin to get it set up.
I need to load some variables into a swf from a web url. I know I'll have to use cgi or php to append the variables to the url but then how do I get the variables into the SWF?
http://www.someserver.com/index.phtml?querystr=1345pass
Sending those variables into the swf - and from swf to php script how?
Any help would be greatly appreciated-
zex
edeveloper
03-13-2001, 03:43 AM
use loadVariables to send the vars back to the script.
so should I just use querystr in Flash or I have to declare new variable... or I can see it in Flash form html code..
Jesse
03-13-2001, 08:08 AM
If you're using PHP when you do this:
file.php?variable=value
you get a variable called 'variable' defined in your PHP. So to pass it into the flash file mebeded in that PHP page all you have to do is use the same method of appending it to the embed code.
Find the code that says:
<EMBED src="files.swf"
and replace it with
<EMBED src="files.swf?variable=<?php echo $variable ?>"
This way if you type the url:
page.php?test=Hello
your embed string will come out like this
file.swf?test=Hello
then Flash (which can read values in from this sort of URL-line pass format) will read the variable 'test' in and set it's value to "Hello"
Cheers
Jesse
Thank you Jesse for big help...
I just don't understand this part:
"then Flash (which can read values in from this sort of URL-line pass format) will read the variable 'test' in and set it's value to "Hello" "
How Flash reads it? automaticly or I have to declare new variable test in Flash and somehow pass it's value...
Because I want that value later to pass to php script.
Thank you one more time Jesse for helping me out.
zex
thank U for help it ment a lot to me it works now!
Thank U one more time
quincewyss
03-22-2002, 07:44 PM
To use this example to do the same thing in asp how would I need to change this script?
Thank you
Quince Wyss
maccer
03-25-2002, 11:45 PM
Hi quincewyss
If you want pass an ASP variable to flash use this :)
<param name=movie value="default3.swf?content="&<%=content%>>
pheck
12-19-2002, 03:51 AM
don't forget about the two places where the movie file name is called within object tag. it took me 1/2 hour to figure this out. hope to avoid this for future people reading this. thanks guys for the input.
Caravaggio
12-30-2002, 09:31 PM
can I use this same thing if I'm trying to send a variable from flash to another ASP page? Does it work both ways?
Jesse
01-02-2003, 07:33 AM
Yup, in fact I wrote a tutorial on that subject: http://www.actionscript.org/tutorials/intermediate/passing_variables_around/index.shtml
Caravaggio
01-03-2003, 06:12 PM
I have run the tutorial and found it very insightful, but I do have a question .
This is the property inspector for the Input text box.
http://www.rickworks.org/images/value.gif
I see that you put 'value' in the var box. I was under the impression that the var box here (filled with value) was just a left over from Flash 5 and now MX is to use the instance name.
Is there a way that I can put 'value' into the instance name area and still pass the information in the input box?
Jesse
01-04-2003, 12:12 AM
The effects of those two fields are actually quite different. Giving an instance name allows you to set the text using instanceName.text = beah; and also allows you to apply other TextField Object methods to the field. Enterring the value in the variable field sets it to being just a display house for that variable, at that level. If you want to use an instance name you would have to import the variable then set instanceName.text to the vbalue of the variable.
Caravaggio
01-04-2003, 04:49 PM
Rockin'! Thanks for the knowhow....
mfraser27
05-06-2003, 01:37 PM
I have a movie that loads another movie which in turn loads a third movie. I want to pass the Query String value I have in the URL to this 3rd movie but can't seem to get it to work using the technique you discuss in this thread,
thanks for any help. :D
OctavioSiqueira
05-09-2003, 05:19 AM
My friends,
Take a look at this Macromedia article (http://www.macromedia.com/support/flash/ts/documents/local_query.htm).
There is a wealth of info in this. Some of it may help you.
See ya
myecomdk
05-30-2003, 06:32 PM
Is it possible to send information to the HTML / PHP page via FS commands / javascript.
I would like to do this:
if(document.flabaform.bld.value == 0)
{
document.flabaform.bld.value = 1;
}else{
document.flabaform.bld.value = 0;
}
I made a JavaSCript function for it:
function toggle_bold()
{
if(document.flabaform.bld.value == 0)
{
document.flabaform.bld.value = 1;
}else{
document.flabaform.bld.value = 0;
}
}
Then i tried addeing this to a Flash button:
on (release) {
play();
javascript:toggle_bold();
}
That did nothing so i tried this:
on (release) {
play();
if(document.flabaform.bld.value == 0)
{
document.flabaform.bld.value = 1;
}else{
document.flabaform.bld.value = 0;
}
}
As you may have guessed, that didnt work either.
Any ideas, i need to move data from flash to HTML without posting all the time
myecomdk
05-30-2003, 09:08 PM
Ok i guess i should have browsed all the toturials before flooding your forum with questions.
Incase anyone is looking to do something similar, this is how i did it:
getURL ("javascript:functionname(args)");
instead of simply
javascript:functionname(args);
There is actually a great toturial about this, the name just doent say anything about calling javascript from flash.
It is here: Tutorial 24 Change the BG of the HTML Page (http://www.actionscript.org/tutorials/intermediate/Change_the_BG_of_the_HTML_Page/index.shtml)
mugentykst
01-09-2004, 07:01 AM
I think this is close to something I need.. but how on earth do I apply it?
here's my scenario
user hits html page ---if flash player available---> redirects to flash site + load specific external swf into container in main movie.
:( I can't afford to restructure my entire flash site juz to cater to this late request. So I've GOTTA find some code that can perform this magic.
jzrulez69
07-13-2005, 05:54 AM
Hi there, I found the tutorial talking about passing variables from php to flash really useful but here's my problem:
when I put the input text with the variable on the first scene with the send button, it works fine. What I want to do though is use the variable inside an animated menu with animated buttons which use symbols.
I use the same code
getURL("middle.php", "_blank", "GET");
But it doesn't read the variable and ignores it. is there a way around? :confused:
Thanks in advance.
quincewyss
07-13-2005, 07:14 PM
here is an example of sending variables to php
if(quantity_txt.text != "" && dollars_txt.text != "" && cents_txt.text != ""){
createNewPurchase = new LoadVars();
createNewPurchase.vendor_id = company_dropdown.value;
createNewPurchase.material_id = material_dropdown.value;
createNewPurchase.purchase_status = status_dropdown.value;
createNewPurchase.purchase_qty = quantity_txt.text;
createNewPurchase.purchase_price = dollars_txt.text + "." + cents_txt.text;
createNewPurchase.purchase_comments = description_txt.text;
createNewPurchase.purchase_date = todaysDate_txt.text;
createNewPurchase.action = "createNewPurchase";
createNewPurchase.sendAndLoad(php_file3, createNewPurchase, "POST");
createNewPurchase.onLoad = function(){
}
}
}
notice where it says .vendor_id or .purchase_status in the line of code that it is the name of the variable you will be looking for in the php.
gayatri
02-09-2006, 05:04 AM
i am designing a game website, and i have linked some flash games to my site.
i want the timestamp value(as i am using php) when the game ends, that instance's time..
is it possible to catch the time in a variable?
i have flash file something as
<embed src="flashfile.swf?var='.$var.'"
one more thing can i set time settings in flash file?
like if i want user to play a game for 120 sec, and originally it's set as 60 sec
any help would be highly appreciated
thanx
GaYaTrI
quincewyss
02-09-2006, 05:49 AM
Your question should be on a new post not in an old one. Your question should be on a new post not in an old one.
The way your passing a var is wrong.
Your way: flash recieves the var at the start through the url, not the end.
What program lang are you using and do you need it to be server time or the persons time. remember time zones can have an effect on the time.
Answer those questions and I'll try my best to help ya.
also take a look at the date() function in flash and loadVars() it will be one of those two ways.
gayatri
02-09-2006, 06:13 AM
thanx for help!!
n sorry actually i am new to this website, was not having any idea abt new threads, will keep in mind next time.
well, i am using php language, and i want the server time when it notice the game end, i mean when the "finish" flashes on game screen, i want that time, basically i am not, designing the game, just passing parameters and wan to retrieve them back with corresponding values.
i am running html code to run flash file within my php code
<embed src="'.$Flashfile.'?
here, $Flashfile is variable which contains flash file name(somethign.swf) and i passed it from php code, so how to grab time now??
will take a look at date() function, i guess it will help me
thanx a lot for the help
*i have posted new thread entry, sorry once again!!
GaYaTrI
vBulletin® v3.7.1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.