|
发表于 28-2-2008 11:02 AM
|
显示全部楼层
簡單例子- MovieClip.prototype.createStandard = function(w:Number, h:Number, bgColor:Number) {
- this.lineStyle(1, this._parent.style.lineColor, 70);
- this.beginFill(bgColor, 80);
- this.moveTo(0, 0);
- this.lineTo(w, 0);
- this.lineTo(w, h);
- this.lineTo(0, h);
- this.endFill();
- }
- MovieClip.prototype.createText = function(x:Number, y:Number, w:Number, h:Number, content:String) {
- this.createTextField("txt", this.getNextHighestDepth(), x, y, w, h);
- this.txt.html = true;
- this.txt.htmlText = content;
- this.txt.wordWrap = true;
- var format:TextFormat = new TextFormat();
- format.color = this._parent.style.textColor;
- this.txt.setTextFormat(format);
- }
- MovieClip.prototype.drawStyle = function() {
- this.createEmptyMovieClip("body", 0);
- this.body._x = 0;
- this.body._y = 30;
- this.body.createStandard(this.style.width, this.style.height - 30, this.style.bgColor);
- this.body.createText(5, 5, this.style.width - 10, this.style.height- 40, this.style.contentLabel);
-
- this.createEmptyMovieClip("titlebar", 1);
- this.titlebar._x = this.titlebar._y = 0;
- this.titlebar.createStandard(this.style.width, 30, this.style.titleColor);
- this.titlebar.createText(5, 5, this.style.width-25, 20, this.style.titleLabel);
- this.titlebar.onPress = function() { this._parent.startDrag(); }
- this.titlebar.onRelease = function() { this._parent.stopDrag(); }
-
- this.createEmptyMovieClip("closeBtn", 2);
- this.closeBtn._x = this.style.width-20;
- this.closeBtn._y = 5;
- this.closeBtn.createStandard(15, 15, this.style.lineColor);
- this.closeBtn.onRelease = function() { this._parent._visible = false; }
- this.closeBtn.createText(2, -2, 12, 17, "X");
- this._x = this.style.x;
- this._y = this.style.y;
-
- this.onMouseMove = function(){ updateAfterEvent(); }
- }
- this.createEmptyMovieClip("win", 0);
- win.style = {
- width:300,
- height:300,
- x:100,
- y:50,
- lineColor:0x003366,
- titleColor:0x006699,
- bgColor:0x0099CC,
- textColor:0xFFFFFF,
- titleLabel:"Simple Window",
- contentLabel:"Hello World!! This sample was created by <u><i>Actionscript 2.0</i></u> and provided by <font size="15"><b>Super-Tomato</b></font>"
- }
- win.drawStyle();
复制代码 |
|