[osflash] JavaScriptProxy instance broken when using static entry point

Matt Freer matt.freer at gmail.com
Wed Jul 6 19:51:47 PDT 2005


Hey Guys,

Found a really weird issue when using the JavaScript and Flash Integration Kit:

If I create an instance of MyClass (source included below) from the
main timeline of a movie using the following code then MyClass
receives calls from the JavaScriptProxy:

var lcId = _root.lcId;
var myClass:MyClass = new MyClass(lcId);

However if I use the static entry point for MyClass, then the instance
of the JavaScriptProxy is broken. In this case the sending_lc
(localConnection object ) used in JavaScriptFlashGateway returns an
'error' status:

// using static entry point
var lcId = _root.lcId;
MyClass.main(lcId)

Any ideas why this could be of impact?

The code for MyClass is included below:

Cheers
Matt

// MyClass.as
import com.macromedia.javascript.JavaScriptProxy;

class MyClass {	
	
	//Private Vars
	private var proxy:JavaScriptProxy;
	
	//Constructor
	public function MyClass (lcId:String) {
		trace("new MyClass");
		proxy = new JavaScriptProxy(lcId, this);
	}	
	
	public static function main (lcId:String):Void {
		var myClass:MyClass = new MyClass(lcId);
	}
	
	//Event Handlers
	//================================================
	public function onJavaScriptRequestVideo(videoURL:String,
videoTitle:String):Void {
	_root.debug_txt.text = Math.random(1)*100;
	}
	//================================================
}



More information about the osflash mailing list