applicationclass.as
来自「Flex+js获取文件本地路径,调用file获得本地文件路径」· AS 代码 · 共 39 行
AS
39 行
package Class
{
import flash.events.Event;
import flash.events.MouseEvent;
import flash.external.ExternalInterface;
import mx.containers.*;
import mx.controls.*;
import mx.core.Application;
import mx.events.FlexEvent;
public class ApplicationClass extends Application
{
public var contentPanel:Panel;
public var fileUrl:TextInput;
public var selectButton:Button;
private var uploadFileUrl:String;
public function ApplicationClass()
{
super();
addEventListener (FlexEvent.CREATION_COMPLETE, OnLoad);
}
private function OnLoad(event:Event):void{
ExternalInterface.addCallback("sendToActionScript", receivedFromJavaScript);
this.selectButton.addEventListener(MouseEvent.CLICK,clickHandel);
}
private function receivedFromJavaScript(fileUrl:String):void{
this.uploadFileUrl=fileUrl;
this.fileUrl.text=fileUrl;
}
private function clickHandel(event:MouseEvent):void{
ExternalInterface.call("openBrowse");
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?