Ely,

Well it hadn't even dawned on me to leave it untyped.  Given the performance issues, and the intended use in this case that's a great solution.  As always, thanks for the quick reply.

Brendan



On 6/26/06, Ely Greenfield <[EMAIL PROTECTED]> wrote:

 
 
Hi Brendan.  When building an OO framework, there's an endless set of decisions one has to make in trading off between accurately representing commonality and 'is a' relationships, and keeping things simple.  We considered pushing some of the more common fields of the cartesian series into a baseclass inserted between them and the Series base, but opted for simplicity instead.
 
In this case, you could take advantage of the dynamic side of AS3 and leave the variable untyped.  When a reference is untyped (typed as *), the compiler defers validating property references until the code is run at runtime.
 
The tradeoff, of course, is that this then becomes a dynamic reference, which sacrifices some performance.  In this case...for a dataTip function, it's probably harmless (i.e., a single dynamic access that's not happening inside a critical loop, or being invoked simultaneously by many components).  But it's a good tradeoff to be aware of in the general case.
 
Ely.
 
 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Brendan Meutzner
Sent: Monday, June 26, 2006 1:04 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: yField in specific Series types

I should point out, this is easily bypassed by doing a check inside the function for "event.hitData.element is ColumnSeries/LineSeries" and acting accordingly, but I thought I'd see if Ely :-) had another suggestion.

Thanks,

Brendan

On 6/26/06, Brendan Meutzner <[EMAIL PROTECTED]> wrote:
Hi,

Came across a bit of an annoyance this morning...

I've got a dual-axis chart which displays a LineSeries and a ColumnSeries.  I'd like to use the same dataTipFunction for both Series.  However, if I try to access the yField inside the function for the particular series, I need to cast the type.  Because I'm using two different Series types, this isn't going to fly, but if I relegate to the parent Series class, it doesn't contain the yField property and I get a compile time error.  Ideas?

Here's the snippet:

returnString += NumberFormatters.thousandsSeperated.format(event.hitData.item[Series(event.hitData.element).yField]) + "\n";
                                                                                                                           ^
                                                                                                            where the problem occurs

Thanks,

Brendan


               


__._,_.___

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





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to