Jan,

Thanks, but I'm not having any luck.  I'm trying to force my EXML class to
create all of it's nodes of class EXMLNode instead of XMLNode.  That way, my
custom methods are accessible at any node in the tree.  Unfortunately, it
seems that all of the nodes of the tree are type XMLnode, not EXMLNode.

What I can't figure out is what methods are used in the intrinsic XML class
to create nodes in the first place, and how to "rewire" them to create nodes
of class EXMLNode instead of XMLNode.

Maybe I'm biting off more than I can chew for my first AS2 project... I
don't know.

Any ideas are much appreciated.

Thanks!
-rc


On 1/4/06, Jan Schluenzen <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I ran into the exact same problem about a year ago... The XML class
> doesn't
> really make it easy to extend... The way I solved it is by overriding all
> necessary methods of the XML class with methods in my extended version, so
> EXML in your case.
> E.g.
>
> function someOverridenMethod():EXML {
> // do some other stuff
>   ....
>   return new EXML( this.cloneNode(true).toString() );
> }
>
> That way all instances of XMLNode are converted to EXML before being
> returned.
> This could of course also be used for newly added methods in your extended
> class...
>
> Hope that helps.
> Jan
>
>
>
> On 1/4/06, Rifled Cloaca <[EMAIL PROTECTED]> wrote:
> >
> > Hi!
> >
> > I'm new to AS2, and I'm trying to convert some old AS1 code to
> AS2.  This
> > code uses XML.prototype to add functionality to the XML class (which is
> > based on the XMLNode class, but you knew that already).  I'm creating a
> > new
> > class like this:
> >
> > dynamic class core.EXML extends XML {
> > }
> >
> > This new XML class has new properties in each of its nodes, so I add:
> >
> >
> > dynamic class core.EXML extends XML {
> >
> > public var _MC:MovieClip;
> > public var _parentMC:MovieClip;
> >
> > }
> >
> > But, unfortunately, since the EXML class inherits from the XML class,
> the
> > nodes are of XMLNode class, not EXML class, so the nodes do not inherit
> > the
> > properties and methods I create in the new EXML class.
> >
> > So, my question is, how do I create a class that creates instances of
> > itself, or say, an EXMLNode class that inherits from XMLNode?
> >
> > Any help is greatly appreciated.  Thanks!
> >
> > -rc
> > _______________________________________________
> > Flashcoders mailing list
> > [email protected]
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to