it would seem manuals are written by people. People can be wrong, and are in
this case.

TextFields, MovieClips and Buttons are all AS classes that can be extended.
Each class ships with set of methods and properties that are present in the
subclass. However, most of those props/methods will only work if the
instance object happens to be a display object instance with which the super
class is associated.

Understanding this gives you the ability to do some cool things. Did you
know that you can give the TextField class the getBounds, swapDepths, and
other useful functions that only the MovieClip class has and it works like a
charm:

TextField.prototype.swapDepths = MovieClip.prototype.swapDepths;

Also, you can take any TextField already in existance and make it an
instance of your subclass. The docs are wrong, you can subclass a TextField,
it just doesn't do you much good without a method of instantiation:

mc.createTextField("tf", 0, 0, 0, 100, 20);
Prototype.makeInstanceof(mc.tf);

Prototype is the class I've created to make such a process feel less dirty
to OO purists who still don't realize that all AS2 is AS1 in the end.

This class is available on http://codext.com and will be a core class of the
Flight component set. There are always solutions.

Tyler


On 6/16/06, Michael Stuhr <[EMAIL PROTECTED]> wrote:

Merrill, Jason schrieb:
>>> Peter O'Brien schrieb:
>>>> title says it all really, I'd prefer not to use prototype, is there
> anyway I
>>>> can make an instance of my AS2 extension of TextField?
>
>>> RTFM where it says all about classes.
>>>
>>> micha
>
> Come on now micha, play nice.  It's not like the "manual" has a section
> in classes about extending TextFields -
now you got me: no, it hasn't but creating subclasses is in there.

> You cannot extend the TextField class or static classes
(from: http://livedocs.macromedia.com/flash/8/main/00001359.html)

took me 1 minute to find.

search the archives is an option too:
<
http://chattyfig.figleaf.com/mailman/htdig/flashcoders/2005-March/134251.html
>

don't we have a nettiquette ?

micha
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to