Actionscript 3 如何访问.as文件中的公共函数
我正试图像平常一样使用ExternalInterface,并从main.swf访问.as文件connect.as的公共函数。我可以使swf零错误,但我没有看到日志和函数 例如,有一个名为create的函数Actionscript 3 如何访问.as文件中的公共函数,actionscript-3,flash,Actionscript 3,Flash,我正试图像平常一样使用ExternalInterface,并从main.swf访问.as文件connect.as的公共函数。我可以使swf零错误,但我没有看到日志和函数 例如,有一个名为create的函数 public function create(webSocketId:int,url:String,protocols:Array,proxyHost:String=null,proxyPort:int= 0,headers:String=null):void { 我试着从connect.a
public function create(webSocketId:int,url:String,protocols:Array,proxyHost:String=null,proxyPort:int= 0,headers:String=null):void {
我试着从connect.as内部调用它
create(0,'ws://mysie.com:8004',undefined,undefined,undefined);
Ps:我已经检查过上面的代码是否正常传递
main.swfplaceexternalinterface.call'consol.log',flash hello;在类WebSocketMain的构造函数内部或任何其他函数内部,因为将其放在类外部是没有意义的。哦,对了!?我想当我开始的时候,这类似于javascript。。。非常痛苦,几乎是苹果,但这不起作用。如果你必须已经在一个函数中,那么你如何启动一个函数呢?
package net.gimite.websocket {
import flash.display.Sprite;
import flash.external.ExternalInterface;
import flash.system.Security;
import flash.utils.setTimeout;
import mx.utils.URLUtil;
ExternalInterface.call('consol.log',"flash hello");//<----not working
public class WebSocketMain extends Sprite implements IWebSocketLogger{
//there are lots of public functions I'm trying to access from main.swf in here
import connect;
var connect:Connect = new Connect();
connect.create(10,'ws://mysite.com:8004',undefined,undefined,undefined);