Hi,

I'm glad it worked. There was a mistake in my first post: the object you want 
to call the function on needs to be added to the Delegate call. In your case:

dg.getColumnAt( 0 ).labelFunction = mx.utils.Delegate.create(dgVH, 
dgVH.labelFunc);

This enforces that the function is called with the right scope. 

Dirk.

-----Original Message-----
From: Simon Fifield [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 30, 2005 5:45 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] LabelFunctions and SortFunctions


Hi Dirk,

Thanks for the suggestion, I hadn't thought of that, but it didn't work when I 
tried it. So I tried just 

dg.getColumnAt( 0 ).labelFunction = dgVH.labelFunc;

and this did work. Its a big improvement over wrapping external class functions 
with a function!

But what I was originally trying to do was set the labelfunction in the MXML 
which was giving the error I described. I also tried your suggestion here, but 
this didn't work either.

Thanks for your pointer,

Regards,
Simon Fifield

-----Original Message-----
From: Dirk Eismann [mailto:[EMAIL PROTECTED]
Sent: 30 March 2005 15:05
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] LabelFunctions and SortFunctions


Have you tried using the mx.utils.Delegate class?

  myGrid.getColumnAt(0).labelFunction = 
mx.utils.Delegate.create(anotherClassInstance, anotherFunction);

haven't tested it, but it should work.

Dirk.

-----Original Message-----
From: Simon Fifield [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 30, 2005 4:03 PM
To: [EMAIL PROTECTED] Com
Subject: [flexcoders] LabelFunctions and SortFunctions


At the moment a labelFunction or sortFunction has to be defined in the MXML 
file that it is being used in.

It would be nice to be able to use an external Class to achieve this and thus 
enhance code clarity and re-use.

Does anyone have any ideas on this?

Kind Regards,

Simon Fifield


Yahoo! Groups Sponsor
ADVERTISEMENT






Yahoo! Groups Links

To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
  
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
  
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


Yahoo! Groups Sponsor
ADVERTISEMENT






Yahoo! Groups Links

To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
  
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
  
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to