|
-
Impressive Click
[javascript] Sending vars to flash file through javascript
Ok, I posted in a completly different thread before about the a onclose function and I have done my research and I have found script that sends variables to a flash file and script that does a function when the pages closes and I have combined them together. Unfortunatly, it is not working, and since I know only PHP, VB, HTML and Flash I have no clue what I am doing wrong. Provided below is the script I have in the file that contains the flash movie.
code:
<script type="text/javascript">
function focusout(){
game.SetVariable("unloadvar", "true");
}
</script>
<body bgcolor="#000000" onLoad="focusout();">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="380" height="224" id="game" align="middle">
<param name="allowScriptAccess" value="sameDomain" >
<param name="movie" value="game.swf" >
<param name="menu" value="false" >
<param name="quality" value="high" >
<param name="bgcolor" value="#ffffff" >
<embed src="game.swf" menu="false" quality="high" bgcolor="#ffffff" width="380" height="224" name="game" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" swLiveConnect="true" pluginspage="http://www.macromedia.com/go/getflashplayer" >
</object>
Now in the flash file I have something like this:
code:
this.onEnterFrame = function(){
if(unloadvar == true){
txtstatus = "Variable changed";
delete this.onEnterFrame;
}
}
If someone can help me with this, I would really appreciate it greatly. I need to know this as soon as possible. Any help is greatly appreciated and thank you for taking the time to read this message.
Thanks,
Andrew
-
skylogic.ca
Lemme get this straight, user closes window, window determines that itself is closed, window tells flash to do something before window closes, but window is already closed so flash can't do anything....am I the only one confused?
I believe fscommand() is one way to get flash to communicate with java, sorry i can't help you much, but atleast you have a clue that you can look into.
~MD
-
Impressive Click
thanks I appreciate the help, I am going to look into it. Sorry for the confusion but let me explain. The purpose of the onclose function to flash is simple, when the browser closes I want to try and add the score and time to the database. Although, before I can test if it would work, I am having trouble just sending variables across when the page loads, nevermind the fact of it closing, and it has failed to do so. Thanks again for the hint, I now at least have some where to look.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|