[SWFObject] external interface problems

Maurice Moore info at madcomputing.com.au
Mon Oct 16 05:39:04 PDT 2006


hi all,

i have read the posts about the updated version of 1.4.4 which is what i 
am using.

i have a simple nav swf in a .net page. the nav swf is embedded with 
this code

<script type="text/javascript">
   // <![CDATA[
   var fo = new SWFObject("/swf/navigation.swf", "nav", "771", "75", 
"8", "#FFFFFF");
   fo.write('flash_container');
   // ]]>
</script>

and the .as file i include for the external interface is this

import flash.external.ExternalInterface;
/*
* CookieBroker Class to manage javascript cookies within the flash movie
*/
class CookieBroker
{
	//
	private static var write_cookie:String = "function set_cookie(name, 
value, path) {  var cookie = name + \"=\" + escape(value) + \"; path=\" 
+ escape(path); document.cookie = cookie; }";
	//
	private static var get_cookie:String = "function 
get_cookie(cookie_name) { var results = 
document.cookie.match(cookie_name + '=(.*?)(;|$)'); if (results) return 
(unescape(results[1])); else return null; }";
	//
	private static var remove_cookie:String = "function 
removeCookie(name){var cookie = name + \"=\";cookie += '; expires=Fri, 
02-Jan-1970 00:00:00 GMT';document.cookie = cookie;}";
	//
	public static function SetCookie(name:String, value:String, 
path:String):Void
	{
		ExternalInterface.call(write_cookie, name, value, path);
	}
	//
	public static function GetCookie(name:String):Object
	{
		return ExternalInterface.call(get_cookie, name);
	}
	//
	public static function DeleteCookie(name:String):Void
	{
		ExternalInterface.call(remove_cookie, name);
	}
}

when i run the page in FF there are no problems, but in IE i get three 
errors.

1. 'nav' is undefined @ line 0
2. 'nav' is undefined @ line 0
3. 'nav' is undefined @ line 55

any ideas please?

regards,

Maurice
Click2Install Software




More information about the Swfobject mailing list