Hi,
I just started with trying prototype methods. With the help of a found function I wrote this:
code:
MovieClip.prototype.addProperty('_color', this.getColor, this.setColor);
function getColor(){
return new Color(this).getRGB();
}
function setColor(rgb){
return new Color(this).setRGB(rgb);
}
That works great. Anywhere in the movie I can now change a color of an object with object._color = 0xff0000; (pretty excited about this)
However I'm trying to do the same thins with _bold. It would be great if you could just alter the textformatting by saying textbox._bold = true;
This is what I'm trying (and does not work):
code:
MovieClip.prototype.addProperty('_bold', this.getBold, this.setBold);
function getBold(){
format = new TextFormat();
return format.bold;
}
function setBold(bool){
format = new TextFormat();
format.bold = bool;
return this.setTextFormat(format);
}
Notatation or syntax may seem a bit odd, but I'm useing SWiSHmax (please don't bash me.)
Thanks for any help!