.... o sea uno crea una clase con sus métodos y propiedades propios, y al instanciarla que funcione tal cual como una clase de flash comun y corriente, arrojando hints para ascelerar la utilización de las mismas...
.... me surgió esta duda por que suelo trabajar con muchas clases individuales en mis proyectos flash, las mismas hacen una pequeña porción del trabajo, por ejemplo tengo una que hace cuadrados de diferente tamaño para usarlos de fondo en botones les pongo el código:
Código :
package {
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.EventDispatcher;
public class BaseBox extends MovieClip {
public static const COMPLETE:String = "complete";
public var attrib:Object;
public function BaseBox($attrib:Object) {
this.attrib = $attrib;
if (attrib.width == undefined) {
attrib.width = 100;
}
if (attrib.height == undefined) {
attrib.height = 20;
}
if (attrib.color == undefined) {
attrib.color = 0x000000;
}
if (attrib.alpha == undefined) {
attrib.alpha = 1;
}
if (attrib.rounded == undefined) {
attrib.rounded = 0;
}
init();
}
public function move(x:uint,y:uint):void {
this.x = x;
this.y = y;
}
public function set color($colorAlpha:Object):void {
attrib.color = $colorAlpha.color;
attrib.alpha = $colorAlpha.alpha;
init();
}
public function size($width:uint, $height:uint):void {
attrib.width = $width;
attrib.height = $height;
init();
}
public function roundedCorner($rounded:uint):void {
attrib.rounded = $rounded;
init();
}
public function get cornerValue():uint {
return attrib.rounded;
}
public function get color():Object {
return [attrib.color,attrib.alpha];
}
private function init():void {
graphics.clear();
graphics.beginFill(attrib.color,attrib.alpha);
graphics.drawRoundRect(0,0,attrib.width,attrib.height,attrib.rounded,attrib.rounded);
graphics.endFill();
dispatchEvent(new Event(COMPLETE));
}
}
}
me gustaría que al hacer una instancia ejemplo myBox poder poner myBox. y que salte el hint con las opciones de los métodos que le cree a la clase...
si alguien tiene alguna idea con respecto a esto se agradece
