基於Krpano的Hotspot熱區插件·第二版

第二版對初版作了一些優化,其中最主要的優化就是將屬性提示界面單獨封裝爲一個類。這樣不但減小了屬性界面與editor功能的耦合,並且使整個代碼清爽了許多,而且同時解決了一部分BUGjava

更新主要代碼以下:優化

InforAlert.as
package
{
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFieldType;
public class InforAlert extends Sprite
{editor02
private var hotSpot:HotspotEditor02;
private var txtBack:TextField;
private var txtInput:TextField;
private var txtInput1:TextField;
private var txtInput2:TextField;
private var txtLable1:TextField;
private var txtLable2:TextField;
private var txtLable3:TextField;
private var btn1:TextField;
private var btn2:TextField;
public function InforAlert(hotSpot:HotspotEditor02)
{
this.hotSpot = hotSpot;
init();
addToStage();
}
private function init():void{
txtBack = new TextField();
txtInput = new TextField();
txtInput1 = new TextField();
txtInput2 = new TextField();
txtLable1 = new TextField();
txtLable2 = new TextField();
txtLable3 = new TextField();
btn1 = new TextField();
btn2 = new TextField();
txtInput.type = TextFieldType.INPUT;
txtInput1.type = TextFieldType.INPUT;
txtInput2.type = TextFieldType.INPUT;
txtInput.width = 100;
txtInput.height = 25;
txtInput1.width = 100;
txtInput1.height = 25;
txtInput2.width = 100;
txtInput2.height = 25;
txtLable1.width = 100;
txtLable1.height = 50;
txtLable1.textColor = 0xffffff;
txtLable2.width = 100;
txtLable2.height = 50;
txtLable2.textColor = 0xffffff;
txtLable3.width = 100;
txtLable3.height = 50;
txtLable3.textColor = 0xffffff;
btn1.width = 70;
btn1.height = 25;
btn1.autoSize = TextFieldAutoSize.CENTER;
btn1.text = 「肯定」;
btn1.background = true;
btn1.backgroundColor = 0xdddddd;
btn2.width = 70;
btn2.height = 25;
btn2.autoSize = TextFieldAutoSize.CENTER;
btn2.text = 「取消」;
btn2.background = true;
btn2.backgroundColor = 0xdddddd;
txtBack.background = 0xddff00;
txtBack.backgroundColor = 0×000000;
txtInput.background = 0xFFFFFF;
txtInput1.background = 0xFFFFFF;
txtInput2.background = 0xFFFFFF;
txtBack.x = 500;
txtBack.y = 150;
btn1.x = txtBack.x+50;
btn1.y = txtBack.y+110;
btn1.addEventListener(MouseEvent.CLICK,hotSpot.baginDraw);
btn2.x = txtBack.x+195;
btn2.y = txtBack.y+110;
btn2.addEventListener(MouseEvent.CLICK,hotSpot.baginDraw);
txtInput.x = txtBack.x+120;
txtInput.y = txtBack.y+20;
txtInput1.x = txtBack.x+120;
txtInput1.y = txtBack.y+50;
txtInput2.x = txtBack.x+120;
txtInput2.y = txtBack.y+80;
txtLable1.x = txtBack.x+50;
txtLable1.y = txtBack.y+20;
txtLable2.x = txtBack.x+50;
txtLable2.y = txtBack.y+50;
txtLable3.x = txtBack.x+50;
txtLable3.y = txtBack.y+80;
txtBack.alpha = 0.25;
txtBack.width = 300;
txtBack.height = 150;
txtLable1.text = 「商品ID:」;
txtLable2.text = 「商品編號:」;
txtLable3.text = 「商品URL:」;
}
public function addToStage():void{
this.addChild(txtBack);
this.addChild(txtLable1);
this.addChild(txtLable2);
this.addChild(txtLable3);
this.addChild(txtInput);
this.addChild(txtInput1);
this.addChild(txtInput2);
this.addChild(btn1);
this.addChild(btn2);
}
}
}

版本下載
this

相關文章
相關標籤/搜索