Disable swf bsed on cookie
Hi:
I have js all set up and tested to check for cookie. If cookie set I ant to disable the swf.
The code in my AS is as follows::
import fl.video.*;
import fl.video.MetadataEvent;
import flash.external.ExternalInterface;
import flash.system.fscommand;
//-----------------------------------------
function checkSpokesman() {
trace("execution in CheckSpokesman");
var Play:int = ExternalInterface.call("checkCookie");
if (Play == 0) {
fscommand("quit");
}
}
the rest of the AS is unrelated to this process.
The Js reutrns 0 if the cookie set or 1 of not.
I really don't want to use a cue on the time line to call this function. Is there some other way to get the function ot execute before the swf is run?
I have also tried to use js to checkCookie and do get the return with:
<script type="text/javascript">
document.write(checkCookie());
</script>
The doc write is for testing and the call works fine.
First of all if I try this:
<script type="text/javascript">
var play:int;
play = checkCookie());
</script>
and have this in the init() called by page load it does not work. I was going to use the play variable to kill the loading of the swf
but can't figure out how best to make that work.
So, my questions:
Best way to facilitate this action:
1. In AS by calling the function by:
a. Timeline
b. AS callback from <body onLoad
2. Using js to call the fucntion in the external js and then blocking loading of the swf in the html page.
I don't want to spend anymore time exploring alternatives as this is very frustrating. I am assuming that 1.b is the best route.
Rhanks and best regards.