Well, you can't actually "alter" the constructor - maybe some hacks in
AS2 that appear to do that, but in AS3, I think maybe you would consider
this inheritance approach:
package
{
import flash.text.TextField;
public class SuperTextField extends TextField
{
public function SuperTextField()
{
super();
styleSheet = whateverStyleSheet;
//whatever else here
}
}
}
Then use SuperTextField instead of TextField in your code.
Jason Merrill
Bank of America
Enterprise Technology & Global Risk L&LD
Instructional Technology & Media
Join the Bank of America Flash Platform Developer Community
Are you a Bank of America associate interested in innovative learning
ideas and technologies?
Check out our internal Innovative Learning Blog & subscribe.
>>-----Original Message-----
>>From: [EMAIL PROTECTED]
>>[mailto:[EMAIL PROTECTED] On Behalf
>>Of Dennis - I Sioux
>>Sent: Wednesday, August 20, 2008 4:11 AM
>>To: Flash Coders List
>>Subject: [Flashcoders] AS3 replacing Textfield Constructor
>>
>>Hey Guys,
>>
>>I'm an experienced AS2 coder but i'm finally starting in AS3
>>and want to port a piece of code that alters the Textfield
>>constructor.
>>I've tried many things.. but think i'm overlooking something.
>>
>>My original AS2 code was:
>>
>>// Alter the constructor of the Textfield var bfrTextField =
>>TextField; var bfrStyleSheet = TextField.StyleSheet;
>>
>>_global.TextField = function() {
>> super();
>> // Do extra code
>>};
>>// reattach the stylesheet class
>> _global.TextField.StyleSheet = function() {
>> super();
>>};
>>
>>TextField.prototype = new bfrTextField();
>>TextField.StyleSheet.prototype = new bfrStyleSheet(); delete
>>bfrTextField; delete bfrStyleSheet;
>>
>>
>>Any help would be appreciated.
>>
>>With kind regards,
>>
>>Dennis
>>Isioux
>>_______________________________________________
>>Flashcoders mailing list
>>[email protected]
>>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders