[flexcoders] Re: creating a class - question extending
--- In flexcoders@yahoogroups.com, luvfotography [EMAIL PROTECTED] wrote: Hi, I'm trying to create a class that extends the image class, I need to associate a username with the image, Here is what I have: package { import mx.controls.Image; public class imageWithData extends Image { private var _username:String; public function imageWithData() { super(); // _username = ??? } public function set username(value:String):void { _username = value; } public function get username():String { return _username; } } } I am unclear as to what goes after the 'super()' do I need a _username = something? thanks, Why not just use the data property that Image already has?
[flexcoders] Re: creating a class - question extending
--- In flexcoders@yahoogroups.com, Michael VanDaniker [EMAIL PROTECTED] wrote: Image, like all UIComponents, has a zero argument constructor. Unless your imageWithData knows what its username is going to be without any outside info, it wouldn't make sense to do much of anything with the username in the constructor. If you're going to be instantiating your images in Actionscript you can just assign the username after the object is created. You can add arguments to the constructor of most (any?) classes. You just don't pass that argument through to the super(), which doesn't expect or need it. HTH; Amy
[flexcoders] Re: creating a class - question extending
Image, like all UIComponents, has a zero argument constructor. Unless your imageWithData knows what its username is going to be without any outside info, it wouldn't make sense to do much of anything with the username in the constructor. If you're going to be instantiating your images in Actionscript you can just assign the username after the object is created. --- In flexcoders@yahoogroups.com, luvfotography [EMAIL PROTECTED] wrote: Hi, I'm trying to create a class that extends the image class, I need to associate a username with the image, Here is what I have: package { import mx.controls.Image; public class imageWithData extends Image { private var _username:String; public function imageWithData() { super(); // _username = ??? } public function set username(value:String):void { _username = value; } public function get username():String { return _username; } } } I am unclear as to what goes after the 'super()' do I need a _username = something? thanks,