Re: [Flashcoders] AS3 replacing Textfield Constructor

2008-08-22 Thread Dennis - I Sioux

Hey Meril,

As i explained in the mail i just send, the use for this if more to also 
catch the textfields already on stage.
To make it a low level action to let other developers here use multilanguage 
without much effort.


If i use a subClass of Textfield.. i don't change the constructor of the 
textfields already put on stage during development time (in the IDE)


Thanks though :)

Dennis
Isioux

- Original Message - 
From: "Merrill, Jason" <[EMAIL PROTECTED]>

To: "Flash Coders List" 
Sent: Friday, August 22, 2008 5:10 AM
Subject: RE: [Flashcoders] AS3 replacing Textfield Constructor



I would guess it means they won't raise an initialize event, because

he's

not invoking super() in his subclass's constructor.


You mean, like I suggested in my example code? ;)


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

__ NOD32 3377 (20080821) Informatie __

Dit bericht is gecontroleerd door het NOD32 Antivirus Systeem.
http://www.nod32.nl




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3 replacing Textfield Constructor

2008-08-22 Thread Dennis - I Sioux

I made the given AS2 code for a multilanguage class.
When a textfield comes on the screen it will use it's newly given 
constructor, that has the code that it will register itself to my 
multilanguage class.

This way i can collect, addept and update them accordingly.

Because i changed the textfield class itself.. the textfields placed on the 
stage during development will use this constructor automatically at runtime. 
This way i don't have to let other developers in our company, that aren't 
feeling comfortable with scripted textfields, add code next to their 
textfield to register it at the multilanguage.. or let them use a component. 
But they can make stuff how they are used to.. and the multilanguage will 
work without much hassle.


In AS3 .. i believe i can't addept the textfields constructor anymore.. 
unless i'm overlooking something?
Offcourse i could make a component.. or only use scripted textfields.. but i 
would like it to be as flexible as possible.


With kind regards,

Dennis
Isioux

- Original Message - 
From: "Dave Watts" <[EMAIL PROTECTED]>

To: "Flash Coders List" 
Sent: Friday, August 22, 2008 5:00 AM
Subject: RE: [Flashcoders] AS3 replacing Textfield Constructor



Yeah, sorry, you've lost me now.  "the textfields won't give
a signal when they are initialized" - can you explain that?
What kind of signal
- hand signals?  Tornado siren?  "I can't go out with you
because I need to stay home and wash my hair."? ;)


I would guess it means they won't raise an initialize event, because he's
not invoking super() in his subclass's constructor.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

__ NOD32 3377 (20080821) Informatie __

Dit bericht is gecontroleerd door het NOD32 Antivirus Systeem.
http://www.nod32.nl




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] AS3 replacing Textfield Constructor

2008-08-21 Thread Merrill, Jason
>> I would guess it means they won't raise an initialize event, because
he's
>>not invoking super() in his subclass's constructor.

You mean, like I suggested in my example code? ;) 


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] AS3 replacing Textfield Constructor

2008-08-21 Thread Dave Watts
> Yeah, sorry, you've lost me now.  "the textfields won't give 
> a signal when they are initialized" - can you explain that?  
> What kind of signal
> - hand signals?  Tornado siren?  "I can't go out with you 
> because I need to stay home and wash my hair."? ;) 

I would guess it means they won't raise an initialize event, because he's
not invoking super() in his subclass's constructor.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] AS3 replacing Textfield Constructor

2008-08-21 Thread Merrill, Jason
Yeah, sorry, you've lost me now.  "the textfields won't give a signal
when they are initialized" - can you explain that?  What kind of signal
- hand signals?  Tornado siren?  "I can't go out with you because I need
to stay home and wash my hair."? ;) 

Jason

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dennis -
I Sioux
Sent: Thursday, August 21, 2008 3:27 AM
To: Flash Coders List
Subject: Re: [Flashcoders] AS3 replacing Textfield Constructor

Hey Jason and Ekameleon,

Thanks for the reply.

With the old AS2 code i used.. i could "add" extra code to the
textfields 
constructor(without destroying it :D ).
This resulted that both textfields by code and the ones put on the stage
in 
the IDE will have an altered constructor.

This was handy.. because some departments here favour to use the
scripted 
onces.. and other to place them on stage in the IDE. And i need to
collect 
all the textfields for my own actions (that was done with code in the
new 
constructor).

So if i use a custom textfield class.. the textfields placed on the
stage 
won't give a signal when they are initialised.
Now... i could make a component to catch both senario's.. but i rather
not..

Any other thoughts?

Thanks

Dennis
Isioux


- Original Message - 
From: "ekameleon" <[EMAIL PROTECTED]>
To: "Flash Coders List" 
Sent: Wednesday, August 20, 2008 5:37 PM
Subject: Re: [Flashcoders] AS3 replacing Textfield Constructor


> Hello :)
>
> In AS2 or AS1 you can't override the TextField class... if you do that
you
> destroy the native class :)
>
> You must use the prototype hack with the keyword __proto__ to change
the
> nature of your instances
>
> Example :
>
> _global.MyTextField = function()
> {
>super();
>//
> };
>
> MyTextField.prototype.__proto__ = TextField.prototype ;
>
> MyTextField.prototype.myCustomMethod = function() {}
>
> 
>
> var tf:TextField = createTextField("field", 1, 10,10,250,250) ;
>
> // Hack the native instance with your custom class
> tf.__proto__ = MyTextField.prototype ; // hack the prototype
> MyTextField.call(tf) ; // launch the constructor
>
> Now .. you can create a global function or a class, an helper to
simplify
> this hack :)
>
> eKA+ :)
>
>
>
>
>
> 2008/8/20 Dennis - I Sioux <[EMAIL PROTECTED]>
>
>> 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
>> Flashcoders@chattyfig.figleaf.com
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> __ NOD32 3373 (20080821) Informatie __
>
> Dit bericht is gecontroleerd door het NOD32 Antivirus Systeem.
> http://www.nod32.nl
>
> 

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3 replacing Textfield Constructor

2008-08-21 Thread Dennis - I Sioux

Hey Jason and Ekameleon,

Thanks for the reply.

With the old AS2 code i used.. i could "add" extra code to the textfields 
constructor(without destroying it :D ).
This resulted that both textfields by code and the ones put on the stage in 
the IDE will have an altered constructor.


This was handy.. because some departments here favour to use the scripted 
onces.. and other to place them on stage in the IDE. And i need to collect 
all the textfields for my own actions (that was done with code in the new 
constructor).


So if i use a custom textfield class.. the textfields placed on the stage 
won't give a signal when they are initialised.

Now... i could make a component to catch both senario's.. but i rather not..

Any other thoughts?

Thanks

Dennis
Isioux


- Original Message - 
From: "ekameleon" <[EMAIL PROTECTED]>

To: "Flash Coders List" 
Sent: Wednesday, August 20, 2008 5:37 PM
Subject: Re: [Flashcoders] AS3 replacing Textfield Constructor



Hello :)

In AS2 or AS1 you can't override the TextField class... if you do that you
destroy the native class :)

You must use the prototype hack with the keyword __proto__ to change the
nature of your instances

Example :

_global.MyTextField = function()
{
   super();
   //
};

MyTextField.prototype.__proto__ = TextField.prototype ;

MyTextField.prototype.myCustomMethod = function() {}



var tf:TextField = createTextField("field", 1, 10,10,250,250) ;

// Hack the native instance with your custom class
tf.__proto__ = MyTextField.prototype ; // hack the prototype
MyTextField.call(tf) ; // launch the constructor

Now .. you can create a global function or a class, an helper to simplify
this hack :)

eKA+ :)





2008/8/20 Dennis - I Sioux <[EMAIL PROTECTED]>


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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

__ NOD32 3373 (20080821) Informatie __

Dit bericht is gecontroleerd door het NOD32 Antivirus Systeem.
http://www.nod32.nl




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3 replacing Textfield Constructor

2008-08-20 Thread ekameleon
Hello :)

In AS2 or AS1 you can't override the TextField class... if you do that you
destroy the native class :)

You must use the prototype hack with the keyword __proto__ to change the
nature of your instances

Example :

_global.MyTextField = function()
{
super();
//
};

MyTextField.prototype.__proto__ = TextField.prototype ;

MyTextField.prototype.myCustomMethod = function() {}



var tf:TextField = createTextField("field", 1, 10,10,250,250) ;

// Hack the native instance with your custom class
tf.__proto__ = MyTextField.prototype ; // hack the prototype
MyTextField.call(tf) ; // launch the constructor

Now .. you can create a global function or a class, an helper to simplify
this hack :)

eKA+ :)





2008/8/20 Dennis - I Sioux <[EMAIL PROTECTED]>

> 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
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] AS3 replacing Textfield Constructor

2008-08-20 Thread Merrill, Jason
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
>>Flashcoders@chattyfig.figleaf.com
>>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] AS3 replacing Textfield Constructor

2008-08-20 Thread Dennis - I Sioux
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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders