You manipulated the prototype?  As in you worked on A.prototype…?  I can’t see how that would work in MXML and do the right thing.  In order to understand the attribute we need to see the [Event] metadata on the class definition, this means having access to the source.  Assuming you do have access to the source your [Event] metadata should be inherited by the subclasses.  It’s sounding like that’s not happening for you.  I think we’ll need to see a working (or I guess in this case non-working) example, not just pseudocode to see if we can figure out what’s going on.

 

Matt

 


From: [email protected] [mailto:[email protected]] On Behalf Of svktiilikainen
Sent: Tuesday, August 02, 2005 5:28 AM
To: [email protected]
Subject: [flexcoders] Re: Custom event & inheritance

 

Hello,

I already commented this but the message appears to have
disappeared - another try.

Explanation:
In the Application AS file, the prototype of a standard class A is
manipulated so that the class has event E. The event is dispatched
with "this.dispatchEvent({target:this,type:"E",...});

Now if I specify an event handler in an MXML file like <mx:A id="id"
E="doSomething()"/>, everything works just fine.

But: I also want to use class B which extends class C extending
class A, ie. B is a subclass of A. If I write like before <mx:B
id="id" E="doSomethingElse()"/>, the compiler says that the E
attribute is unknown.

So, this E event has to be declared all over again for class B??
What exactly does this mean?

Satu


--- In [email protected], "Matt Chotin" <[EMAIL PROTECTED]>
wrote:
> All [Event] metadata is inherited by the subclass so you shouldn't
have
> any problems.  But you can't dispatch the event, you have to have
it
> declared on the class definition for MXML to pick it up.
>

>
> Matt
>

>
> ________________________________
>
> From: [email protected]
[mailto:[email protected]] On
> Behalf Of svktiilikainen
> Sent: Monday, August 01, 2005 1:48 AM
> To: [email protected]
> Subject: [flexcoders] Custom event & inheritance
>

>
> Hi all,
>
> how should a custom event be used in subclasses?
>
> I have a custom event specified in the prototype of an AS class,
say
> ScrollSelectList. Now I want to use the event in an instance of a
> subclass of ScrollSelectList, say DataGrid. If I just write
something
> like
> <mx:DataGrid id="myGrid" event-name="function-name">,
> 'event-name' being the event to catch, Flex throws an error
> "unknown attribute 'event-name' on myGrid".
> The event handling works just fine when used in the parent
> (ScrollSelectList) class instance.
>
> Should the event be declared somehow for subclass as well?
>
> Thanks,
> Satu
>
>
>
>
> --
> Flexcoders Mailing List
> FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com
>
>
>
>
> ________________________________
>
> YAHOO! GROUPS LINKS
>

>
> *      Visit your group "flexcoders
> <http://groups.yahoo.com/group/flexcoders> " on the web.
>        
> *      To unsubscribe from this group, send an email to:
>       [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]
subject=Unsubscribe>
>        
> *      Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/> .
>

>
> ________________________________






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to