⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 panel2.as

📁 flash编程实例
💻 AS
字号:
class Scene.Manage.Panels.Group1.Panel2 extends MovieClip {
	//This is the statistics page, its seperated
	//into panels to display each peice of information about this
	//application
	var onResult:Function;
	var ConnectionsPanel:MovieClip;//0
	var MachinePanel:MovieClip;//1
	var ServerPanel:MovieClip;//2
	var AppPanel:MovieClip;//3
	var maxBandwidth:Number = -1;
	var getInterval:Number;
	
	function Panel2() {
		//Init objects
		//Attach UI
		attachMovie("ScaleBounding", "ConnectionsPanel", 0);
		attachMovie("ScaleBounding", "MachinePanel", 1);
		attachMovie("ScaleBounding", "ServerPanel", 2);
		attachMovie("ScaleBounding", "AppPanel", 3);
		//Work UI
		ConnectionsPanel.label = "Connections";
		ConnectionsPanel.content = "ConnectionsBox";
		ConnectionsPanel.setSize(246, 160);
		ConnectionsPanel._x = 13;
		//
		MachinePanel._x = MachinePanel._y = 13;
		MachinePanel.label = "Bandwidth (%)";
		MachinePanel.content = "MachineBox";
		//
		ServerPanel.label = "Server";
		ServerPanel.content = "ServerBox";
		ServerPanel.setSize(246, 160);
		ServerPanel._x = 380;
		//
		AppPanel.label = "Application";
		AppPanel.content = "AppBox";
		AppPanel._x = 270;
		AppPanel.setSize(100, 160);
	}
	//Events
	//
	function activate() {
		//Get the licnce info, this is used in the bandwidth chart
		//i use the max bw convert the megabits into bytes (*131072)
		//and use that against the incoming data
		getLicenceInfo();
		getInterval = setInterval(getStatus, 100, this);
	}
	function deactivate() {
		clearInterval(getInterval);
		MachinePanel.content.clear();
		ServerPanel.content.endInterval();
	}
	//Flashcom
	function getLicenceInfo(){
		_global.Connection.Net.call("getLicenseInfo", new getLicenceInfoResult(this));
	}
	function getLicenceInfoResult(p:MovieClip){
		this.onResult = function(result){
			if (result.level == "status") {
				p.maxBandwidth = Number(result.data.max_bandwidth)*131072;
				p.MachinePanel.content.maxBandwidth = Number(result.data.max_bandwidth)*131072;
			}
		}
	}
	function getStatus(p:MovieClip){
		_global.Connection.Net.call("getInstanceStats", new p.getStatusResult(p), _global.selectedApplication);
	}
	function getStatusResult(p:MovieClip){
		this.onResult = function(result){
			if (result.level == "status") {
				p.ConnectionsPanel.content.dataProvider = result.data;
				p.MachinePanel.content.dataProvider = result.data;
				p.AppPanel.content.dataProvider = result.data;
			}
		}
	}
	//
	function setSize(w:Number, h:Number) {
		ConnectionsPanel._y = ServerPanel._y = AppPanel._y = h - 173;
		MachinePanel.setSize(w-26, h-196);
		ServerPanel.setSize(w-393, 160);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -