Extending Bit Components
This is a simple guide to extending the Bit Components. So they can be used like any other AS(Action Script)2 class. It assumes a knowledge of OOP with flash.
I tend not to be fan of components because the code becomes so inaccessible they become difficult to use and you tend to loose flexibility and a editor features such as code hints. Macromedia at least provide the code for their components so you can start to work out what does what.
The Bit Components are quite nice components in that they are lighter weight than the Macromedia alternative but allot of the properties are protected so it becomes difficult to apply custom actions. Hence it’s nicer to extend the them and therefore make all the components properties accessible again from within the Class. Anyhow I’ve jabbered on here long enough the simple process of extending a Bit Components is as follows.
import com.bjc.controls.ScrollPane;
class chat.controls.CustomScrollPane extends ScrollPane{
private var _logger:Logger;
/**
* Constructor
*/
public function CustomScrollPane(){
super(Void);
}
/**
*
*/
public static function create(target:MovieClip,id:String,depth:Number,initObj:Object):CustomScrollPane{
Object.registerClass('ScrollPane',CustomScrollPane);
return CustomScrollPane(target.attachMovie('ScrollPane',id,depth,initObj));
}
}
Theres really not allot to it but the above class is custom ScrollPane that extends the existing Bit Component one. You create an instance of the CustomScrollPane with the following method.
var customSP:CustomScrollPane = CustomScrollPane.create(this,'_customSP',0,{});
Comment on Page
If anything is unclear or just plain wrong let us know and should ammend it pretty sharpish. If you visited the page with a particular question leave it and if it's flash related I'll try to answer it.