Prototype: duplicate TextField [Flash 8]
| | 08.06.2004, 12:34
TextField.duplicate()
Prototype:
ActionScript:1 2 3 4 5 6 7 | TextField.prototype.duplicate = function (instanceName:String, depth:Number) {
this._parent.createTextField(instanceName, depth, this._x, this._y, this._width, this._height);
this._parent[instanceName].setNewTextFormat(this.getTextFormat());
for(var i in this) if(i != 'variable') this._parent[instanceName][i] = this[i];
return this._parent[instanceName];
}
ASSetPropFlags(TextField.prototype, "duplicate", 1);
|
Beispiel Aufruf:
ActionScript:1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* wichtig : nicht vergessen eure font in die libary zu übernehmen und
* für as freizugeben sonst seht ihr kein text !
*/
// _root.mytf als vorhandenes textfeld vorrausgesetzt
_root.mytf.duplicate("tf2", 0);
_root.tf2._y = _root.tf2._y + 30;
_root.tf2.textColor = 0xff0000;
_root.tf2.text = "my new text!";
_root.mytf.duplicate("tf3", 1);
_root.tf3._y = _root.tf3._y + 60;
_root.tf3.textColor = 0x0000ff;
|
| |
| Ähnliche Beiträge zum Thema | |
|
Flashhilfe.de Flash Platform Tipps & Tutorials Flash Platform Andere Programmiersprachen Jobangebote Diskussionen
Flashhilfe News
Regeln & Bedingungen
|