0
我有一個Flash條碼掃描器(相機),並希望在移動項目中使用它來掃描QR碼。如果可以重新使用此SWF並將其嵌入到移動Flex應用程序中,那將是非常好的。 SWF是在Flash CS5中製作的。Flash Builder 4.6 Mobile Flex AS3:如何與嵌入式SWF通信
到目前爲止,嵌入(並將其添加到舞臺並顯示它)是成功的,但我如何與SWF進行通信?例如調用它的函數或使用事件。
下面的代碼片段:
[Embed(source="../cam/cam.swf")]
private var cam:Class;
....
....
public const EVT_SNAPSHOT : String = "onSnapShot";
public var camera : Object;
public function onInit(e:Event) : void
{
this.camera = new cam();
this.camera.addEventListener(Event.ADDED_TO_STAGE, this.cameraInit);
this.stage.addChild(this.camera as DisplayObject);
}
private function cameraInit(e:Event):void
{
trace('Added to stage');
this.stage.addEventListener(EVT_SNAPSHOT, this.cameraDoScan); // does not bind?
trace(this.camera.hasOwnProperty('getAppInfo')); // shows 'false'
}
private function cameraDoScan(e:MouseEvent):void
{
trace('MouseClick!');
}
有誰知道這個「東西」進行溝通?