btw you want to put ?"+new Date().time on the end of your URL to keep it from caching without it you will get repeat data.
PHP Code:var myRequest:URLRequest = new URLRequest("http://www.myurlhere.com/doflash.php?"+new Date().time)
Printable View
btw you want to put ?"+new Date().time on the end of your URL to keep it from caching without it you will get repeat data.
PHP Code:var myRequest:URLRequest = new URLRequest("http://www.myurlhere.com/doflash.php?"+new Date().time)
Thank you! I had been wondering why it kept doing that and it was driving me nuts :)
I managed to get just about everything working but now I'm stuck with FlashVars. I need to send one variable to the SWF and then it will use the variable in the URL to communicate with PHP what it is that it needs. However, I can't for the life of me seem to get Flash to read my Flash Var. Here is the bit in my HTML code first:
I've tried several different AS3 codes that I've googled, but none have worked thus far. My latest attempt was with this:PHP Code:<param name="FlashVars" value="rID=75772" />
<param name="movie" value="horsego8b.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /> <embed src="horsego8b.swf" quality="high" bgcolor="#ffffff" width="550" height="400" name="horsego8" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" FlashVars="rID=75772" />
Actionscript Code:var myrid:String=LoaderInfo(this.root.loaderInfo).parameters.rID;
have you tried just plain??
PHP Code:var flashVar0 = root.loaderInfo.parameters.flashVarName;
also you should consider using swfObject 2.x to embed your objects.....it uses a small java script to sniff what version of flash player the user is using and if its not a version compatible with your application it prompts and allows the user to download the proper version the use of flashVars with it is also streamlined and easy to use......I can help you get setup with it if you like.
I believe I have and I just tried it again and it simply returns null. I've also triple checked to ensure everything is spelled correctly and in the proper case. I'm not sure what I'm doing wrong here.
I'm also quite interested in that :) If you wouldn't mind I would really appreciate it!
this might seem a little difficult at first but believe me its well worth the effort.
Okay thanks :) I'll be sure to give it a try.
Any idea as to what's going wrong with the FlashVars? This is highly frustrating lol
oh i thought you had it under control by now ......i'll set it up with a normal embed and get back to you i can't do it by memory been too long with normal embed.
Here is the site http://www.permadi.com/tutorial/flashVars/index.html i used way back when i learned to embed flash vars and here is the quick embed code......you have to use two seperate embeds for diffrent browsers I think this is where your mistake is anyway let me know what happens
Code:<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://macromedia.com/cabs/swflash.cab#version=6,0,0,0"
ID=flaMovie WIDTH=250 HEIGHT=250>
<PARAM NAME=movie VALUE="flaMovie.swf">
<PARAM NAME=FlashVars VALUE="userName=permadi&score=80">
<PARAM NAME=quality VALUE=medium>
<PARAM NAME=bgcolor VALUE=#99CC33>
<EMBED src="flaMovie.swf"
FlashVars="userName=permadi&score=80"
bgcolor=#99CC33 WIDTH=250 HEIGHT=250
TYPE="application/x-shockwave-flash">
</EMBED>
</OBJECT>
I just tested and the code i gave you is good.
Okay. I went to that URL and clicked on the section for AS3 examples. Here is the link to the HTML page:
http://www.harnessnation.com/flash/horsego8c.html
Here is my AS code:
Actionscript Code:var myrid:int;
var flashVars=this.loaderInfo.parameters;
myrid=flashVars.rid;
If I have myrid set to an int, it's 0. If I have it set to a string it's null. I don't understand what I'm doing wrong here. There's only one embed code as well from what I can see in the HTML.
I've also tried copying/pasting most of the code that is available on that page, including this part, which is the first example on the AS3 page:
Actionscript Code:function loaderComplete(myEvent:Event)
{
var flashVars=this.loaderInfo.parameters;
userNameTextField.text=flashVars.userName;
}
this.loaderInfo.addEventListener(Event.COMPLETE, loaderComplete);
And replaced the username text field section to set the myrid variable and it still returns null or 0.
here is the whole html page and the call for flashvar from flash just change the name of .swf and it will work.
Code:<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>specURLoader</title>
</head>
<body bgcolor="#ffffff">
<!--url's used in the movie-->
<!--text used in the movie-->
<!-- saved from url=(0013)about:internet -->
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://macromedia.com/cabs/swflash.cab#version=6,0,0,0"
ID=flaMovie WIDTH=250 HEIGHT=250>
<PARAM NAME=movie VALUE="specURLoader.swf">
<PARAM NAME=FlashVars VALUE="rID=75772">
<PARAM NAME=quality VALUE=medium>
<PARAM NAME=bgcolor VALUE=#99CC33>
<EMBED src="specURLoader.swf"
FlashVars="rID=75772"
bgcolor=#99CC33 WIDTH=250 HEIGHT=250
TYPE="application/x-shockwave-flash">
</EMBED>
</OBJECT>
</body>
</html>
Code:msg1.text = root.loaderInfo.parameters.rID;
you know put the flashVar flash code outside the oncomplete call because it might not be available when that fires.
You are absolutely amazing and a huge live saver! I can't thank you enough for all of your help! That seemed to do the trick perfectly and is working great now :D Thank you so much for all of your help!!!
here is something you might like to know to get around the security sandbox violation so you can test your movie that makes calls to external files such as php files do the following.
1. browse to C:\Windows\System32\Macromed\Flash\FlashPlayerTrus t
2. make a text file and rename it to Trust.cfg
3. open Trust.cfg in text editor and type in the path to the folder that the .swf lives in
C:\Users\calmchess\Desktop\flashfolder
Okay perfect, thank you :)