Thanks for the tip Gordon. I'm assuming that a class would perform better than the dynamic objects because the properties are defined at compile-time. Is this more of what you had in mind?
-TH
package
{
public class ColorPickerDataProviderItem
{
public var label:String;
public var color:uint;
}
}
private function addColor(event:Event):void {
var itm:Object = cp.dataProvider[ cp.selectedIndex ];
var colorPickerDataProviderItem:ColorPickerDataProviderItem = new ColorPickerDataProviderItem;
colorPickerDataProviderItem.label = itm.label;
colorPickerDataProviderItem.color = itm.color;
colorArray.push(colorPickerDataProviderItem);
}
--- In [email protected], "Gordon Smith" <[EMAIL PROTECTED]> wrote:
>
> > I wonder if there is additional overhead associated with declaring
> untyped special type variables (*) compared to typed variables?
>
> Yes, I believe there is; if the compiler doesn't know anything about the
> type it can't optimize the generated code as well. But there is no
> reason to use * here; you could declare var itm:Object instead. The only
> reason to use * is when you need to store 'undefined' in addition to
> 'null'.
>
>
>
> However, there is definitely an overhead associated with using dynamic
> classes like Ojbect. If you want the best performance, don't use
> dtynamic Objects like { label: xxx, color: yyy }; instead declare a
> nondynamic ColorPickerDataProviderItem class with 'label' and 'color'
> properties.
>
>
>
> However, in this case I doubt you'll actually be able to see any better
> performance because these objects don't get accessed a huge number of
> times.
>
>
>
> - Gordon
>
>
>
> ________________________________
>
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of Tim Hoff
> Sent: Sunday, June 18, 2006 1:41 AM
> To: [email protected]
> Subject: [flexcoders] Re: F2B3: Possible bugs with ComboBox ItemRenderer
> and ColorPicker
>
>
>
> Thanks for the great tips. The changes worked great. I wonder if there
> is additional overhead associated with declaring untyped special type
> variables (*) compared to typed variables?
>
> I couldn't get the color picker focus border to dissapear completely.
> Nothing that I tried with the FocusManager worked. I'm probably just
> doing it wrong. But, for now the sample is good enough to demonstrate
> the ComboBox ItemRenderer concepts.
>
> Thanks again,
> Tim Hoff
>
> http://www.cflex.net/showfiledetails.cfm?ChannelID=1&Object=File&objectI
> D=447
> <http://www.cflex.net/showfiledetails.cfm?ChannelID=1&Object=File&object
> ID=447>
>
> --- In [email protected], "Jeremy Lu" wade.lu@ wrote:
> >
> > hi Tim,
> >
> > try this (solves yellow can't be selected problem):
> >
> > private function addColor(event:Event):void {
> > cp.visible = false;
> > //
> > var itm:* = cp.dataProvider[ cp.selectedIndex ];
> > Util.traceValue(itm);
> > //
> > colorArray.push({label:itm.label, color:itm.color});
> > messageText.setStyle('color',itm.color);
> > messageText.text = itm.label + " has been added to the comboBox.";
> > cbxColor.open();
> > btnAddColor.setFocus();
> > }
> >
> > things I changed:
> >
> > 1. listen to! ColorPicker's "close" event, instead of "change" event
> >
> > 2. get the value from cp using "selectedIndex" instead of
> "selectedItem",
> > this will ensure you get the right value out of the picker.
> >
> > regarding the focus around cp after it's set invisible, can't figure
> out it,
> > but in the past when I ran into this, I usually set focus to a
> textfield off
> > the stage or completely turn off the focus.
> >
>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
| Web site design development | Computer software development | Software design and development |
| Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

