Re: [flexcoders] custom components destroy Flex design mode ....

2009-09-03 Thread Pan Troglodytes
I've run into similar situations before with 3rd party components.  For some
reason, some of them just utterly break the MXML design mode.  I've also
done it myself when subclassing the charting components.  You just get a big
rectangle with a big red X over the whole area.

On Tue, Sep 1, 2009 at 5:46 PM, Fotis Chatzinikos 
fotis.chatzini...@gmail.com wrote:



 Something wrong probably with your install...

 I do not know what, but here, I 75% of my app is custom and i never had
 this problem
 (Vista, AND XP)

 Hopefully somebody else can provide some real help thought, and not just
 'it plays here :-)'


 On Tue, Sep 1, 2009 at 10:30 PM, chigwell23 chigwel...@yahoo.com wrote:



 This one is starting to really drive me crazy ... placing any one of a
 multitude of custom components on the mxml stops design mode from opening.
 Just grabbed the SteelPotato footerdatagrid to see if it can be seen if it
 is used. Nope - stops design mode. Wanted to try it because our
 implementation of Alex's solution also stops design mode from opening. The
 FlexLib buttons do the same thing - code them into source view and no more
 design view.

 How do you deal with this? Our corporate dashboards are starting to get
 very detailed and we need a WYSIWYG view to adjust things. Do we really have
 to compile, run application, view in browser, check, and then go back to
 source mode to increase the width of a button if needed? Any info really
 appreciated. TIA,

 Mic.




 --
 Fotis Chatzinikos, Ph.D.
 Founder,
 Phinnovation
 fotis.chatzini...@gmail.com,
  




-- 
Jason


[flexcoders] charting and/or grid replacements

2009-09-03 Thread Pan Troglodytes
Are there any 3rd-party charting and/or grid replacements in progress that
anyone wants to talk about?  I'm looking to move away from the
AdvancedDataGrid and possibly also Flex charting and am wondering what might
be on the horizon.  Right now Adobe pretty much has the only game in town
for these Flex components as far as I know.

I really wish DevExpress could be brought around to developing for Flex.
Their grid components can have a incredibly steep learning curve due to the
staggering amount of features, but I've found them to be quite a perfect fit
with a professional quality application.  I can only imagine what they'd
build from scratch for Flex.

This is not to dump on Adobe, necessarily.  They're trying to organize their
budget where they thing it's most effective, even if I disagree with it.
But without a rich 3rd-party component ecosystem, I'm afraid that this great
technology (I'm totally in love with the general process of programming for
Flex) might wither on the vine.

-- 
Jason


Re: [flexcoders] Re: why does my MXML act differently than my AS?

2009-07-09 Thread Pan Troglodytes
Yes, that's what I was referring to in the first post about digging through
the generated source.

On Thu, Jul 9, 2009 at 5:42 AM, Tom Chiverton
tom.chiver...@halliwells.comwrote:



  On Wednesday 08 Jul 2009, Pan Troglodytes wrote:
  For those interested:
  https://bugs.adobe.com/jira/browse/FB-21363

 Have you used '--keep-source' from the MXML version and compared to your AS

 class ?

 --
 Helping to widespreadedly market supply-chains as part of the IT team of
 the
 year, '09 and '08

 

 This email is sent for and on behalf of Halliwells LLP.

 Halliwells LLP is a limited liability partnership registered in England and
 Wales under registered number OC307980 whose registered office address is at
 Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB. A list
 of members is available for inspection at the registered office together
 with a list of those non members who are referred to as partners. We use the
 word ?partner? to refer to a member of the LLP, or an employee or consultant
 with equivalent standing and qualifications. Regulated by the Solicitors
 Regulation Authority.

 CONFIDENTIALITY

 This email is intended only for the use of the addressee named above and
 may be confidential or legally privileged. If you are not the addressee you
 must not read it and must not use any information contained in nor copy it
 nor inform any person other than Halliwells LLP or the addressee of its
 existence or contents. If you have received this email in error please
 delete it and notify Halliwells LLP IT Department on 0870 365 2500.

 For more information about Halliwells LLP visit www.Halliwells.com.
  




-- 
Jason


Re: [flexcoders] Re: why does my MXML act differently than my AS?

2009-07-07 Thread Pan Troglodytes
Done!

For those interested:
https://bugs.adobe.com/jira/browse/FB-21363


On Tue, Jul 7, 2009 at 12:30 PM, valdhor valdhorli...@embarqmail.comwrote:



 If it were me, I would submit it as a bug. If it isn't, an Adobe engineer
 will tell you so. At least you'd get an answer.


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes chimpathe...@... wrote:
 
  I'm torn on whether to submit this as a bug. I wish someone at adobe
  could step in and say well, that's not equivalent MXML because you
 forgot
  about __.
 
  On Thu, Jul 2, 2009 at 10:32 AM, valdhor valdhorli...@...wrote:
 
  
  
   Nope.
  
   I confirmed what you are seeing but couldn't figure out why in the
 limited
   time I had to look at it.
  
   I am going to have to defer to someone more knowledgeable.
  
  
   --- In flexcoders@yahoogroups.com 
   flexcoders%40yahoogroups.comflexcoders%
 40yahoogroups.com, Pan

   Troglodytes chimpathetic@ wrote:
   
No ideas on this one?
   
On Wed, Jun 17, 2009 at 12:00 PM, Pan Troglodytes chimpathetic@
   ...wrote:
  
   
 I have a test program that, as far as I can tell, does the same
 thing
   using
 an MXML component and the equivalent actionscript. When I click on
 the
 button to execute the AS version, everything is fine. But when I
 click
   on
 the button to execute the MXML version, I get a layout flicker.
 It's
   bad
 enough that if you try to click on the MXML button over and over
 really
 fast, you'll wind up clicking the main app and the menu will go
 away.
 Here's the code:


 ?xml version=1.0 encoding=utf-8?
 Application
 xmlns=http://www.adobe.com/2006/mxml;
 layout=absolute
 
 Script
 ![CDATA[
 import mx.containers.GridItem;
 import mx.controls.Label;
 import mx.controls.DateField;
 private function addCategoryAS():void
 {
 var gi:GridItem;
 var gr:GridRow = new GridRow;

 gi = new GridItem;
 gr.addChild(gi);
 gi.addChild(new Label);

 addRow(gr);
 }

 private function addCategoryMXML():void
 {
 var gr:GridRow = new TestGridRow;
 gr.initialize(); // this is just to try to make it equivalent -
 doesn't change flicker

 addRow(gr);
 }

 private function addRow(gr:GridRow):void
 {
 grid.addChildAt(gr, 0);

 var gi:GridItem;

 gi = gr.getChildAt(0) as GridItem;
 (gi.getChildAt(0) as Label).text = item  + grid.numChildren +
 :;

 gr.validateSize(true);
 var verticalGap:Number = grid.getStyle(verticalGap);
 popup.scrollRect = new Rectangle(0, 0, Math.max(popup.width +
 gr.measuredWidth),
 popup.height + gr.measuredHeight + (isNaN(verticalGap) ? 0 :
 verticalGap));
 if (popup.localToGlobal(new Point(0, 0)).y 
 popup.owner.localToGlobal(new Point(0, 0)).y)
 popup.y -= gr.measuredHeight + (isNaN(verticalGap) ? 0 :
 verticalGap);
 }
 ]]
 /Script

 Canvas bottom=0
 PopUpButton id=myPopupButton openAlways=true
 popUp
 Canvas id=popup
 Grid id=grid paddingTop=4 paddingBottom=4 paddingLeft=4
 paddingRight=4
 fontSize=12 backgroundColor=0xFF borderStyle=outset
 borderThickness=2
 
 GridRow
 GridItem
 Button label=Add AS click=addCategoryAS()/
 Button label=Add MXML click=addCategoryMXML()/
 /GridItem
 /GridRow
 /Grid
 /Canvas
 /popUp
 /PopUpButton
 /Canvas
 /Application

 TestGridRow.mxml:
 ?xml version=1.0 encoding=utf-8?
 GridRow xmlns=http://www.adobe.com/2006/mxml;
 GridItem
 Label/
 /GridItem
 /GridRow


 I've dug through the generated code and have not been able to find
   anything
 that I think would account for the problem. This is frustrating,
   because
 what I really want to do is a more complicated MXML component to
 make
   it a
 lot nicer to add rows in my addCategory function. But I can't as
 long
   as
 it's going to be so jittery.

 Thanks!

 --
 Jason

   
   
   
--
Jason
   
  
  
  
 
 
 
  --
  Jason
 

  




-- 
Jason


Re: [flexcoders] Re: why does my MXML act differently than my AS?

2009-07-03 Thread Pan Troglodytes
I'm torn on whether to submit this as a bug.  I wish someone at adobe
could step in and say well, that's not equivalent MXML because you forgot
about __.

On Thu, Jul 2, 2009 at 10:32 AM, valdhor valdhorli...@embarqmail.comwrote:



 Nope.

 I confirmed what you are seeing but couldn't figure out why in the limited
 time I had to look at it.

 I am going to have to defer to someone more knowledgeable.


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes chimpathe...@... wrote:
 
  No ideas on this one?
 
  On Wed, Jun 17, 2009 at 12:00 PM, Pan Troglodytes chimpathetic@
 ...wrote:

 
   I have a test program that, as far as I can tell, does the same thing
 using
   an MXML component and the equivalent actionscript. When I click on the
   button to execute the AS version, everything is fine. But when I click
 on
   the button to execute the MXML version, I get a layout flicker. It's
 bad
   enough that if you try to click on the MXML button over and over really
   fast, you'll wind up clicking the main app and the menu will go away.
   Here's the code:
  
  
   ?xml version=1.0 encoding=utf-8?
   Application
   xmlns=http://www.adobe.com/2006/mxml;
   layout=absolute
   
   Script
   ![CDATA[
   import mx.containers.GridItem;
   import mx.controls.Label;
   import mx.controls.DateField;
   private function addCategoryAS():void
   {
   var gi:GridItem;
   var gr:GridRow = new GridRow;
  
   gi = new GridItem;
   gr.addChild(gi);
   gi.addChild(new Label);
  
   addRow(gr);
   }
  
   private function addCategoryMXML():void
   {
   var gr:GridRow = new TestGridRow;
   gr.initialize(); // this is just to try to make it equivalent -
   doesn't change flicker
  
   addRow(gr);
   }
  
   private function addRow(gr:GridRow):void
   {
   grid.addChildAt(gr, 0);
  
   var gi:GridItem;
  
   gi = gr.getChildAt(0) as GridItem;
   (gi.getChildAt(0) as Label).text = item  + grid.numChildren +
   :;
  
   gr.validateSize(true);
   var verticalGap:Number = grid.getStyle(verticalGap);
   popup.scrollRect = new Rectangle(0, 0, Math.max(popup.width +
   gr.measuredWidth),
   popup.height + gr.measuredHeight + (isNaN(verticalGap) ? 0 :
   verticalGap));
   if (popup.localToGlobal(new Point(0, 0)).y 
   popup.owner.localToGlobal(new Point(0, 0)).y)
   popup.y -= gr.measuredHeight + (isNaN(verticalGap) ? 0 :
   verticalGap);
   }
   ]]
   /Script
  
   Canvas bottom=0
   PopUpButton id=myPopupButton openAlways=true
   popUp
   Canvas id=popup
   Grid id=grid paddingTop=4 paddingBottom=4 paddingLeft=4
   paddingRight=4
   fontSize=12 backgroundColor=0xFF borderStyle=outset
   borderThickness=2
   
   GridRow
   GridItem
   Button label=Add AS click=addCategoryAS()/
   Button label=Add MXML click=addCategoryMXML()/
   /GridItem
   /GridRow
   /Grid
   /Canvas
   /popUp
   /PopUpButton
   /Canvas
   /Application
  
   TestGridRow.mxml:
   ?xml version=1.0 encoding=utf-8?
   GridRow xmlns=http://www.adobe.com/2006/mxml;
   GridItem
   Label/
   /GridItem
   /GridRow
  
  
   I've dug through the generated code and have not been able to find
 anything
   that I think would account for the problem. This is frustrating,
 because
   what I really want to do is a more complicated MXML component to make
 it a
   lot nicer to add rows in my addCategory function. But I can't as long
 as
   it's going to be so jittery.
  
   Thanks!
  
   --
   Jason
  
 
 
 
  --
  Jason
 

  




-- 
Jason


Re: [flexcoders] Re: how can you make the icon in an AdvancedDataGridGroupItemRenderer accept clicks?

2009-07-02 Thread Pan Troglodytes
Yes, I wondered why they set it, too.  It's quite mysterious.

And as far as extending ADGGIR - have you looked at that code?  They were
good about making very little of it private or mx_internal (yes, I know I
can get around the latter), but the bulk of it is done in commitProperties.
So you'd be limited to just stuff you could take on to the end of the
overridden function.  Likely I'd just clone the unit and change the bit of
code I was interested in.

On Wed, Jul 1, 2009 at 8:14 AM, valdhor valdhorli...@embarqmail.com wrote:



 I'm glad you found an easy way to get the functionality you wanted.

 According to the docs, mouseEnabled defaults to true. I wonder why the
 ADGGIR constructor sets it to false? Also, why don't the docs reflect this?

 I just wanted to say that if you still wanted the functionality from
 AdvancedDataGridGroupItemRenderer and you wanted extra functionality, you
 can extend AdvancedDataGridGroupItemRenderer for your renderer. Best of both
 worlds ;-)


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes chimpathe...@... wrote:
 
  Well, the main reason I wouldn't want to write my own itemRenderer is
 that
  AdvancedDataGridGroupItemRenderer does a lot of stuff I wouldn't want to
  have to reinvent. It also interacts with stuff like iconFunction that
 would
  be annoying to re-implement. Plus, there's the fact that there's a high
  likelihood that what I wrote would be much less efficient.
 
  But good news! I found a simple way to achieve what I want:
 
  ?xml version=1.0 encoding=utf-8?
  Application
  xmlns=http://www.adobe.com/2006/mxml;
  
  Script
  ![CDATA[
  // put any icon you want in the embed below, doesn't matter
  [Bindable] [Embed(source=imageA.png)] private var imgClass:Class;
 
  private function geticon(item:Object):Class
  {
  return imgClass;
  }
  ]]
  /Script
  AdvancedDataGrid iconFunction=geticon itemClick=trace('itemclick')
  click=trace('gridclick')
  groupItemRenderer
  Component
  AdvancedDataGridGroupItemRenderer mouseEnabled=true/
  /Component
  /groupItemRenderer
  dataProvider
  HierarchicalData childrenField=subitems source={[{label:'test'},
  {label:'test2'}]}/
  /dataProvider
  columns
  AdvancedDataGridColumn dataField=label/
  /columns
  /AdvancedDataGrid
  /Application
 
  The key was setting mouseEnabled=true. It is set to false in the
  constructor for ADGGIR. I'm not sure why, and I am a little worried that
 I
  may be messing up something important. So far I haven't noticed any odd
  behavior. But if anyone knows a good reason WHY mouseEnabled is set this
  way, please followup.
 
 
  On Mon, Jun 29, 2009 at 11:13 AM, valdhor valdhorli...@...wrote:
 
  
  
   Why not just use an itemRenderer?
  
   AFAIK. you can't capture a mouse event on a Class object as it does not
   implement iEventDispatcher. I suppose you could extend Class and
 implement
   iEventDispatcher but I have never tried it.
  
  
   --- In flexcoders@yahoogroups.com 
   flexcoders%40yahoogroups.comflexcoders%
 40yahoogroups.com, Pan

   Troglodytes chimpathetic@ wrote:
   
No ideas on how to do this at all?
   
On Tue, Jun 9, 2009 at 4:13 PM, Pan Troglodytes chimpathetic@
 wrote:
  
   
 I've got a bit of a problem and haven't been able to figure it out.
   When
 using hierarchical views with ADG, I find that the icon can't be
   clicked on
 to select the row. I can't figure out how to capture a click on the
   icon at
 all.

 ?xml version=1.0 encoding=utf-8?
 Application
 xmlns=http://www.adobe.com/2006/mxml;
 
 Script
 ![CDATA[
 // put any icon you want in the embed below, doesn't matter
 [Bindable] [Embed(source=imageA.png)] private var imgClass:Class;

 private function geticon(item:Object):Class
 {
 return imgClass;
 }
 ]]
 /Script
 AdvancedDataGrid iconFunction=geticon
 itemClick=trace('itemclick')
 click=trace('gridclick')
 dataProvider
 HierarchicalData childrenField=subitems
 source={[{label:'test'},
 {label:'test2'}]}/
 /dataProvider
 columns
 AdvancedDataGridColumn dataField=label/
 /columns
 /AdvancedDataGrid
 /Application

 If you click anywhere but the icon, the gridclick and itemclick
 events
   both
 fire. But if you click on the icon, you get only the gridclick. And
 the
 gridclick event doesn't get anything useful for
 target/currentTarget,
   as far
 as I can tell.

 The main thing I really want to do is have clicking on the icon
 select
   the
 row, just like clicking anywhere else will do. Tangentially, it
 would
   be
 nice to know how to capture the event in case I wanted to do
 something
 different with clicking on the icon.

 --
 Jason

   
   
   
--
Jason
   
  
  
  
 
 
 
  --
  Jason
 

  




-- 
Jason


[flexcoders] Re: why does my MXML act differently than my AS?

2009-07-02 Thread Pan Troglodytes
No ideas on this one?

On Wed, Jun 17, 2009 at 12:00 PM, Pan Troglodytes chimpathe...@gmail.comwrote:

 I have a test program that, as far as I can tell, does the same thing using
 an MXML component and the equivalent actionscript.  When I click on the
 button to execute the AS version, everything is fine.  But when I click on
 the button to execute the MXML version, I get a layout flicker.  It's bad
 enough that if you try to click on the MXML button over and over really
 fast, you'll wind up clicking the main app and the menu will go away.
 Here's the code:


 ?xml version=1.0 encoding=utf-8?
 Application
   xmlns=http://www.adobe.com/2006/mxml;
   layout=absolute
   
   Script
 ![CDATA[
   import mx.containers.GridItem;
   import mx.controls.Label;
   import mx.controls.DateField;
   private function addCategoryAS():void
   {
 var gi:GridItem;
 var gr:GridRow = new GridRow;

 gi = new GridItem;
 gr.addChild(gi);
 gi.addChild(new Label);

 addRow(gr);
   }

   private function addCategoryMXML():void
   {
 var gr:GridRow = new TestGridRow;
 gr.initialize(); // this is just to try to make it equivalent -
 doesn't change flicker

 addRow(gr);
   }

   private function addRow(gr:GridRow):void
   {
 grid.addChildAt(gr, 0);

 var gi:GridItem;

 gi = gr.getChildAt(0) as GridItem;
 (gi.getChildAt(0) as Label).text = item  + grid.numChildren +
 :;

 gr.validateSize(true);
 var verticalGap:Number = grid.getStyle(verticalGap);
 popup.scrollRect = new Rectangle(0, 0, Math.max(popup.width +
 gr.measuredWidth),
 popup.height + gr.measuredHeight + (isNaN(verticalGap) ? 0 :
 verticalGap));
 if (popup.localToGlobal(new Point(0, 0)).y 
 popup.owner.localToGlobal(new Point(0, 0)).y)
   popup.y -= gr.measuredHeight + (isNaN(verticalGap) ? 0 :
 verticalGap);
   }
 ]]
   /Script

   Canvas bottom=0
 PopUpButton id=myPopupButton openAlways=true
   popUp
 Canvas id=popup
   Grid id=grid paddingTop=4 paddingBottom=4 paddingLeft=4
 paddingRight=4
 fontSize=12 backgroundColor=0xFF borderStyle=outset
 borderThickness=2
 
 GridRow
   GridItem
 Button label=Add AS click=addCategoryAS()/
 Button label=Add MXML click=addCategoryMXML()/
   /GridItem
 /GridRow
   /Grid
 /Canvas
   /popUp
 /PopUpButton
   /Canvas
 /Application

 TestGridRow.mxml:
 ?xml version=1.0 encoding=utf-8?
 GridRow xmlns=http://www.adobe.com/2006/mxml;
   GridItem
 Label/
   /GridItem
 /GridRow


 I've dug through the generated code and have not been able to find anything
 that I think would account for the problem.  This is frustrating, because
 what I really want to do is a more complicated MXML component to make it a
 lot nicer to add rows in my addCategory function.  But I can't as long as
 it's going to be so jittery.

 Thanks!

 --
 Jason




-- 
Jason


Re: [flexcoders] Re: how can you make the icon in an AdvancedDataGridGroupItemRenderer accept clicks?

2009-06-30 Thread Pan Troglodytes
Well, the main reason I wouldn't want to write my own itemRenderer is that
AdvancedDataGridGroupItemRenderer does a lot of stuff I wouldn't want to
have to reinvent.  It also interacts with stuff like iconFunction that would
be annoying to re-implement.  Plus, there's the fact that there's a high
likelihood that what I wrote would be much less efficient.

But good news!  I found a simple way to achieve what I want:

?xml version=1.0 encoding=utf-8?
Application
  xmlns=http://www.adobe.com/2006/mxml;
  
  Script
![CDATA[
  // put any icon you want in the embed below, doesn't matter
  [Bindable] [Embed(source=imageA.png)] private var imgClass:Class;

  private function geticon(item:Object):Class
  {
return imgClass;
  }
]]
  /Script
  AdvancedDataGrid iconFunction=geticon itemClick=trace('itemclick')
click=trace('gridclick')
groupItemRenderer
  Component
AdvancedDataGridGroupItemRenderer mouseEnabled=true/
  /Component
/groupItemRenderer
dataProvider
  HierarchicalData childrenField=subitems source={[{label:'test'},
{label:'test2'}]}/
/dataProvider
columns
  AdvancedDataGridColumn dataField=label/
 /columns
  /AdvancedDataGrid
/Application

The key was setting mouseEnabled=true.  It is set to false in the
constructor for ADGGIR.  I'm not sure why, and I am a little worried that I
may be messing up something important.  So far I haven't noticed any odd
behavior.  But if anyone knows a good reason WHY mouseEnabled is set this
way, please followup.


On Mon, Jun 29, 2009 at 11:13 AM, valdhor valdhorli...@embarqmail.comwrote:



 Why not just use an itemRenderer?

 AFAIK. you can't capture a mouse event on a Class object as it does not
 implement iEventDispatcher. I suppose you could extend Class and implement
 iEventDispatcher but I have never tried it.


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes chimpathe...@... wrote:
 
  No ideas on how to do this at all?
 
  On Tue, Jun 9, 2009 at 4:13 PM, Pan Troglodytes chimpathe...@...wrote:

 
   I've got a bit of a problem and haven't been able to figure it out.
 When
   using hierarchical views with ADG, I find that the icon can't be
 clicked on
   to select the row. I can't figure out how to capture a click on the
 icon at
   all.
  
   ?xml version=1.0 encoding=utf-8?
   Application
   xmlns=http://www.adobe.com/2006/mxml;
   
   Script
   ![CDATA[
   // put any icon you want in the embed below, doesn't matter
   [Bindable] [Embed(source=imageA.png)] private var imgClass:Class;
  
   private function geticon(item:Object):Class
   {
   return imgClass;
   }
   ]]
   /Script
   AdvancedDataGrid iconFunction=geticon itemClick=trace('itemclick')
   click=trace('gridclick')
   dataProvider
   HierarchicalData childrenField=subitems source={[{label:'test'},
   {label:'test2'}]}/
   /dataProvider
   columns
   AdvancedDataGridColumn dataField=label/
   /columns
   /AdvancedDataGrid
   /Application
  
   If you click anywhere but the icon, the gridclick and itemclick events
 both
   fire. But if you click on the icon, you get only the gridclick. And the
   gridclick event doesn't get anything useful for target/currentTarget,
 as far
   as I can tell.
  
   The main thing I really want to do is have clicking on the icon select
 the
   row, just like clicking anywhere else will do. Tangentially, it would
 be
   nice to know how to capture the event in case I wanted to do something
   different with clicking on the icon.
  
   --
   Jason
  
 
 
 
  --
  Jason
 

  




-- 
Jason


[flexcoders] Re: how can you make the icon in an AdvancedDataGridGroupItemRenderer accept clicks?

2009-06-29 Thread Pan Troglodytes
No ideas on how to do this at all?

On Tue, Jun 9, 2009 at 4:13 PM, Pan Troglodytes chimpathe...@gmail.comwrote:

 I've got a bit of a problem and haven't been able to figure it out.  When
 using hierarchical views with ADG, I find that the icon can't be clicked on
 to select the row.  I can't figure out how to capture a click on the icon at
 all.

 ?xml version=1.0 encoding=utf-8?
 Application
   xmlns=http://www.adobe.com/2006/mxml;
   
   Script
 ![CDATA[
   // put any icon you want in the embed below, doesn't matter
   [Bindable] [Embed(source=imageA.png)] private var imgClass:Class;

   private function geticon(item:Object):Class
   {
 return imgClass;
   }
 ]]
   /Script
   AdvancedDataGrid iconFunction=geticon itemClick=trace('itemclick')
 click=trace('gridclick')
 dataProvider
   HierarchicalData childrenField=subitems source={[{label:'test'},
 {label:'test2'}]}/
 /dataProvider
 columns
   AdvancedDataGridColumn dataField=label/
  /columns
   /AdvancedDataGrid
 /Application

 If you click anywhere but the icon, the gridclick and itemclick events both
 fire.  But if you click on the icon, you get only the gridclick.  And the
 gridclick event doesn't get anything useful for target/currentTarget, as far
 as I can tell.

 The main thing I really want to do is have clicking on the icon select the
 row, just like clicking anywhere else will do.  Tangentially, it would be
 nice to know how to capture the event in case I wanted to do something
 different with clicking on the icon.

 --
 Jason




-- 
Jason


[flexcoders] why does my MXML act differently than my AS?

2009-06-17 Thread Pan Troglodytes
I have a test program that, as far as I can tell, does the same thing using
an MXML component and the equivalent actionscript.  When I click on the
button to execute the AS version, everything is fine.  But when I click on
the button to execute the MXML version, I get a layout flicker.  It's bad
enough that if you try to click on the MXML button over and over really
fast, you'll wind up clicking the main app and the menu will go away.
Here's the code:


?xml version=1.0 encoding=utf-8?
Application
  xmlns=http://www.adobe.com/2006/mxml;
  layout=absolute
  
  Script
![CDATA[
  import mx.containers.GridItem;
  import mx.controls.Label;
  import mx.controls.DateField;
  private function addCategoryAS():void
  {
var gi:GridItem;
var gr:GridRow = new GridRow;

gi = new GridItem;
gr.addChild(gi);
gi.addChild(new Label);

addRow(gr);
  }

  private function addCategoryMXML():void
  {
var gr:GridRow = new TestGridRow;
gr.initialize(); // this is just to try to make it equivalent -
doesn't change flicker

addRow(gr);
  }

  private function addRow(gr:GridRow):void
  {
grid.addChildAt(gr, 0);

var gi:GridItem;

gi = gr.getChildAt(0) as GridItem;
(gi.getChildAt(0) as Label).text = item  + grid.numChildren + :;

gr.validateSize(true);
var verticalGap:Number = grid.getStyle(verticalGap);
popup.scrollRect = new Rectangle(0, 0, Math.max(popup.width +
gr.measuredWidth),
popup.height + gr.measuredHeight + (isNaN(verticalGap) ? 0 :
verticalGap));
if (popup.localToGlobal(new Point(0, 0)).y 
popup.owner.localToGlobal(new Point(0, 0)).y)
  popup.y -= gr.measuredHeight + (isNaN(verticalGap) ? 0 :
verticalGap);
  }
]]
  /Script

  Canvas bottom=0
PopUpButton id=myPopupButton openAlways=true
  popUp
Canvas id=popup
  Grid id=grid paddingTop=4 paddingBottom=4 paddingLeft=4
paddingRight=4
fontSize=12 backgroundColor=0xFF borderStyle=outset
borderThickness=2

GridRow
  GridItem
Button label=Add AS click=addCategoryAS()/
Button label=Add MXML click=addCategoryMXML()/
  /GridItem
/GridRow
  /Grid
/Canvas
  /popUp
/PopUpButton
  /Canvas
/Application

TestGridRow.mxml:
?xml version=1.0 encoding=utf-8?
GridRow xmlns=http://www.adobe.com/2006/mxml;
  GridItem
Label/
  /GridItem
/GridRow


I've dug through the generated code and have not been able to find anything
that I think would account for the problem.  This is frustrating, because
what I really want to do is a more complicated MXML component to make it a
lot nicer to add rows in my addCategory function.  But I can't as long as
it's going to be so jittery.

Thanks!

-- 
Jason


Re: [flexcoders] Re: how can I get a popupButton's popUp to resize while popped up?

2009-06-16 Thread Pan Troglodytes
Thanks, Tim.  Knew there must be something, just couldn't find it.

I found this to be a good way to do it, as long as I'm not missing
something:

gr.validateSize(true);
var verticalGap:Number = grid.getStyle(verticalGap);
grid.scrollRect = new Rectangle(0, 0, grid.width + gr.measuredWidth,
grid.height + gr.measuredHeight + (isNaN(verticalGap) ? 0 :
verticalGap));

This seems more right, though if you add some big numbers to height and
width it will always auto-calc them.  But I found if you add numbers that
are too small, you wind up with it chopped off a bit.

On Mon, Jun 15, 2009 at 10:08 PM, Tim Hoff timh...@aol.com wrote:



 Hi Jason,

 Put this at the end of addCategory():

 myPopupButton.popUp.scrollRect =
 *new* Rectangle(0, 0, myPopupButton.popUp.width,
 myPopupButton.popUp.height + 30);

 Add an id:

 PopUpButton id=myPopupButton openAlways=true

 This will trick the popup into redrawing.

 -TH


 --- In flexcoders@yahoogroups.com, Pan Troglodytes chimpathe...@...
 wrote:
 
  Okay, so given the following application:
 
  ?xml version=1.0 encoding=utf-8?
  Application
  xmlns=http://www.adobe.com/2006/mxml;
  
  Script
  ![CDATA[
  private function addCategory():void
  {
  var gi:GridItem;
  var gr:GridRow = new GridRow;
 
  gi = new GridItem;
  (gi.addChild(new Label) as Label).text = item  + (grid.numChildren
  - 3) + :;
  gr.addChild(gi);
 
  gi = new GridItem;
  (gi.addChild(new Label) as Label).text = value;
  gr.addChild(gi);
 
  grid.addChildAt(gr, grid.numChildren - 2);
  }
  ]]
  /Script
  PopUpButton openAlways=true
  popUp
  Grid id=grid paddingTop=4 paddingBottom=4 paddingLeft=4
  paddingRight=4
  fontSize=12 backgroundColor=0xFF borderStyle=outset
  borderThickness=2
  
  GridRow
  GridItem colSpan=3
  CheckBox label=Categorize data fontWeight=bold/
  /GridItem
  /GridRow
  GridRow
  GridItem
  Label text=Start:/
  /GridItem
  GridItem
  Label text=first row/
  /GridItem
  /GridRow
  GridRow id=lastRow
  GridItem
  Label text=End:/
  /GridItem
  GridItem
  Label text=last row/
  /GridItem
  /GridRow
  GridRow
  GridItem colSpan=3
  Button label=Add Category click=addCategory()/
  /GridItem
  /GridRow
  /Grid
  /popUp
  /PopUpButton
  /Application
 
  I want to be able to click the popupButton, click the Add Category
 button,
  and have the popped up window resize right then so you can see
 everything.
  Is there a good way (or even an ok way) to do this?
 
  --
  Jason
 
  




-- 
Jason


Re: [flexcoders] Re: how can I get a popupButton's popUp to resize while popped up?

2009-06-16 Thread Pan Troglodytes
C'mon, Tim, your posts help me loads of times and you don't even realize
it.  My #1 place to go for searching for answers to tough problems is my
flexcoders archive and your name pops up a lot with the answer!  And
RowColorDataGrid was a lifesaver.


Okay, back to the topic.  Just realized that there's a little something
missing.  If you have the popupButton on the bottom of the window so that it
causes the popup to appear ABOVE it, then the code above glitches in that it
makes the window grow down and cover the popupbutton.  Here's a fix:

gr.validateSize(true);
var verticalGap:Number = grid.getStyle(verticalGap);
grid.scrollRect = new Rectangle(0, 0, grid.width + gr.measuredWidth,
grid.height + gr.measuredHeight + (isNaN(verticalGap) ? 0 :
verticalGap));
if (grid.y  myPopupButton.y)
  grid.y -= gr.measuredHeight + (isNaN(verticalGap) ? 0 : verticalGap);

To see this in action in the above example, set the application
layout=absolute and the myPopupButton bottom=0.

Of course, when you add so many categories that it gets taller than the
window its in, then you're screwed!  You'd have to implement your own don't
grow when bigger than this and turn on scrollbars instead logic.  Luckily I
don't need that right now.

On Tue, Jun 16, 2009 at 10:20 AM, Tim Hoff timh...@aol.com wrote:




 Yep, that looks great. I thought about all of that, but knew that you'd
 tweak it to get what you needed. Glad that I could finally help you out
 with something Jason.


 -TH

 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes chimpathe...@...
 wrote:
 
  Thanks, Tim. Knew there must be something, just couldn't find it.
 
  I found this to be a good way to do it, as long as I'm not missing
  something:
 
  gr.validateSize(true);
  var verticalGap:Number = grid.getStyle(verticalGap);
  grid.scrollRect = new Rectangle(0, 0, grid.width + gr.measuredWidth,
  grid.height + gr.measuredHeight + (isNaN(verticalGap) ? 0 :
  verticalGap));
 
  This seems more right, though if you add some big numbers to height
 and
  width it will always auto-calc them. But I found if you add numbers
 that
  are too small, you wind up with it chopped off a bit.
 
  On Mon, Jun 15, 2009 at 10:08 PM, Tim Hoff timh...@... wrote:
 
  
  
   Hi Jason,
  
   Put this at the end of addCategory():
  
   myPopupButton.popUp.scrollRect =
   *new* Rectangle(0, 0, myPopupButton.popUp.width,
   myPopupButton.popUp.height + 30);
  
   Add an id:
  
   PopUpButton id=myPopupButton openAlways=true
  
   This will trick the popup into redrawing.
  
   -TH
  
  
   --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes chimpathetic@
   wrote:
   
Okay, so given the following application:
   
?xml version=1.0 encoding=utf-8?
Application
xmlns=http://www.adobe.com/2006/mxml;

Script
![CDATA[
private function addCategory():void
{
var gi:GridItem;
var gr:GridRow = new GridRow;
   
gi = new GridItem;
(gi.addChild(new Label) as Label).text = item  +
 (grid.numChildren
- 3) + :;
gr.addChild(gi);
   
gi = new GridItem;
(gi.addChild(new Label) as Label).text = value;
gr.addChild(gi);
   
grid.addChildAt(gr, grid.numChildren - 2);
}
]]
/Script
PopUpButton openAlways=true
popUp
Grid id=grid paddingTop=4 paddingBottom=4 paddingLeft=4
paddingRight=4
fontSize=12 backgroundColor=0xFF borderStyle=outset
borderThickness=2

GridRow
GridItem colSpan=3
CheckBox label=Categorize data fontWeight=bold/
/GridItem
/GridRow
GridRow
GridItem
Label text=Start:/
/GridItem
GridItem
Label text=first row/
/GridItem
/GridRow
GridRow id=lastRow
GridItem
Label text=End:/
/GridItem
GridItem
Label text=last row/
/GridItem
/GridRow
GridRow
GridItem colSpan=3
Button label=Add Category click=addCategory()/
/GridItem
/GridRow
/Grid
/popUp
/PopUpButton
/Application
   
I want to be able to click the popupButton, click the Add
 Category
   button,
and have the popped up window resize right then so you can see
   everything.
Is there a good way (or even an ok way) to do this?
   
--
Jason
   
  
  
 
 
 
  --
  Jason
 

  




-- 
Jason


Re: [flexcoders] Re: how can I get a popupButton's popUp to resize while popped up?

2009-06-16 Thread Pan Troglodytes
I should know better by now to never declare victory until you tried your
test app solution in your REAL app.

A problem occured that if your popupbutton is embedded in another control,
the y value will no longer be in the same frame of reference as the popup,
which is no a child of the same control as the popupbutton.  So this may not
be the BEST way to do it, but it works:

gr.validateSize(true);
var verticalGap:Number = grid.getStyle(verticalGap);
grid.scrollRect = new Rectangle(0, 0, grid.width + gr.measuredWidth,
grid.height + gr.measuredHeight + (isNaN(verticalGap) ? 0 :
verticalGap));
if (grid.localToGlobal(new Point(0, 0)).y  grid.owner.localToGlobal(new
Point(0, 0)).y)
  grid.y -= gr.measuredHeight + (isNaN(verticalGap) ? 0 : verticalGap);


On Tue, Jun 16, 2009 at 10:38 AM, Pan Troglodytes chimpathe...@gmail.comwrote:

 C'mon, Tim, your posts help me loads of times and you don't even realize
 it.  My #1 place to go for searching for answers to tough problems is my
 flexcoders archive and your name pops up a lot with the answer!  And
 RowColorDataGrid was a lifesaver.


 Okay, back to the topic.  Just realized that there's a little something
 missing.  If you have the popupButton on the bottom of the window so that it
 causes the popup to appear ABOVE it, then the code above glitches in that it
 makes the window grow down and cover the popupbutton.  Here's a fix:

 gr.validateSize(true);
 var verticalGap:Number = grid.getStyle(verticalGap);
 grid.scrollRect = new Rectangle(0, 0, grid.width + gr.measuredWidth,
 grid.height + gr.measuredHeight + (isNaN(verticalGap) ? 0 :
 verticalGap));
 if (grid.y  myPopupButton.y)
   grid.y -= gr.measuredHeight + (isNaN(verticalGap) ? 0 : verticalGap);

 To see this in action in the above example, set the application
 layout=absolute and the myPopupButton bottom=0.

 Of course, when you add so many categories that it gets taller than the
 window its in, then you're screwed!  You'd have to implement your own don't
 grow when bigger than this and turn on scrollbars instead logic.  Luckily I
 don't need that right now.


 On Tue, Jun 16, 2009 at 10:20 AM, Tim Hoff timh...@aol.com wrote:




 Yep, that looks great. I thought about all of that, but knew that you'd
 tweak it to get what you needed. Glad that I could finally help you out
 with something Jason.


 -TH

 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes chimpathe...@...
 wrote:
 
  Thanks, Tim. Knew there must be something, just couldn't find it.
 
  I found this to be a good way to do it, as long as I'm not missing
  something:
 
  gr.validateSize(true);
  var verticalGap:Number = grid.getStyle(verticalGap);
  grid.scrollRect = new Rectangle(0, 0, grid.width + gr.measuredWidth,
  grid.height + gr.measuredHeight + (isNaN(verticalGap) ? 0 :
  verticalGap));
 
  This seems more right, though if you add some big numbers to height
 and
  width it will always auto-calc them. But I found if you add numbers
 that
  are too small, you wind up with it chopped off a bit.
 
  On Mon, Jun 15, 2009 at 10:08 PM, Tim Hoff timh...@... wrote:
 
  
  
   Hi Jason,
  
   Put this at the end of addCategory():
  
   myPopupButton.popUp.scrollRect =
   *new* Rectangle(0, 0, myPopupButton.popUp.width,
   myPopupButton.popUp.height + 30);
  
   Add an id:
  
   PopUpButton id=myPopupButton openAlways=true
  
   This will trick the popup into redrawing.
  
   -TH
  
  
   --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes chimpathetic@
   wrote:
   
Okay, so given the following application:
   
?xml version=1.0 encoding=utf-8?
Application
xmlns=http://www.adobe.com/2006/mxml;

Script
![CDATA[
private function addCategory():void
{
var gi:GridItem;
var gr:GridRow = new GridRow;
   
gi = new GridItem;
(gi.addChild(new Label) as Label).text = item  +
 (grid.numChildren
- 3) + :;
gr.addChild(gi);
   
gi = new GridItem;
(gi.addChild(new Label) as Label).text = value;
gr.addChild(gi);
   
grid.addChildAt(gr, grid.numChildren - 2);
}
]]
/Script
PopUpButton openAlways=true
popUp
Grid id=grid paddingTop=4 paddingBottom=4 paddingLeft=4
paddingRight=4
fontSize=12 backgroundColor=0xFF borderStyle=outset
borderThickness=2

GridRow
GridItem colSpan=3
CheckBox label=Categorize data fontWeight=bold/
/GridItem
/GridRow
GridRow
GridItem
Label text=Start:/
/GridItem
GridItem
Label text=first row/
/GridItem
/GridRow
GridRow id=lastRow
GridItem
Label text=End:/
/GridItem
GridItem
Label text=last row/
/GridItem
/GridRow
GridRow
GridItem colSpan=3
Button label=Add Category click=addCategory()/
/GridItem
/GridRow
/Grid
/popUp
/PopUpButton
/Application
   
I want to be able to click the popupButton, click the Add
 Category
   button,
and have

Re: [flexcoders] Re: how can I get a popupButton's popUp to resize while popped up?

2009-06-16 Thread Pan Troglodytes
Yet another correction:
grid.scrollRect = new Rectangle(0, 0, Math.max(grid.width,
gr.measuredWidth),
grid.height + gr.measuredHeight + (isNaN(verticalGap) ? 0 :
verticalGap));

Didn't make sense to add the width in this example.

I thought you were referring to the last couple of threads of mine you've
posted on.  :D

But yes, I do remember that old post.  Can't believe it was years ago!
Where does the time go?

Oh, that's right, the bugs in my program eat most of it!


On Tue, Jun 16, 2009 at 11:08 AM, Tim Hoff timh...@aol.com wrote:




 Ha, what I meant is that years ago, you helped me with a problem that I
 was having with RowColorDataGrid and I was also able to use a tree with
 connector lines that you created. Just glad to return the favor. :)


 -TH

 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes chimpathe...@...
 wrote:
 
  C'mon, Tim, your posts help me loads of times and you don't even
 realize
  it. My #1 place to go for searching for answers to tough problems is
 my
  flexcoders archive and your name pops up a lot with the answer! And
  RowColorDataGrid was a lifesaver.
 
 
  Okay, back to the topic. Just realized that there's a little something
  missing. If you have the popupButton on the bottom of the window so
 that it
  causes the popup to appear ABOVE it, then the code above glitches in
 that it
  makes the window grow down and cover the popupbutton. Here's a fix:
 
  gr.validateSize(true);
  var verticalGap:Number = grid.getStyle(verticalGap);
  grid.scrollRect = new Rectangle(0, 0, grid.width + gr.measuredWidth,
  grid.height + gr.measuredHeight + (isNaN(verticalGap) ? 0 :
  verticalGap));
  if (grid.y  myPopupButton.y)
  grid.y -= gr.measuredHeight + (isNaN(verticalGap) ? 0 : verticalGap);
 
  To see this in action in the above example, set the application
  layout=absolute and the myPopupButton bottom=0.
 
  Of course, when you add so many categories that it gets taller than
 the
  window its in, then you're screwed! You'd have to implement your own
 don't
  grow when bigger than this and turn on scrollbars instead logic.
 Luckily I
  don't need that right now.
 
  On Tue, Jun 16, 2009 at 10:20 AM, Tim Hoff timh...@... wrote:
 
  
  
  
   Yep, that looks great. I thought about all of that, but knew that
 you'd
   tweak it to get what you needed. Glad that I could finally help you
 out
   with something Jason.
  
  
   -TH
  
   --- In flexcoders@yahoogroups.com 
   flexcoders%40yahoogroups.comflexcoders%
 40yahoogroups.com,

 Pan
   Troglodytes chimpathetic@
   wrote:
   
Thanks, Tim. Knew there must be something, just couldn't find it.
   
I found this to be a good way to do it, as long as I'm not missing
something:
   
gr.validateSize(true);
var verticalGap:Number = grid.getStyle(verticalGap);
grid.scrollRect = new Rectangle(0, 0, grid.width +
 gr.measuredWidth,
grid.height + gr.measuredHeight + (isNaN(verticalGap) ? 0 :
verticalGap));
   
This seems more right, though if you add some big numbers to
 height
   and
width it will always auto-calc them. But I found if you add
 numbers
   that
are too small, you wind up with it chopped off a bit.
   
On Mon, Jun 15, 2009 at 10:08 PM, Tim Hoff TimHoff@ wrote:
   


 Hi Jason,

 Put this at the end of addCategory():

 myPopupButton.popUp.scrollRect =
 *new* Rectangle(0, 0, myPopupButton.popUp.width,
 myPopupButton.popUp.height + 30);

 Add an id:

 PopUpButton id=myPopupButton openAlways=true

 This will trick the popup into redrawing.

 -TH


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
 flexcoders%40yahoogroups.com, Pan

   Troglodytes chimpathetic@
 wrote:
 
  Okay, so given the following application:
 
  ?xml version=1.0 encoding=utf-8?
  Application
  xmlns=http://www.adobe.com/2006/mxml;
  
  Script
  ![CDATA[
  private function addCategory():void
  {
  var gi:GridItem;
  var gr:GridRow = new GridRow;
 
  gi = new GridItem;
  (gi.addChild(new Label) as Label).text = item  +
   (grid.numChildren
  - 3) + :;
  gr.addChild(gi);
 
  gi = new GridItem;
  (gi.addChild(new Label) as Label).text = value;
  gr.addChild(gi);
 
  grid.addChildAt(gr, grid.numChildren - 2);
  }
  ]]
  /Script
  PopUpButton openAlways=true
  popUp
  Grid id=grid paddingTop=4 paddingBottom=4
 paddingLeft=4
  paddingRight=4
  fontSize=12 backgroundColor=0xFF borderStyle=outset
  borderThickness=2
  
  GridRow
  GridItem colSpan=3
  CheckBox label=Categorize data fontWeight=bold/
  /GridItem
  /GridRow
  GridRow
  GridItem
  Label text=Start:/
  /GridItem
  GridItem
  Label text=first row/
  /GridItem
  /GridRow
  GridRow id=lastRow
  GridItem
  Label text=End

[flexcoders] how can I get a popupButton's popUp to resize while popped up?

2009-06-15 Thread Pan Troglodytes
Okay, so given the following application:

?xml version=1.0 encoding=utf-8?
Application
  xmlns=http://www.adobe.com/2006/mxml;
  
  Script
![CDATA[
  private function addCategory():void
  {
var gi:GridItem;
var gr:GridRow = new GridRow;

gi = new GridItem;
(gi.addChild(new Label) as Label).text = item  + (grid.numChildren
- 3) + :;
gr.addChild(gi);

gi = new GridItem;
(gi.addChild(new Label) as Label).text = value;
gr.addChild(gi);

grid.addChildAt(gr, grid.numChildren - 2);
  }
]]
  /Script
  PopUpButton openAlways=true
popUp
  Grid id=grid paddingTop=4 paddingBottom=4 paddingLeft=4
paddingRight=4
fontSize=12 backgroundColor=0xFF borderStyle=outset
borderThickness=2

GridRow
  GridItem colSpan=3
CheckBox label=Categorize data fontWeight=bold/
  /GridItem
/GridRow
GridRow
  GridItem
Label text=Start:/
  /GridItem
  GridItem
Label text=first row/
  /GridItem
/GridRow
GridRow id=lastRow
  GridItem
Label text=End:/
  /GridItem
  GridItem
Label text=last row/
  /GridItem
/GridRow
GridRow
  GridItem colSpan=3
Button label=Add Category click=addCategory()/
  /GridItem
/GridRow
  /Grid
/popUp
  /PopUpButton
/Application

I want to be able to click the popupButton, click the Add Category button,
and have the popped up window resize right then so you can see everything.
Is there a good way (or even an ok way) to do this?

-- 
Jason


[flexcoders] getting files in additional Source Paths to automatically recompile

2009-06-11 Thread Pan Troglodytes
I have a couple of external folders listed in my project's Flex Build
Path-Source Path section.  These folders are outside of my project
hierarchy and contain some common  files I share between several different
projects.

When I'm in my project and ctrl-click on an object in these files, it opens
the file properly.  But if I make changes and hit save, it doesn't recompile
my project to include those changes.  If I make changes in the project and
it rebuilds, it still doesn't get the changes in that external file.  Only
when I do a Project-Clean does it recompile those external files in.

Is there some better way of setting it up so that it will be more
intelligent about figuring out it needs to recompile those files on changes?

-- 
Jason


Re: [flexcoders] Re: how to fix poor performance in this example (AdvancedDataGrid and Binding)

2009-06-10 Thread Pan Troglodytes
This seems like probably the best option.  I suspected that it was something
to do with properties changing causing excessive refresh, but the fact that
Alex didn't point that out as the problem kind of threw me off track.

It appears that the highlight is set in drawItem, so I subclassed ADG and
overrode it, setting the highlight property.  I added a bit to the highlight
to make sure the event only gets fired if the value actually changes.

As to your question of using selectedItem, the problem is twofold.  First,
the problem is that the grid doesn't provide any property for
highlightedItem.  Yes, as Tim said I could subclass and create one (much
like I did above).  But the secondary problem is that I want several bits of
code that aren't interconnected to do something when a given item in the
data list is active.  I don't want these different bits of the code to
have to know about controls and grids.  I just want them to see a data
element changing and respond to it.  Secondly, this is complicated by the
fact that I can lock some elements into the active state.  So I might have
item 2, 4 and 8 locked on and be mousing over item 5.  The other component
will show items 2, 4, 5 and 8 all active.

By the way, Tim, I had composed this as a response to your suggestions but
not go around to sending it to you yet:
Well, the problem with that and with your example is that they rely on the
itemRenderers to do the management of the highlighted variable.  That was a
tangent I got on to show that it wasn't just the fact that it runs through
an ArrayCollection that was breaking it.  The problem with the itemRenderers
managing it is that there is dead space between item renderers (i.e.
padding) that the renderers never see.

Thanks everyone for your input on the problem!


On Tue, Jun 9, 2009 at 6:12 PM, Paul Williams p_m_willi...@yahoo.co.ukwrote:



 When you set the highlighted property on your items, they are
 dispatching PropertyChangeEvents. The collection they are in will
 receive these PropertyChangeEvents and dispatch CollectionChangeEvents.
 The AdvancedDataGrid will receive these and perform a visual update,
 which appears to clear the rollover highlight.

 To prevent the rollover highlight clearing you need to avoid dispatching
 PropertyChangeEvents when you update the hightlighted property. Which
 means you need to use a custom event in your binding (see below). This
 should fix the choppiness without breaking the binding, although you
 might want to rethink this whole approach: When you select an item in a
 datagrid it sets the selectedItem property; it doesn't update the
 underlying data items. Why not follow this pattern for tracking which
 item is rolled over?

 package
 {
 import flash.events.EventDispatcher;

 public class TestObject extends EventDispatcher

 {
 [Bindable]
 public var label:String;

 private var _highlighted:Boolean;

 public function get highlighted() : Boolean
 {
 return _highlighted;
 }

 [Bindable( event = highlightedChange )]
 public function set highlighted( highlighted : Boolean ) : void
 {
 _highlighted = highlighted;
 dispatchEvent( new Event( highlightedChange ) );
 }
 }
 }

 Pan Troglodytes wrote:
  1) Yes, this works fine, for the display portion only. It doesn't address
  the actual problem of needing to set a flag in the data that indicates it
 is
  the currently highlighted one, that flag being also used by other things
  that bind to the data that don't want to know about UI details like the
  grid. In this case, I had a number of chart listeners that would toggle
  series on/off depending on which one was highlighted in the grid.
 
  2) There is no commitProperties on AdvancedDataGridItemRenderer. Perhaps
  you meant validateProperties. In this example, it gets called only when
 the
  grid is first displayed and not when any item is
 highlighted/de-highlighted
  or selected/de-selected.
 
  3) Yes, the styleFunction does get called when the highlighted object
  changes. But if you move the code to set data.highlighted there, you get
  the same result! It just seems like anything that changes this bound
  variable on every repaint of the cell is doomed to break the rollover
  highlight.
 
  On Tue, Jun 9, 2009 at 11:49 AM, Amy 
  amyblankens...@bellsouth.netamyblankenship%40bellsouth.net
 wrote:
 
 
  --- In flexcoders@yahoogroups.com 
  flexcoders%40yahoogroups.comflexcoders%
 40yahoogroups.com, Pan
  Troglodytes chimpathe...@... wrote:
 
  That was a good idea and it does get rid of the arraycollection
 walking.
  But I get the SAME problem with the grid losing highlighting when I did
 
  it
 
  using AdvancedGridItemRenderer, thought the symptoms are slightly
 
  different:
 
  Personally, I'd do one of two things:
 
  1) Just look to see if the current item is the highlighted item in the
  styleFunction
 
  -or-
 
  2) Override commitProperties instead of validateNow().
 
  I'd also be tempted to investigate whether the styleFunction gets called
  when

Re: [flexcoders] Re: how to fix poor performance in this example (AdvancedDataGrid and Binding)

2009-06-10 Thread Pan Troglodytes
Yes, a mushroom indeed - well put!  By the way, I found your posts about
your fun with the various ADG item renderers quite informative.  Though you
did leave me wishing for some source code of the working examples.

The problem here is that this data serves to link up different parts of the
UI.  It's so that many different pieces can look in one place and hook to
one set of variables.  It also serves as abstraction.  I have a chart that I
can instantiate any number of copies of (with different views of the data,
etc.)  I don't want this chart to have to have knowledge of this one fixed
grid.  The grid is also reused in a couple of different ways, so i don't
want the grid to be hardcoded to the chart.

It's the perils of abstraction and modularization.


On Wed, Jun 10, 2009 at 4:12 PM, Amy amyblankens...@bellsouth.net wrote:



 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes chimpathe...@... wrote:
 
  1) Yes, this works fine, for the display portion only. It doesn't address
  the actual problem of needing to set a flag in the data that indicates it
 is
  the currently highlighted one, that flag being also used by other things
  that bind to the data that don't want to know about UI details like the
  grid. In this case, I had a number of chart listeners that would toggle
  series on/off depending on which one was highlighted in the grid.

 It seems to me that you'd be better off having a variable at the controller
 level that contains the item that was the last item associated with an
 itemRollOver event.

  2) There is no commitProperties on AdvancedDataGridItemRenderer. Perhaps
  you meant validateProperties. In this example, it gets called only when
 the
  grid is first displayed and not when any item is
 highlighted/de-highlighted
  or selected/de-selected.

 Yes, I think that's a nasty little component because it has the
 functionality of a mushroom. I typically use a modified
 AdvancedDataGridGroupItemRenderer to render all columns.

  3) Yes, the styleFunction does get called when the highlighted object
  changes. But if you move the code to set data.highlighted there, you get
  the same result! It just seems like anything that changes this bound
  variable on every repaint of the cell is doomed to break the rollover
  highlight.

 I wouldn't be trying to change the data itself in respons to a ui change,
 since it's almost inevitably going to trigger another ui change.

 HTH;

 Amy

  




-- 
Jason


Re: [flexcoders] Re: how to fix poor performance in this example (AdvancedDataGrid and Binding)

2009-06-10 Thread Pan Troglodytes
I think you missed the part above where I said more than one item could be
activated.  Some items can be locked on, and it also includes the currently
selectedItem (which can be different than the one being moused over).  The
examples were dumbed down so people could easily figure out where I was
seeing the problem.

On Wed, Jun 10, 2009 at 6:54 PM, Amy amyblankens...@bellsouth.net wrote:



 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes chimpathe...@... wrote:
 
  Yes, a mushroom indeed - well put! By the way, I found your posts about
  your fun with the various ADG item renderers quite informative. Though
 you
  did leave me wishing for some source code of the working examples.
 
  The problem here is that this data serves to link up different parts of
 the
  UI. It's so that many different pieces can look in one place and hook to
  one set of variables. It also serves as abstraction. I have a chart that
 I
  can instantiate any number of copies of (with different views of the
 data,
  etc.) I don't want this chart to have to have knowledge of this one fixed
  grid. The grid is also reused in a couple of different ways, so i don't
  want the grid to be hardcoded to the chart.
 
  It's the perils of abstraction and modularization.

 If you had one variable containing _just_ the highlighed item at the
 controller level, that would actually be even more abstracted and reusable
 than tying everything to the entire collection and forcing things to look at
 a property on one item of the collection. Also more efficient.

  




-- 
Jason


[flexcoders] how can you make the icon in an AdvancedDataGridGroupItemRenderer accept clicks?

2009-06-09 Thread Pan Troglodytes
I've got a bit of a problem and haven't been able to figure it out.  When
using hierarchical views with ADG, I find that the icon can't be clicked on
to select the row.  I can't figure out how to capture a click on the icon at
all.

?xml version=1.0 encoding=utf-8?
Application
  xmlns=http://www.adobe.com/2006/mxml;
  
  Script
![CDATA[
  // put any icon you want in the embed below, doesn't matter
  [Bindable] [Embed(source=imageA.png)] private var imgClass:Class;

  private function geticon(item:Object):Class
  {
return imgClass;
  }
]]
  /Script
  AdvancedDataGrid iconFunction=geticon itemClick=trace('itemclick')
click=trace('gridclick')
dataProvider
  HierarchicalData childrenField=subitems source={[{label:'test'},
{label:'test2'}]}/
/dataProvider
columns
  AdvancedDataGridColumn dataField=label/
 /columns
  /AdvancedDataGrid
/Application

If you click anywhere but the icon, the gridclick and itemclick events both
fire.  But if you click on the icon, you get only the gridclick.  And the
gridclick event doesn't get anything useful for target/currentTarget, as far
as I can tell.

The main thing I really want to do is have clicking on the icon select the
row, just like clicking anywhere else will do.  Tangentially, it would be
nice to know how to capture the event in case I wanted to do something
different with clicking on the icon.

-- 
Jason


Re: [flexcoders] Re: how to fix poor performance in this example (AdvancedDataGrid and Binding)

2009-06-09 Thread Pan Troglodytes
1) Yes, this works fine, for the display portion only.  It doesn't address
the actual problem of needing to set a flag in the data that indicates it is
the currently highlighted one, that flag being also used by other things
that bind to the data that don't want to know about UI details like the
grid.  In this case, I had a number of chart listeners that would toggle
series on/off depending on which one was highlighted in the grid.

2) There is no commitProperties on AdvancedDataGridItemRenderer.  Perhaps
you meant validateProperties.  In this example, it gets called only when the
grid is first displayed and not when any item is highlighted/de-highlighted
or selected/de-selected.

3) Yes, the styleFunction does get called when the highlighted object
changes.  But if you move the code to set data.highlighted there, you get
the same result!  It just seems like anything that changes this bound
variable on every repaint of the cell is doomed to break the rollover
highlight.

On Tue, Jun 9, 2009 at 11:49 AM, Amy amyblankens...@bellsouth.net wrote:



 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes chimpathe...@... wrote:
 
  That was a good idea and it does get rid of the arraycollection walking.
  But I get the SAME problem with the grid losing highlighting when I did
 it
  using AdvancedGridItemRenderer, thought the symptoms are slightly
 different:

 Personally, I'd do one of two things:

 1) Just look to see if the current item is the highlighted item in the
 styleFunction

 -or-

 2) Override commitProperties instead of validateNow().

 I'd also be tempted to investigate whether the styleFunction gets called
 when the highlighted object changes.

 HTH;

 Amy

  




-- 
Jason


Re: [flexcoders] Re: how to fix poor performance in this example (AdvancedDataGrid and Binding)

2009-06-08 Thread Pan Troglodytes
That was a good idea and it does get rid of the arraycollection walking.
But I get the SAME problem with the grid losing highlighting when I did it
using AdvancedGridItemRenderer, thought the symptoms are slightly different:

?xml version=1.0 encoding=utf-8?
Application
  xmlns=http://www.adobe.com/2006/mxml;
  creationComplete=cc()
  layout=horizontal
  
  Script
![CDATA[
  import mx.events.ListEvent;
  import mx.collections.ArrayCollection;
  [Bindable] public var d:ArrayCollection = new ArrayCollection([]);

  private const ITEM_COUNT:int = 15;

  private function cc():void
  {
for (var i:int = 0; i  ITEM_COUNT; i++)
{
  var item:TestObject = new TestObject;
  item.label = Item  + i;
  d.addItem(item);
}
  }

  private function getColStyle(data:Object,
column:AdvancedDataGridColumn):Object
  {
return { fontWeight:(data.highlighted ? bold : normal) }
  }

]]
  /Script
  AdvancedDataGrid id=list dataProvider={d} height=100%
columns
  AdvancedDataGridColumn styleFunction=getColStyle dataField=label
itemRenderer
  Component
AdvancedDataGridItemRenderer
  Script
![CDATA[
  import mx.controls.AdvancedDataGrid;
  override public function validateNow():void
  {
var adg:AdvancedDataGrid = owner as AdvancedDataGrid;
if (data  adg)
  data.highlighted = adg.isItemHighlighted(data);

super.validateNow();
  }
]]
  /Script
/AdvancedDataGridItemRenderer
  /Component
/itemRenderer
  /AdvancedDataGridColumn
/columns
  /AdvancedDataGrid
/Application


In this example, I don't loop through the dataprovider but instead only
affect the itemRenderer being redrawn.  Yet if you try this example with
highlighted being a [Bindable] variable, it breaks, not just failing to show
the highlighted item in bold but also breaking the grid's blue highlight.
Comment out the [Bindable] part in TestObject, and it works just fine.

I'm hoping Alex is still following along.

I'm trying to get my itemRenderers in a big complicated grid as lean as
possible, as per Alex's suggestions on his blog.  The highlighted data is
also being used in a couple of different places that are abstracted a bit,
otherwise I'd hardcode something a bit more kludgy.


On Fri, Jun 5, 2009 at 2:41 PM, Tim Hoff timh...@aol.com wrote:



 Hi Jason,

 Have you tried it from within the itemRenderer?  Something like:
 *

 private
 * *var* adg : AdvancedDataGrid;

 *override* *public* *function* *set* data(value:Object):*void*
 {
 * super*.data = value;

  adg = owner *as* AdvancedDataGrid;
 }

 *override* *protected* *function* updateDisplayList( w:Number, h:Number ):
 *void
 *{
 * super*.updateDisplayList( w, h );

  data.highlighted = adg.isItemHighlighted(data);
 }

 Not sure if this will work for your purposes, but it's worth a shot.

 -TH


 --- In flexcoders@yahoogroups.com, Pan Troglodytes chimpathe...@...
 wrote:
 
  Yes. A gigantic 15 items. ;) I wouldn't have thought going through a list
  of 15 items would be quite so processor intensive.
 
  Though even if it's just 5 items and I use Array instead of
 ArrayCollection,
  it's still choppy.
 
  The problem isn't so much that it's scanning through the entire
 collection,
  as if you change item.highlighted = list.isItemHighlighted(item) to 
  trace('here');, the choppiness disappears.
 
  So, the problem is that it's setting this bound variable highlighted 15
  times (or even just 5) for each item as it rolls over them. And the
 strange
  thing is that the data all gets set behind the scenes. What happens that
  the grid cells don't get repainted properly. If you actually play with
 the
  program a little, dragging your mouse around a bit, you'll see what I'm
  talking about. Here's a video that might be helpful:
 
  http://www.youtube.com/watch?v=7LQFlQtiHsc
 
  So it seems odd to me that the data is getting updated but the grid is
  losing track of the ability to highlight.
 
  You know what's really interesting? Change the style function this:
  private function getColStyle(data:Object,
  column:AdvancedDataGridColumn):Object
  {
  return { fontWeight:(data.highlighted ? bold : normal) }
  }
 
  Now you'll see that the bolding tracks perfectly! The reason it failed
  before was the same reason the blue mouseover highlight was failing.
  Internally, the grid is losing the ability to highlight.
 
  On Thu, Jun 4, 2009 at 11:28 PM, Alex Harui aha...@... wrote:
 
  
  
   The rollover handler is scanning the entire arraycollection.
  
  
  
   Alex Harui
  
   Flex SDK Developer
  
   Adobe Systems Inc. http://www.adobe.com/

  
   Blog: http://blogs.adobe.com/aharui
  
  
  
   *From:* flexcoders@yahoogroups.com [mailto:flexcod

Re: [flexcoders] Re: how to fix poor performance in this example (AdvancedDataGrid and Binding)

2009-06-08 Thread Pan Troglodytes
Oh yeah, another thing I should point out is that in the real grid, I have
multiple columns.  As such, a solution that relies on the itemRenderer might
be problematic due to gaps between items and such.  I would just use the
itemRollOver and itemRollOut to do it all, but rollOut doesn't get reliably
called for every highlighted row when the highlight leaves it.

On Mon, Jun 8, 2009 at 3:46 PM, Pan Troglodytes chimpathe...@gmail.comwrote:

 That was a good idea and it does get rid of the arraycollection walking.
 But I get the SAME problem with the grid losing highlighting when I did it
 using AdvancedGridItemRenderer, thought the symptoms are slightly different:

 ?xml version=1.0 encoding=utf-8?
 Application
   xmlns=http://www.adobe.com/2006/mxml;
   creationComplete=cc()
   layout=horizontal
   
   Script
 ![CDATA[
   import mx.events.ListEvent;
   import mx.collections.ArrayCollection;
   [Bindable] public var d:ArrayCollection = new ArrayCollection([]);

   private const ITEM_COUNT:int = 15;

   private function cc():void
   {
 for (var i:int = 0; i  ITEM_COUNT; i++)
 {
   var item:TestObject = new TestObject;
   item.label = Item  + i;
   d.addItem(item);
 }
   }

   private function getColStyle(data:Object,
 column:AdvancedDataGridColumn):Object
   {
 return { fontWeight:(data.highlighted ? bold : normal) }
   }

 ]]
   /Script
   AdvancedDataGrid id=list dataProvider={d} height=100%
 columns
   AdvancedDataGridColumn styleFunction=getColStyle
 dataField=label
 itemRenderer
   Component
 AdvancedDataGridItemRenderer
   Script
 ![CDATA[
   import mx.controls.AdvancedDataGrid;
   override public function validateNow():void
   {
 var adg:AdvancedDataGrid = owner as AdvancedDataGrid;
 if (data  adg)
   data.highlighted = adg.isItemHighlighted(data);

 super.validateNow();
   }
 ]]
   /Script
 /AdvancedDataGridItemRenderer
   /Component
 /itemRenderer
   /AdvancedDataGridColumn
 /columns
   /AdvancedDataGrid
 /Application


 In this example, I don't loop through the dataprovider but instead only
 affect the itemRenderer being redrawn.  Yet if you try this example with
 highlighted being a [Bindable] variable, it breaks, not just failing to
 show the highlighted item in bold but also breaking the grid's blue
 highlight.  Comment out the [Bindable] part in TestObject, and it works
 just fine.

 I'm hoping Alex is still following along.

 I'm trying to get my itemRenderers in a big complicated grid as lean as
 possible, as per Alex's suggestions on his blog.  The highlighted data is
 also being used in a couple of different places that are abstracted a bit,
 otherwise I'd hardcode something a bit more kludgy.



 On Fri, Jun 5, 2009 at 2:41 PM, Tim Hoff timh...@aol.com wrote:



 Hi Jason,

 Have you tried it from within the itemRenderer?  Something like:
 *

 private
 * *var* adg : AdvancedDataGrid;

 *override* *public* *function* *set* data(value:Object):*void*
 {
 * super*.data = value;

  adg = owner *as* AdvancedDataGrid;
 }

 *override* *protected* *function* updateDisplayList( w:Number, h:Number
 ):*void
 *{
 * super*.updateDisplayList( w, h );

  data.highlighted = adg.isItemHighlighted(data);
 }

 Not sure if this will work for your purposes, but it's worth a shot.

 -TH


 --- In flexcoders@yahoogroups.com, Pan Troglodytes chimpathe...@...
 wrote:
 
  Yes. A gigantic 15 items. ;) I wouldn't have thought going through a
 list
  of 15 items would be quite so processor intensive.
 
  Though even if it's just 5 items and I use Array instead of
 ArrayCollection,
  it's still choppy.
 
  The problem isn't so much that it's scanning through the entire
 collection,
  as if you change item.highlighted = list.isItemHighlighted(item) to 
  trace('here');, the choppiness disappears.
 
  So, the problem is that it's setting this bound variable highlighted 15
  times (or even just 5) for each item as it rolls over them. And the
 strange
  thing is that the data all gets set behind the scenes. What happens that
  the grid cells don't get repainted properly. If you actually play with
 the
  program a little, dragging your mouse around a bit, you'll see what I'm
  talking about. Here's a video that might be helpful:
 
  http://www.youtube.com/watch?v=7LQFlQtiHsc
 
  So it seems odd to me that the data is getting updated but the grid is
  losing track of the ability to highlight.
 
  You know what's really interesting? Change the style function this:
  private function getColStyle(data:Object,
  column:AdvancedDataGridColumn):Object
  {
  return { fontWeight:(data.highlighted ? bold : normal) }
  }
 
  Now you'll see

Re: [flexcoders] how to fix poor performance in this example (AdvancedDataGrid and Binding)

2009-06-05 Thread Pan Troglodytes
Yes.  A gigantic 15 items.  ;)  I wouldn't have thought going through a list
of 15 items would be quite so processor intensive.

Though even if it's just 5 items and I use Array instead of ArrayCollection,
it's still choppy.

The problem isn't so much that it's scanning through the entire collection,
as if you change item.highlighted = list.isItemHighlighted(item) to 
trace('here');, the choppiness disappears.

So, the problem is that it's setting this bound variable highlighted 15
times (or even just 5) for each item as it rolls over them.  And the strange
thing is that the data all gets set behind the scenes.  What happens that
the grid cells don't get repainted properly.  If you actually play with the
program a little, dragging your mouse around a bit, you'll see what I'm
talking about.  Here's a video that might be helpful:

http://www.youtube.com/watch?v=7LQFlQtiHsc

So it seems odd to me that the data is getting updated but the grid is
losing track of the ability to highlight.

You know what's really interesting?  Change the style function this:
private function getColStyle(data:Object,
column:AdvancedDataGridColumn):Object
{
  return { fontWeight:(data.highlighted ? bold : normal) }
}

Now you'll see that the bolding tracks perfectly!  The reason it failed
before was the same reason the blue mouseover highlight was failing.
Internally, the grid is losing the ability to highlight.

On Thu, Jun 4, 2009 at 11:28 PM, Alex Harui aha...@adobe.com wrote:



  The rollover handler is scanning the entire arraycollection.



 Alex Harui

 Flex SDK Developer

 Adobe Systems Inc. http://www.adobe.com/

 Blog: http://blogs.adobe.com/aharui



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *Pan Troglodytes
 *Sent:* Thursday, June 04, 2009 12:00 PM
 *To:* flexcoders
 *Subject:* [flexcoders] how to fix poor performance in this example
 (AdvancedDataGrid and Binding)






  I have the following example that is a very simplified form of what I
 need to do in my much larger program.  The goal is to have a mouseover on a
 grid item set a variable in the data object.  In the real program, this
 fires off some other code which makes that item visible and the others
 hidden, etc.  But here, I'm just trying the first part.

 *TestObject.as:*
 package
 {
   public class TestObject
   {
 [Bindable] public var label:String;
 [Bindable] public var highlighted:Boolean;
   }
 }

 *GenericTest.mxml:
 *?xml version=1.0 encoding=utf-8?
 Application
   xmlns=http://www.adobe.com/2006/mxml;
   creationComplete=cc()
   layout=horizontal
   
   Script
 ![CDATA[
   import mx.events.ListEvent;
   import mx.collections.ArrayCollection;
   [Bindable] public var d:ArrayCollection = new ArrayCollection([]);

   private const ITEM_COUNT:int = 15;

   private function cc():void
   {
 for (var i:int = 0; i  ITEM_COUNT; i++)
 {
   var item:TestObject = new TestObject;
   item.label = Item  + i;
   d.addItem(item);
 }
   }

   private function listRollover(e:ListEvent):void
   {
 for each (var item:TestObject in d)
   item.highlighted = list.isItemHighlighted(item);
   }

   private function getColStyle(data:Object,
 column:AdvancedDataGridColumn):Object
   {
 return { fontWeight:(list.isItemHighlighted(data) ? bold :
 normal) }
   }

   private function getColStyle2(data:Object,
 column:AdvancedDataGridColumn):Object
   {
 return { fontWeight:(list2.isItemHighlighted(data) ? bold :
 normal) }
   }

 ]]
   /Script
   AdvancedDataGrid id=list dataProvider={d} height=100%
 itemRollOver=listRollover(event)
 columns
   AdvancedDataGridColumn styleFunction=getColStyle
 dataField=label/
 /columns
   /AdvancedDataGrid
   AdvancedDataGrid id=list2 dataProvider={d} height=100%
 columns
   AdvancedDataGridColumn styleFunction=getColStyle2
 dataField=label/
 /columns
   /AdvancedDataGrid
 /Application

 To see the problem, run your mouse up and down the list on the left and the
 list on the right.  If you get the same results I do with SDK 3.0.2 and
 player 10,0,12,36 (FF 3.0.6 or IE 7), you'll see that the list on the right
 tracks very smoothly but the one on the left is choppy.  The only difference
 between the two is that the one on the left has a rollOver handler that sets
 a Bindable variable in the data object.

 If you comment out the [Bindable] on TestObject's highlighted variable, the
 choppiness goes away.  So it's something to do with all the binding glue
 being fired behind the scenes.  Is there some good way to work around this
 while still being able to use binding in this way?

 --
 Jason

   




-- 
Jason


[flexcoders] how to fix poor performance in this example (AdvancedDataGrid and Binding)

2009-06-04 Thread Pan Troglodytes
I have the following example that is a very simplified form of what I need
to do in my much larger program.  The goal is to have a mouseover on a grid
item set a variable in the data object.  In the real program, this fires off
some other code which makes that item visible and the others hidden, etc.
But here, I'm just trying the first part.

*TestObject.as:*
package
{
  public class TestObject
  {
[Bindable] public var label:String;
[Bindable] public var highlighted:Boolean;
  }
}

*GenericTest.mxml:
*?xml version=1.0 encoding=utf-8?
Application
  xmlns=http://www.adobe.com/2006/mxml;
  creationComplete=cc()
  layout=horizontal
  
  Script
![CDATA[
  import mx.events.ListEvent;
  import mx.collections.ArrayCollection;
  [Bindable] public var d:ArrayCollection = new ArrayCollection([]);

  private const ITEM_COUNT:int = 15;

  private function cc():void
  {
for (var i:int = 0; i  ITEM_COUNT; i++)
{
  var item:TestObject = new TestObject;
  item.label = Item  + i;
  d.addItem(item);
}
  }

  private function listRollover(e:ListEvent):void
  {
for each (var item:TestObject in d)
  item.highlighted = list.isItemHighlighted(item);
  }

  private function getColStyle(data:Object,
column:AdvancedDataGridColumn):Object
  {
return { fontWeight:(list.isItemHighlighted(data) ? bold :
normal) }
  }

  private function getColStyle2(data:Object,
column:AdvancedDataGridColumn):Object
  {
return { fontWeight:(list2.isItemHighlighted(data) ? bold :
normal) }
  }

]]
  /Script
  AdvancedDataGrid id=list dataProvider={d} height=100%
itemRollOver=listRollover(event)
columns
  AdvancedDataGridColumn styleFunction=getColStyle
dataField=label/
/columns
  /AdvancedDataGrid
  AdvancedDataGrid id=list2 dataProvider={d} height=100%
columns
  AdvancedDataGridColumn styleFunction=getColStyle2
dataField=label/
/columns
  /AdvancedDataGrid
/Application

To see the problem, run your mouse up and down the list on the left and the
list on the right.  If you get the same results I do with SDK 3.0.2 and
player 10,0,12,36 (FF 3.0.6 or IE 7), you'll see that the list on the right
tracks very smoothly but the one on the left is choppy.  The only difference
between the two is that the one on the left has a rollOver handler that sets
a Bindable variable in the data object.

If you comment out the [Bindable] on TestObject's highlighted variable, the
choppiness goes away.  So it's something to do with all the binding glue
being fired behind the scenes.  Is there some good way to work around this
while still being able to use binding in this way?

-- 
Jason


Re: [flexcoders] Re: using as breaks data binding?

2009-05-13 Thread Pan Troglodytes
I'm not sure I fully understand what you mean, Alex.  In my button click
code, I modify the properties.  Could you clarify that?  Do you also mind
jotting in a comment on the but reports I entered to just confirm that you
were able to reproduce it in 4.0?

Does this mean as should be avoided and only used in cases where the
ClassName() syntax will wind up doing more than just type coercion (like
Array) for now?

Thanks.

On Wed, May 13, 2009 at 1:24 AM, Alex Harui aha...@adobe.com wrote:



  I was able to repro in 4.0 beta builds.  It looks like the parser simply
 can’t handle the “as” syntax.  That means that it the binding may not
 respond to changes to some kinds of changes because it isn’t watching the
 right events.  It might work for these purposes as in a renderer the entire
 data object changes, but if you found a way to just modify the one property
 it probably won’t pick that up.



 Alex Harui

 Flex SDK Developer

 Adobe Systems Inc. http://www.adobe.com/

 Blog: http://blogs.adobe.com/aharui



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *valdhor
 *Sent:* Tuesday, May 12, 2009 1:42 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] Re: using as breaks data binding?






  I think I may have an answer. I broke down the code into its constituent
 pieces and I now have a theory.

 My theory:
 When you use (data as TestObject).b, you are actually trying to bind to the
 data property of the item renderer. As this is not a bindable property, you
 get the error. When you use the cast: TestObject(data).a, you are now
 binding to TestObject which does have bindable properties.

 Have a look at the following code...

 TestObject.as
 package
 {
   public class TestObject
   {
 [Bindable] public var item1:uint = 2;
 [Bindable] public var item2:uint = 3;
 [Bindable] public var item3:uint = 1;
   }
 }

 HBoxItemRenderer.as
 ?xml version=1.0 encoding=utf-8?
 mx:HBox xmlns:mx=http://www.adobe.com/2006/mxml;
 mx:Script
 ! nbsp;   ![CDATA[

 [Bindable] private var theTestObject:TestObject;

 override public function set data(value:Object):void
 {
 super.data = value;
 if(value != null)
 {
 theTestObject = data as TestObject;
 }
 }
 ]]/mx:Script
! mx: Label text={theTestObject.item1}/
 mx:Label text={theTestObject.item2}/
 mx:Label text={theTestObject.item3}/
 /mx:HBox

 DataBindingTest.mxml
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 layout=absolute
   mx:Script
 ![CDATA[
   import mx.collections.ArrayCollection;

   [Bindable] private var d:ArrayCollection = new ArrayCollection([
 new TestObject,
 new TestObject,
 new TestObject
   ]);
 ]]
   /mx:Script
   mx:List dataProvider={d}!  itemRenderer=HBoxItemRenderer /
   mx:Button click=for each(var o:TestObject in d) { o.item1++; o.item2++;
 o.item3++ }/
 /mx:Application


 If anyone thinks my theory is incorrect, please chime in.


 HTH



 Steve


 --- In flexcoders@yahoogroups.com, Pan Troglodytes chimpathe...@...
 wrote:
 
  Well, I entered the two related issues as:
 
  https://bugs.adobe.com/jira/browse/SDK-21100
  https://bugs.adobe.com/jira/browse/SDK-21101
 
  Maybe someone at Adobe can manage to reproduce them. I'm not really sure
  how much harm is being done, since the code appears to work right in the
  end. But someone weird and unexpected seems to be going on under the
 hood.
 
 
  On Tue, May 12, 2009 at 2:39 PM, Pan Troglodytes chimpathe...@...wrote:
 
 ! ;  Thanks for giving me some confirmation. Now if we coul! d just f
 igure out
   what Alex/Adobe need to do to replicate our tests.
  
   The reason it doesn't give a warning on y is due to what I referenced
   (perhaps unclearly) above. Notice in the warning it tells you it can't
 bind
   to that value on the *itemRenderer *(GenericTest_inlineComponent1 in my
   test), not on the *TestObject* instance. The itemRenderer has an x and
 y
   object, so that's why it doesn't complain. It doesn't make any sense
 that
   it should be looking at binding to the itemRenderer instead of the
   TestObject instance, though.
  
  
   On Tue, May 12, 2009 at 12:24 PM, valdhor valdhorli...@...wrote:
  
  
  
   Jason
  
   As a sanity check I tried it and I get the exact same error. I am
 using
   Flex SDK 3.3.0 and Flash Player WIN 9,! 0,159,0 Debug.
  
   Strangely enough, changing b to y fixes it and the error goes away.
 Other
   variable identifiers I have tried (Very small sample) gives the error
 as
   well.
  
   It's got me beat.
  
   Why would the posted code give an error at all?
  
   Why would y work and everything else not?
  
  
   --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
   Troglodytes chimpathetic@ wrote:
   
I wonder if I wasn't clear enough

Re: [flexcoders] using as breaks data binding?

2009-05-12 Thread Pan Troglodytes
I wonder if I wasn't clear enough on this - these are run-time warnings that
output to the console.  You don't get those?


On Mon, May 11, 2009 at 5:27 PM, Alex Harui aha...@adobe.com wrote:



  I didn’t get any warnings like you did so I couldn’t investigate further.



 Alex Harui

 Flex SDK Developer

 Adobe Systems Inc. http://www.adobe.com/

 Blog: http://blogs.adobe.com/aharui



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *Pan Troglodytes
 *Sent:* Saturday, May 09, 2009 10:38 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* Re: [flexcoders] using as breaks data binding?






  3.3.0.  I also get it with 4.0.0.6137.  Just downloaded and got it in
 6772, too.  I'm using player version 10,0,12,36.  Do you need to know
 anything about my Flex Builder version?  Let me know anything else I can
 provide.

 When you say you don't get it with the soon-to-be 3.4, what exactly do you
 mean?  You just don't get the run-time warning?  Did you track down why it
 would be okay with x and see if that's still doing whatever weird thing it
 is in 3.4?

  On Sat, May 9, 2009 at 4:11 PM, Alex Harui aha...@adobe.com wrote:



 Which version of Flex?  I don’t get it on the latest builds that will ship
 as 3.4



 Alex Harui

 Flex SDK Developer

 Adobe Systems Inc. http://www.adobe.com/

 Blog: http://blogs.adobe.com/aharui



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *Pan Troglodytes
 *Sent:* Friday, May 08, 2009 11:06 PM
 *To:* flexcoders
 *Subject:* [flexcoders] using as breaks data binding?





  I've run across some peculiar behavior and I am trying to figure out if I
 should report it and if so, how exactly to explain it.  Given these two bits
 of code:

 *TestObject.as:*
 package
 {
   public class TestObject
   {
 [Bindable] public var a:uint = 2;
 [Bindable] public var b:uint = 3;
 [Bindable] public var x:uint = 1;
   }
 }

 *Main Application:*
 ?xml version=1.0 encoding=utf-8?
 Application
   xmlns=http://www.adobe.com/2006/mxml;
   
   Script
 ![CDATA[
   import mx.collections.ArrayCollection;
   [Bindable] public var d:ArrayCollection = new ArrayCollection([
 new TestObject,
 new TestObject,
 new TestObject
   ]);
 ]]
   /Script
   List dataProvider={d}
 itemRenderer
   Component
 HBox
   Label text={TestObject(data).a}/
   Label text={(data as TestObject).b}/
   Label text={(data as TestObject).x}/
 /HBox
   /Component
 /itemRenderer
   /List
   Button click=for each (var o:TestObject in d) { o.x++; o.a++; o.b++
 }/
 /Application

 If you run this application, you get the following warnings:
 warning: unable to bind to property 'b' on class
 'GenericTest_inlineComponent1'
 warning: unable to bind to property 'b' on class
 'GenericTest_inlineComponent1'
 warning: unable to bind to property 'b' on class
 'GenericTest_inlineComponent1'
 warning: unable to bind to property 'b' on class
 'GenericTest_inlineComponent1'
 warning: unable to bind to property 'b' on class
 'GenericTest_inlineComponent1'
 warning: unable to bind to property 'b' on class
 'GenericTest_inlineComponent1'

 There's a couple of things that stand out here.  First, it doesn't complain
 about properties x or a.  The reason it doesn't complain about property
 a is that I used TestObject(data).a instead of (data as
 TestObject).a.  If you change it to the other way around, you will get a
 warning on a as well.  I find this rather bizarre, as I thought there was
 no functional difference to the two, other than as returning null if the
 object wasn't of the appropriate type rather than just erroring out like
 straight type coercion does.  But type coercion/as are very (ahem) lightly
 documented so I admit I don't know a lot.  But I don't think it's because of
 the null problem, since you can replace it with TestObject(null).b and it
 stops giving the warning.

 The second weird thing is that it doesn't complain about x when using
 (data as TestObject).x like it does with a.  As you can see, it's claiming
 this error is on GenericTest_inlineComponent1.  This is significant
 because it appears that it's instead doing some binding to the x property
 on the item renderer, which is *very* odd.  You can try this yourself by
 changing x to other strings.  Ones where there is a property of HBox named
 the same thing won't give you a warning.  Others will.

 Yet for all this griping, it seems the data binding IS working.  If you
 click on the button, you'll see all the labels in the list change as the
 data is being changed.

 So, anyone want to shed some light on these two behaviors?

 --
 Jason




 --
 Jason

   




-- 
Jason


Re: [flexcoders] Re: using as breaks data binding?

2009-05-12 Thread Pan Troglodytes
Thanks for giving me some confirmation.  Now if we could just figure out
what Alex/Adobe need to do to replicate our tests.

The reason it doesn't give a warning on y is due to what I referenced
(perhaps unclearly) above.  Notice in the warning it tells you it can't bind
to that value on the *itemRenderer *(GenericTest_inlineComponent1 in my
test), not on the *TestObject* instance.  The itemRenderer has an x and y
object, so that's why it doesn't complain.  It doesn't make any sense that
it should be looking at binding to the itemRenderer instead of the
TestObject instance, though.

On Tue, May 12, 2009 at 12:24 PM, valdhor valdhorli...@embarqmail.comwrote:



 Jason

 As a sanity check I tried it and I get the exact same error. I am using
 Flex SDK 3.3.0 and Flash Player WIN 9,0,159,0 Debug.

 Strangely enough, changing b to y fixes it and the error goes away. Other
 variable identifiers I have tried (Very small sample) gives the error as
 well.

 It's got me beat.

 Why would the posted code give an error at all?

 Why would y work and everything else not?


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes chimpathe...@... wrote:
 
  I wonder if I wasn't clear enough on this - these are run-time warnings
 that
  output to the console. You don't get those?
 
 
  On Mon, May 11, 2009 at 5:27 PM, Alex Harui aha...@... wrote:
 
  
  
   I didn't get any warnings like you did so I couldn't investigate
 further.
  
  
  
   Alex Harui
  
   Flex SDK Developer
  
   Adobe Systems Inc. http://www.adobe.com/
  
   Blog: http://blogs.adobe.com/aharui
  
  
  
   *From:* flexcoders@yahoogroups.com flexcoders%40yahoogroups.com[mailto:
 flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] *On
   Behalf Of *Pan Troglodytes
   *Sent:* Saturday, May 09, 2009 10:38 PM
   *To:* flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
   *Subject:* Re: [flexcoders] using as breaks data binding?
  
  
  
  
  
  
   3.3.0. I also get it with 4.0.0.6137. Just downloaded and got it in
   6772, too. I'm using player version 10,0,12,36. Do you need to know
   anything about my Flex Builder version? Let me know anything else I can
   provide.
  
   When you say you don't get it with the soon-to-be 3.4, what exactly do
 you
   mean? You just don't get the run-time warning? Did you track down why
 it
   would be okay with x and see if that's still doing whatever weird
 thing it
   is in 3.4?
  
   On Sat, May 9, 2009 at 4:11 PM, Alex Harui aha...@... wrote:
  
  
  
   Which version of Flex? I don't get it on the latest builds that will
 ship
   as 3.4
  
  
  
   Alex Harui
  
   Flex SDK Developer
  
   Adobe Systems Inc. http://www.adobe.com/

  
   Blog: http://blogs.adobe.com/aharui
  
  
  
   *From:* flexcoders@yahoogroups.com flexcoders%40yahoogroups.com[mailto:
 flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] *On
   Behalf Of *Pan Troglodytes
   *Sent:* Friday, May 08, 2009 11:06 PM
   *To:* flexcoders
   *Subject:* [flexcoders] using as breaks data binding?
  
  
  
  
  
   I've run across some peculiar behavior and I am trying to figure out if
 I
   should report it and if so, how exactly to explain it. Given these two
 bits
   of code:
  
   *TestObject.as:*
   package
   {
   public class TestObject
   {
   [Bindable] public var a:uint = 2;
   [Bindable] public var b:uint = 3;
   [Bindable] public var x:uint = 1;
   }
   }
  
   *Main Application:*
   ?xml version=1.0 encoding=utf-8?
   Application
   xmlns=http://www.adobe.com/2006/mxml;
   
   Script
   ![CDATA[
   import mx.collections.ArrayCollection;
   [Bindable] public var d:ArrayCollection = new ArrayCollection([
   new TestObject,
   new TestObject,
   new TestObject
   ]);
   ]]
   /Script
   List dataProvider={d}
   itemRenderer
   Component
   HBox
   Label text={TestObject(data).a}/
   Label text={(data as TestObject).b}/
   Label text={(data as TestObject).x}/
   /HBox
   /Component
   /itemRenderer
   /List
   Button click=for each (var o:TestObject in d) { o.x++; o.a++; o.b++
   }/
   /Application
  
   If you run this application, you get the following warnings:
   warning: unable to bind to property 'b' on class
   'GenericTest_inlineComponent1'
   warning: unable to bind to property 'b' on class
   'GenericTest_inlineComponent1'
   warning: unable to bind to property 'b' on class
   'GenericTest_inlineComponent1'
   warning: unable to bind to property 'b' on class
   'GenericTest_inlineComponent1'
   warning: unable to bind to property 'b' on class
   'GenericTest_inlineComponent1'
   warning: unable to bind to property 'b' on class
   'GenericTest_inlineComponent1'
  
   There's a couple of things that stand out here. First, it doesn't
 complain
   about properties x or a. The reason it doesn't complain about
 property
   a is that I used TestObject(data).a instead of (data as
   TestObject).a. If you change it to the other way around, you will get
 a
   warning on a as well. I find this rather bizarre

Re: [flexcoders] Re: using as breaks data binding?

2009-05-12 Thread Pan Troglodytes
Well, I entered the two related issues as:

https://bugs.adobe.com/jira/browse/SDK-21100
https://bugs.adobe.com/jira/browse/SDK-21101

Maybe someone at Adobe can manage to reproduce them.  I'm not really sure
how much harm is being done, since the code appears to work right in the
end.  But someone weird and unexpected seems to be going on under the hood.


On Tue, May 12, 2009 at 2:39 PM, Pan Troglodytes chimpathe...@gmail.comwrote:

 Thanks for giving me some confirmation.  Now if we could just figure out
 what Alex/Adobe need to do to replicate our tests.

 The reason it doesn't give a warning on y is due to what I referenced
 (perhaps unclearly) above.  Notice in the warning it tells you it can't bind
 to that value on the *itemRenderer *(GenericTest_inlineComponent1 in my
 test), not on the *TestObject* instance.  The itemRenderer has an x and y
 object, so that's why it doesn't complain.  It doesn't make any sense that
 it should be looking at binding to the itemRenderer instead of the
 TestObject instance, though.


 On Tue, May 12, 2009 at 12:24 PM, valdhor valdhorli...@embarqmail.comwrote:



 Jason

 As a sanity check I tried it and I get the exact same error. I am using
 Flex SDK 3.3.0 and Flash Player WIN 9,0,159,0 Debug.

 Strangely enough, changing b to y fixes it and the error goes away. Other
 variable identifiers I have tried (Very small sample) gives the error as
 well.

 It's got me beat.

 Why would the posted code give an error at all?

 Why would y work and everything else not?


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes chimpathe...@... wrote:
 
  I wonder if I wasn't clear enough on this - these are run-time warnings
 that
  output to the console. You don't get those?
 
 
  On Mon, May 11, 2009 at 5:27 PM, Alex Harui aha...@... wrote:
 
  
  
   I didn't get any warnings like you did so I couldn't investigate
 further.
  
  
  
   Alex Harui
  
   Flex SDK Developer
  
   Adobe Systems Inc. http://www.adobe.com/
  
   Blog: http://blogs.adobe.com/aharui
  
  
  
   *From:* flexcoders@yahoogroups.com flexcoders%40yahoogroups.com[mailto:
 flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] *On
   Behalf Of *Pan Troglodytes
   *Sent:* Saturday, May 09, 2009 10:38 PM
   *To:* flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
   *Subject:* Re: [flexcoders] using as breaks data binding?
  
  
  
  
  
  
   3.3.0. I also get it with 4.0.0.6137. Just downloaded and got it in
   6772, too. I'm using player version 10,0,12,36. Do you need to know
   anything about my Flex Builder version? Let me know anything else I
 can
   provide.
  
   When you say you don't get it with the soon-to-be 3.4, what exactly do
 you
   mean? You just don't get the run-time warning? Did you track down why
 it
   would be okay with x and see if that's still doing whatever weird
 thing it
   is in 3.4?
  
   On Sat, May 9, 2009 at 4:11 PM, Alex Harui aha...@... wrote:
  
  
  
   Which version of Flex? I don't get it on the latest builds that will
 ship
   as 3.4
  
  
  
   Alex Harui
  
   Flex SDK Developer
  
   Adobe Systems Inc. http://www.adobe.com/

  
   Blog: http://blogs.adobe.com/aharui
  
  
  
   *From:* flexcoders@yahoogroups.com flexcoders%40yahoogroups.com[mailto:
 flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] *On
   Behalf Of *Pan Troglodytes
   *Sent:* Friday, May 08, 2009 11:06 PM
   *To:* flexcoders
   *Subject:* [flexcoders] using as breaks data binding?
  
  
  
  
  
   I've run across some peculiar behavior and I am trying to figure out
 if I
   should report it and if so, how exactly to explain it. Given these two
 bits
   of code:
  
   *TestObject.as:*
   package
   {
   public class TestObject
   {
   [Bindable] public var a:uint = 2;
   [Bindable] public var b:uint = 3;
   [Bindable] public var x:uint = 1;
   }
   }
  
   *Main Application:*
   ?xml version=1.0 encoding=utf-8?
   Application
   xmlns=http://www.adobe.com/2006/mxml;
   
   Script
   ![CDATA[
   import mx.collections.ArrayCollection;
   [Bindable] public var d:ArrayCollection = new ArrayCollection([
   new TestObject,
   new TestObject,
   new TestObject
   ]);
   ]]
   /Script
   List dataProvider={d}
   itemRenderer
   Component
   HBox
   Label text={TestObject(data).a}/
   Label text={(data as TestObject).b}/
   Label text={(data as TestObject).x}/
   /HBox
   /Component
   /itemRenderer
   /List
   Button click=for each (var o:TestObject in d) { o.x++; o.a++; o.b++
   }/
   /Application
  
   If you run this application, you get the following warnings:
   warning: unable to bind to property 'b' on class
   'GenericTest_inlineComponent1'
   warning: unable to bind to property 'b' on class
   'GenericTest_inlineComponent1'
   warning: unable to bind to property 'b' on class
   'GenericTest_inlineComponent1'
   warning: unable to bind to property 'b' on class
   'GenericTest_inlineComponent1'
   warning: unable to bind to property 'b' on class

[flexcoders] using as breaks data binding?

2009-05-09 Thread Pan Troglodytes
I've run across some peculiar behavior and I am trying to figure out if I
should report it and if so, how exactly to explain it.  Given these two bits
of code:

*TestObject.as:*
package
{
  public class TestObject
  {
[Bindable] public var a:uint = 2;
[Bindable] public var b:uint = 3;
[Bindable] public var x:uint = 1;
  }
}

*Main Application:*
?xml version=1.0 encoding=utf-8?
Application
  xmlns=http://www.adobe.com/2006/mxml;
  
  Script
![CDATA[
  import mx.collections.ArrayCollection;
  [Bindable] public var d:ArrayCollection = new ArrayCollection([
new TestObject,
new TestObject,
new TestObject
  ]);
]]
  /Script
  List dataProvider={d}
itemRenderer
  Component
HBox
  Label text={TestObject(data).a}/
  Label text={(data as TestObject).b}/
  Label text={(data as TestObject).x}/
/HBox
  /Component
/itemRenderer
  /List
  Button click=for each (var o:TestObject in d) { o.x++; o.a++; o.b++ }/
/Application

If you run this application, you get the following warnings:
warning: unable to bind to property 'b' on class
'GenericTest_inlineComponent1'
warning: unable to bind to property 'b' on class
'GenericTest_inlineComponent1'
warning: unable to bind to property 'b' on class
'GenericTest_inlineComponent1'
warning: unable to bind to property 'b' on class
'GenericTest_inlineComponent1'
warning: unable to bind to property 'b' on class
'GenericTest_inlineComponent1'
warning: unable to bind to property 'b' on class
'GenericTest_inlineComponent1'

There's a couple of things that stand out here.  First, it doesn't complain
about properties x or a.  The reason it doesn't complain about property
a is that I used TestObject(data).a instead of (data as
TestObject).a.  If you change it to the other way around, you will get a
warning on a as well.  I find this rather bizarre, as I thought there was
no functional difference to the two, other than as returning null if the
object wasn't of the appropriate type rather than just erroring out like
straight type coercion does.  But type coercion/as are very (ahem) lightly
documented so I admit I don't know a lot.  But I don't think it's because of
the null problem, since you can replace it with TestObject(null).b and it
stops giving the warning.

The second weird thing is that it doesn't complain about x when using
(data as TestObject).x like it does with a.  As you can see, it's claiming
this error is on GenericTest_inlineComponent1.  This is significant because
it appears that it's instead doing some binding to the x property on the
item renderer, which is *very* odd.  You can try this yourself by changing
x to other strings.  Ones where there is a property of HBox named the same
thing won't give you a warning.  Others will.

Yet for all this griping, it seems the data binding IS working.  If you
click on the button, you'll see all the labels in the list change as the
data is being changed.

So, anyone want to shed some light on these two behaviors?

-- 
Jason


Re: [flexcoders] using as breaks data binding?

2009-05-09 Thread Pan Troglodytes
3.3.0.  I also get it with 4.0.0.6137.  Just downloaded and got it in 6772,
too.  I'm using player version 10,0,12,36.  Do you need to know anything
about my Flex Builder version?  Let me know anything else I can provide.

When you say you don't get it with the soon-to-be 3.4, what exactly do you
mean?  You just don't get the run-time warning?  Did you track down why it
would be okay with x and see if that's still doing whatever weird thing it
is in 3.4?


On Sat, May 9, 2009 at 4:11 PM, Alex Harui aha...@adobe.com wrote:



  Which version of Flex?  I don’t get it on the latest builds that will
 ship as 3.4



 Alex Harui

 Flex SDK Developer

 Adobe Systems Inc. http://www.adobe.com/

 Blog: http://blogs.adobe.com/aharui



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *Pan Troglodytes
 *Sent:* Friday, May 08, 2009 11:06 PM
 *To:* flexcoders
 *Subject:* [flexcoders] using as breaks data binding?






  I've run across some peculiar behavior and I am trying to figure out if I
 should report it and if so, how exactly to explain it.  Given these two bits
 of code:

 *TestObject.as:*
 package
 {
   public class TestObject
   {
 [Bindable] public var a:uint = 2;
 [Bindable] public var b:uint = 3;
 [Bindable] public var x:uint = 1;
   }
 }

 *Main Application:*
 ?xml version=1.0 encoding=utf-8?
 Application
   xmlns=http://www.adobe.com/2006/mxml;
   
   Script
 ![CDATA[
   import mx.collections.ArrayCollection;
   [Bindable] public var d:ArrayCollection = new ArrayCollection([
 new TestObject,
 new TestObject,
 new TestObject
   ]);
 ]]
   /Script
   List dataProvider={d}
 itemRenderer
   Component
 HBox
   Label text={TestObject(data).a}/
   Label text={(data as TestObject).b}/
   Label text={(data as TestObject).x}/
 /HBox
   /Component
 /itemRenderer
   /List
   Button click=for each (var o:TestObject in d) { o.x++; o.a++; o.b++
 }/
 /Application

 If you run this application, you get the following warnings:
 warning: unable to bind to property 'b' on class
 'GenericTest_inlineComponent1'
 warning: unable to bind to property 'b' on class
 'GenericTest_inlineComponent1'
 warning: unable to bind to property 'b' on class
 'GenericTest_inlineComponent1'
 warning: unable to bind to property 'b' on class
 'GenericTest_inlineComponent1'
 warning: unable to bind to property 'b' on class
 'GenericTest_inlineComponent1'
 warning: unable to bind to property 'b' on class
 'GenericTest_inlineComponent1'

 There's a couple of things that stand out here.  First, it doesn't complain
 about properties x or a.  The reason it doesn't complain about property
 a is that I used TestObject(data).a instead of (data as
 TestObject).a.  If you change it to the other way around, you will get a
 warning on a as well.  I find this rather bizarre, as I thought there was
 no functional difference to the two, other than as returning null if the
 object wasn't of the appropriate type rather than just erroring out like
 straight type coercion does.  But type coercion/as are very (ahem) lightly
 documented so I admit I don't know a lot.  But I don't think it's because of
 the null problem, since you can replace it with TestObject(null).b and it
 stops giving the warning.

 The second weird thing is that it doesn't complain about x when using
 (data as TestObject).x like it does with a.  As you can see, it's claiming
 this error is on GenericTest_inlineComponent1.  This is significant
 because it appears that it's instead doing some binding to the x property
 on the item renderer, which is *very* odd.  You can try this yourself by
 changing x to other strings.  Ones where there is a property of HBox named
 the same thing won't give you a warning.  Others will.

 Yet for all this griping, it seems the data binding IS working.  If you
 click on the button, you'll see all the labels in the list change as the
 data is being changed.

 So, anyone want to shed some light on these two behaviors?

 --
 Jason

   




-- 
Jason


[flexcoders] where does AdvancedDataGridColumn.id come from?

2009-05-08 Thread Pan Troglodytes
This puzzles me a bit.  There is no such property as id on
AdvancedDataGridColumn or its ancestors.  So why doesn't the compiler barf
and give you an unknown property at compile time (it does at runtime)?  Is
this some kind of kludge in FB such that it always allows an element called
id to be stuck on some components (like CSSStyleDeclaration descendants)?

-- 
Jason


Re: [flexcoders] where does AdvancedDataGridColumn.id come from?

2009-05-08 Thread Pan Troglodytes
Well, there is an there isn't.  UIComponent actually defines a property of
called id.  AdvancedDataGridColumn isn't a UIComponent, its a descendant
of CSSStyleDeclaration, which does not define id, nor does its ancestors.
So I guess I really knew the answer before I asked it in that it's a bit of
a kludge to let you name objects in MXML so you can refer to them later.
Then at runtime, this information just isn't there because it really never
existed.


On Fri, May 8, 2009 at 3:08 PM, Charles Parcell pokemonkil...@gmail.comwrote:



 I believe there is an 'id' for every element you add via MXML.

 http://livedocs.adobe.com/flex/3/html/help.html?content=advdatagrid_10.html

 See the second example on this page.

 Charles P.



 On Fri, May 8, 2009 at 4:01 PM, Pan Troglodytes chimpathe...@gmail.comwrote:



 This puzzles me a bit.  There is no such property as id on
 AdvancedDataGridColumn or its ancestors.  So why doesn't the compiler barf
 and give you an unknown property at compile time (it does at runtime)?  Is
 this some kind of kludge in FB such that it always allows an element called
 id to be stuck on some components (like CSSStyleDeclaration descendants)?

 --
 Jason



  




-- 
Jason


Re: [flexcoders] for better performance, use as rather than just leaving an object as Object?

2009-05-06 Thread Pan Troglodytes
Thanks for the input, Alex.  True, it did take a lot of iterations to get a
one second difference, but that's with only one reference to a property.  If
I had something like:   o.foo.bar[3].baz = o.foo.getBaz(), I've suddenly
quintupled the number of FindProperty calls.  Ditto if I had a few lines of
calls, all working off of o.

But mainly I agree that you have to consider whether a given optimization
is worth it if the code doesn't actually need optimizing and the
optimization will make the code harder to understand and maintain.  That's
why this is such a good tip, since I wanted to use as anyway to make the
code more maintainable!  Good point about SWF/RAM size, though.

You finally got me to bother setting up some RSS subscriptions in
thunderbird.  I always mean to read the various excellent Flex blogs, but
never get around to it.  Maybe this way I'll be more likely to get those
useful nuggets of knowledge.  I'm already looking forward to implementing
some of your tips on itemRenderers (especially the image centering ones) to
try to speed up a particularly painful ADG redraw.

On Tue, May 5, 2009 at 12:24 AM, Alex Harui aha...@adobe.com wrote:



  I published similar results on my blog a few years back.



 The reason it is slower is that there are more byte codes involved and
 those byte codes take more time.  The more you know, and the more
 information you have handy, the less work there is to do and we can make
 more assumptions.



 For “b.id”, the byte code is more or less:

 Push “id”

 Push “b”

 GetProperty



 For “(b as button).id”, the byte code is roughly:

 Push “id”

 Push b

 Push button

 Coerce

 GetProperty



 For “o.id”, the byte code is roughly:

 Push “id”

 Push “o”

 FindProperty



 and FindProperty is much slower.



 Note that it takes 1000 accesses to feel a 1 second difference.
 There’s more byte code involved in using “as” so if you did it everywhere
 your SWF will be larger and take up more memory at runtime and could offset
 those gains.  However, if you’ve got the time, it might be worth doing from
 a code maintenance standpoint as the compiler will help you find
 misspellings and what not.







 Alex Harui

 Flex SDK Developer

 Adobe Systems Inc. http://www.adobe.com/

 Blog: http://blogs.adobe.com/aharui



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *Pan Troglodytes
 *Sent:* Monday, May 04, 2009 7:19 PM
 *To:* flexcoders
 *Subject:* [flexcoders] for better performance, use as rather than just
 leaving an object as Object?






  I was curious as to the difference between a few different ways of
 approaching the situation of an itemRenderer having a data property and
 deciding whether or not to use as to make all the type checking happy.  So
 I tried some test code and found that it made a big difference whether you
 use as or just leave the data property as an Object.  If you leave it as
 an Object, you get a performance hit on the order of 40%+ longer than if you
 use as to cast it first.

 Here are the ways I tested it.  I just decided to pull the id property
 because it's something that is just a simple access of a private variable,
 no complicated stuff.

 var b:Button = new Button;
 var o:Object = b;
 var s:String;

 s = b.id;
 s = (o as Button).id;
 s = Button(o).id;
 s = UIComponent(o).id;
 s = (o as UIComponent).id;
 s = o.id;

 I did get a bit fancy and put them in a loop and a timer to isolate each
 one.  The full code is included below.

 What I found was along the lines of this (give or take a few %):

 Button: 3.16
 Button():   4.06  129%
 as Button:  4.14  131%
 UIComponent():  3.98  126%
 as UIComponent: 4.03  128%
 Object: 5.38  170%

 I put in the UIComponent ones because sometimes I cast it to a superclass
 because I might get several different subclasses passed into a function.

 So what I've found is that if you ignore than noise, the middle four
 methods are also approximately the same in timings.  But the Object one is
 far worse.  This probably won't come as any surprise to the Adobe folks or
 the people who have been working with Flex a bit more in-depth.  I found it
 rather useful information, though, considering I'm trying to shave off some
 time in various places in one of my apps.  Granted, it won't matter as much
 outside of loops.

 So many things return the items as objects, such as Arrays/ArrayCollection,
 the data property of item renderers, etc.  I think I'm just going to make
 it a habit to put as in my code (and not the format of Class(variable)
 because sometimes that triggers a function rather than just doing a casting)
 all the time.  It helps catch errors by doing strict type checking (as long
 as you aren't using dynamic classes) and it's a little faster to boot.

 Still, I wish it was as fast as the top line where you don't have to do any
 casting/as at all.  Any thoughts on that or anything else I've missed?  Any
 flash

[flexcoders] for better performance, use as rather than just leaving an object as Object?

2009-05-04 Thread Pan Troglodytes
I was curious as to the difference between a few different ways of
approaching the situation of an itemRenderer having a data property and
deciding whether or not to use as to make all the type checking happy.  So
I tried some test code and found that it made a big difference whether you
use as or just leave the data property as an Object.  If you leave it as
an Object, you get a performance hit on the order of 40%+ longer than if you
use as to cast it first.

Here are the ways I tested it.  I just decided to pull the id property
because it's something that is just a simple access of a private variable,
no complicated stuff.

var b:Button = new Button;
var o:Object = b;
var s:String;

s = b.id;
s = (o as Button).id;
s = Button(o).id;
s = UIComponent(o).id;
s = (o as UIComponent).id;
s = o.id;

I did get a bit fancy and put them in a loop and a timer to isolate each
one.  The full code is included below.

What I found was along the lines of this (give or take a few %):

Button: 3.16
Button():   4.06  129%
as Button:  4.14  131%
UIComponent():  3.98  126%
as UIComponent: 4.03  128%
Object: 5.38  170%

I put in the UIComponent ones because sometimes I cast it to a superclass
because I might get several different subclasses passed into a function.

So what I've found is that if you ignore than noise, the middle four methods
are also approximately the same in timings.  But the Object one is far
worse.  This probably won't come as any surprise to the Adobe folks or the
people who have been working with Flex a bit more in-depth.  I found it
rather useful information, though, considering I'm trying to shave off some
time in various places in one of my apps.  Granted, it won't matter as much
outside of loops.

So many things return the items as objects, such as Arrays/ArrayCollection,
the data property of item renderers, etc.  I think I'm just going to make
it a habit to put as in my code (and not the format of Class(variable)
because sometimes that triggers a function rather than just doing a casting)
all the time.  It helps catch errors by doing strict type checking (as long
as you aren't using dynamic classes) and it's a little faster to boot.

Still, I wish it was as fast as the top line where you don't have to do any
casting/as at all.  Any thoughts on that or anything else I've missed?  Any
flash insiders want to give your insight on why it works this way under the
hood?


?xml version=1.0 encoding=utf-8?
Application
  xmlns=http://www.adobe.com/2006/mxml;
  
  Script
![CDATA[
  import mx.core.UIComponent;

  private var timer:Timer = new Timer(100);
  private var mode:int = 0;

  private function doClick(e:Event):void
  {
if (timer.running)
{
  timer.stop();
  timer.removeEventListener(TimerEvent.TIMER, timerClick);
}
else
{
  timer.addEventListener(TimerEvent.TIMER, timerClick);
  timer.start();
}
  }

  private var last:Number;
  private var b:Button = new Button;
  private var o:Object = b;
  private var s:String;
  private var i:int;
  private var traceStart:Date;
  private var loops:int = 1000;
  private var time:Number;

  private function timerClick(e:Event):void
  {
timer.stop();

switch(mode)
{
  case 0:
trace();

traceStart = new Date();
for (i = 0; i  loops; i++)
  s = b.id;
time = (new Date().time - traceStart.time);
trace(Button:\t\t, (time / 1000).toFixed(2));
last = time;
break;

  case 1:
traceStart = new Date();
for (i = 0; i  loops; i++)
  s = (o as Button).id;
time = (new Date().time - traceStart.time);
trace(as Button:\t,
(time / 1000).toFixed(2), \t, ((time / last) *
100).toFixed(0) + %);
break;

  case 2:
traceStart = new Date();
for (i = 0; i  loops; i++)
  s = Button(o).id;
time = (new Date().time - traceStart.time);
trace(Button():\t,
(time / 1000).toFixed(2), \t, ((time / last) *
100).toFixed(0) + %);
break;

  case 3:
traceStart = new Date();
for (i = 0; i  loops; i++)
  s = (o as UIComponent).id;
time = (new Date().time - traceStart.time);
trace(as UIComponent:\t,
(time / 1000).toFixed(2), \t, ((time / last) *
100).toFixed(0) + %);
break;

  case 4:
traceStart = new Date();
for (i = 0; i  loops; i++)
  s = UIComponent(o).id;
time = (new Date().time - traceStart.time);
trace(UIComponent():\t,
(time / 1000).toFixed(2), \t, ((time / last) *
100).toFixed(0) + %);
break;

  case 5:
 

Re: [flexcoders] Re: ADG Code Completion Missing

2009-05-01 Thread Pan Troglodytes
Excellent!  That did the trick.  Thanks for the followup.

On Wed, Apr 29, 2009 at 1:11 PM, valdhor valdhorli...@embarqmail.comwrote:



 The problem is that the ADG stuff is missing from the mxml-manifest.xml
 file. The chart stuff is there but no ADG.

 To fix, open up ...sdks/3.3.0/frameworks/mxml-manifest.xml in your favorite
 editor. Add the following lines somewhere (I added them in the !--
 framework -- section)...

 component id=AdvancedDataGrid class=mx.controls.AdvancedDataGrid/
 component id=AdvancedDataGridColumn
 class=mx.controls.advancedDataGridClasses.AdvancedDataGridColumn/
 component id=AdvancedDataGridItemRenderer
 class=mx.controls.advancedDataGridClasses.AdvancedDataGridItemRenderer/

 There may be more that I have missed but those three got me going again.


 This has been reported as a bug which is supposedly fixed in Gumbo (Which I
 am not using yet).


 HTH.



 Steve




 --- In flexcoders@yahoogroups.com, Pan Troglodytes chimpathe...@...
 wrote:
 
  Well, either I got confused before and though it was working when it was
  still broken, or it's more complicated.
 
  It's back to not working at all for me under 3.3.0 for any Advanced*
 classes
  n MXML or ActionScript.
 
 
 
  On Wed, Apr 29, 2009 at 11:42 AM, Pan Troglodytes chimpathe...@...wrote:
 
   I had the exact same problem with 3.3.0. After switching it to 3.3.0,
 it
   wouldn't bring up code completion for either MXML or ActionScript on
   AdvancedDataGrid/AdvancedListBase/Advanced*. It would bring it up for
 the
   chart classes, though, which are also in the same SWC. Switching it
 back to
   3.2.0 and the code completion would work.
  
   I found that when I switched it back and forth a few times, it started
   miraculously working even for 3.3.0. Seems like something in FB is
 getting
   gummed up that eventually resets itself.
  
  
  
   On Wed, Mar 18, 2009 at 10:59 AM, valdhor valdhorli...@...wrote:
  
   This is the first time that I have actually used the AdvancedDataGrid
   so I went through the instructions at...
  
  
 http://blogs.adobe.com/flexdoc/2008/04/extracting_data_visualization.html
  
   and the thread at...
  
   http://tech.groups.yahoo.com/group/flexcoders/message/138099
  
   This worked well and I could run the examples and modify them as I
 wanted.
  
   I did notice, however, that there was no code completion available for
 any
   AdvancedDataGrid component.
  
   Am I missing something? A XML file is missing maybe?
  
   Any thoughts would be most welcome.
  
   Steve
  
  
  
  
  
  
   --
   Jason
  
 
 
 
  --
  Jason
 
  




-- 
Jason


Re: [flexcoders] ADG Code Completion Missing

2009-04-29 Thread Pan Troglodytes
I had the exact same problem with 3.3.0.  After switching it to 3.3.0, it
wouldn't bring up code completion for either MXML or ActionScript on
AdvancedDataGrid/AdvancedListBase/Advanced*.  It would bring it up for the
chart classes, though, which are also in the same SWC.  Switching it back to
3.2.0 and the code completion would work.

I found that when I switched it back and forth a few times, it started
miraculously working even for 3.3.0.  Seems like something in FB is getting
gummed up that eventually resets itself.


On Wed, Mar 18, 2009 at 10:59 AM, valdhor valdhorli...@embarqmail.comwrote:

   This is the first time that I have actually used the AdvancedDataGrid so
 I went through the instructions at...

 http://blogs.adobe.com/flexdoc/2008/04/extracting_data_visualization.html

 and the thread at...

 http://tech.groups.yahoo.com/group/flexcoders/message/138099

 This worked well and I could run the examples and modify them as I wanted.

 I did notice, however, that there was no code completion available for any
 AdvancedDataGrid component.

 Am I missing something? A XML file is missing maybe?

 Any thoughts would be most welcome.

 Steve

  




-- 
Jason


Re: [flexcoders] ADG Code Completion Missing

2009-04-29 Thread Pan Troglodytes
Well, either I got confused before and though it was working when it was
still broken, or it's more complicated.

It's back to not working at all for me under 3.3.0 for any Advanced* classes
n MXML or ActionScript.



On Wed, Apr 29, 2009 at 11:42 AM, Pan Troglodytes chimpathe...@gmail.comwrote:

 I had the exact same problem with 3.3.0.  After switching it to 3.3.0, it
 wouldn't bring up code completion for either MXML or ActionScript on
 AdvancedDataGrid/AdvancedListBase/Advanced*.  It would bring it up for the
 chart classes, though, which are also in the same SWC.  Switching it back to
 3.2.0 and the code completion would work.

 I found that when I switched it back and forth a few times, it started
 miraculously working even for 3.3.0.  Seems like something in FB is getting
 gummed up that eventually resets itself.



 On Wed, Mar 18, 2009 at 10:59 AM, valdhor valdhorli...@embarqmail.comwrote:

   This is the first time that I have actually used the AdvancedDataGrid
 so I went through the instructions at...

 http://blogs.adobe.com/flexdoc/2008/04/extracting_data_visualization.html

 and the thread at...

 http://tech.groups.yahoo.com/group/flexcoders/message/138099

 This worked well and I could run the examples and modify them as I wanted.

 I did notice, however, that there was no code completion available for any
 AdvancedDataGrid component.

 Am I missing something? A XML file is missing maybe?

 Any thoughts would be most welcome.

 Steve

  




 --
 Jason




-- 
Jason


[flexcoders] very strange combobox problem when switching dataproviders

2009-02-05 Thread Pan Troglodytes
I'm running into something fairly perplexing.  Read the following code and
think of what you'd expect it to do when you click the change button.  Then
run it and click the change button.

?xml version=1.0 encoding=utf-8?
mx:Application
  xmlns:mx=http://www.adobe.com/2006/mxml;
  layout=vertical
  creationComplete=cc()
  
  mx:Script
![CDATA[
  import mx.collections.ArrayCollection;

  public var d1:ArrayCollection = new ArrayCollection([{label:one},
{label:two}, {label:three}]);
  public var d2:ArrayCollection = new ArrayCollection([{label:a},
{label:b}, {label:c}]);
  //public var d1:Array = [{label:one}, {label:two},
{label:three}];
  //public var d2:Array = [{label:a}, {label:b}, {label:c}];

  private function cc():void
  {
c1.dataProvider = d1;
c1.dataProvider = d2;
c1.selectedIndex = 1;
  }

  private function change():void
  {
trace();
trace();
trace(  before change: );
trace(c1.selectedIndex:, c1.selectedIndex);
trace(c1.selectedItem: , c1.selectedItem.label);

d1.removeItemAt(0);
//d1.splice(0, 1);

trace()
trace(  after change:  );
trace(c1.selectedIndex:, c1.selectedIndex);
trace(c1.selectedItem: , c1.selectedItem.label);
  }
]]
  /mx:Script
  mx:ComboBox id=c1/
  mx:Button label=change click=change()/
/mx:Application


What does it do?  Well, the combobox changes from saying b to a.  The
trace says the following:
  before change:
c1.selectedIndex: 1
c1.selectedItem:  b

  after change:
c1.selectedIndex: 0
c1.selectedItem:  b

This is completely baffling.  My only guess is that somewhere in the guts of
combobox or its ancestors, it is registering for changes on a dataProvider
and not unregistering them when the dataProvider changes.  List does not
seem to suffer the same problem.

If you comment out the ArrayCollection-based version and uncomment the
Array-based version, it works as expected.

My next stop is a bug report, but I figured it'd be worth bringing up in
case anyone already knows of a bug report (kind of hard criteria to search
for) or a workaround if you need to use ArrayCollections.

-- 
Jason


Re: [flexcoders] Re: very strange combobox problem when switching dataproviders

2009-02-05 Thread Pan Troglodytes
Okay, entered as
https://bugs.adobe.com/jira/browse/SDK-19145

if anyone is interested in voting for it or watching it.


On Thu, Feb 5, 2009 at 1:56 PM, kuroiryu42 kuroiry...@yahoo.com wrote:

   Yep its a bug, didn't bother to look it up but if you need a work around
 you could extend and override the combobox collectionChangeHandler
 look for the reset kind and remove the listener at that point.

 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes chimpathe...@...
 wrote:

 
  I'm running into something fairly perplexing. Read the following
 code and
  think of what you'd expect it to do when you click the change
 button. Then
  run it and click the change button.
 
  ?xml version=1.0 encoding=utf-8?
  mx:Application
  xmlns:mx=http://www.adobe.com/2006/mxml;
  layout=vertical
  creationComplete=cc()
  
  mx:Script
  ![CDATA[
  import mx.collections.ArrayCollection;
 
  public var d1:ArrayCollection = new
 ArrayCollection([{label:one},
  {label:two}, {label:three}]);
  public var d2:ArrayCollection = new ArrayCollection([{label:a},
  {label:b}, {label:c}]);
  //public var d1:Array = [{label:one}, {label:two},
  {label:three}];
  //public var d2:Array = [{label:a}, {label:b}, {label:c}];
 
  private function cc():void
  {
  c1.dataProvider = d1;
  c1.dataProvider = d2;
  c1.selectedIndex = 1;
  }
 
  private function change():void
  {
  trace();
  trace();
  trace( before change: );
  trace( c1.selectedIndex:, c1.selectedIndex);
  trace( c1.selectedItem: , c1.selectedItem.label);
 
  d1.removeItemAt(0);
  //d1.splice(0, 1);
 
  trace()
  trace( after change: );
  trace( c1.selectedIndex:, c1.selectedIndex);
  trace( c1.selectedItem: , c1.selectedItem.label);
  }
  ]]
  /mx:Script
  mx:ComboBox id=c1/
  mx:Button label=change click=change()/
  /mx:Application
 
 
  What does it do? Well, the combobox changes from saying b to a.
 The
  trace says the following:
  before change:
  c1.selectedIndex: 1
  c1.selectedItem: b
 
  after change:
  c1.selectedIndex: 0
  c1.selectedItem: b
 
  This is completely baffling. My only guess is that somewhere in the
 guts of
  combobox or its ancestors, it is registering for changes on a
 dataProvider
  and not unregistering them when the dataProvider changes. List does not
  seem to suffer the same problem.
 
  If you comment out the ArrayCollection-based version and uncomment the
  Array-based version, it works as expected.
 
  My next stop is a bug report, but I figured it'd be worth bringing up in
  case anyone already knows of a bug report (kind of hard criteria to
 search
  for) or a workaround if you need to use ArrayCollections.
 
  --
  Jason
 

  




-- 
Jason


[flexcoders] What determines a component's initial skin?

2009-01-21 Thread Pan Troglodytes
I've been dinking with extending PopUpButton and have run into something
that really puzzles me - how does it know to load PopUpButtonSkin by
default?  There is no code that mentions it in PopUpButton.  Is it somehow
selected based on the class name?

In my PopUpButton descendant, I want it to load a different skin by
default.  Do I just have to hardcode it into the constructor (or somewhere
else that initializes the component), or is there some more
standard/graceful way?

-- 
Jason


Re: [flexcoders] Re: What determines a component's initial skin?

2009-01-21 Thread Pan Troglodytes
Any hint on what that topic might be under in the docs?  I'm having trouble
finding it.


On Wed, Jan 21, 2009 at 12:15 PM, Alex Harui aha...@adobe.com wrote:

Default styles for 3rd party components is a rough spot in Flex 3.
 Default styles are usually defined in a CSS type selector (see defaults.css
 for examples), but third parties have to do a more difficult dance since
 they can't append to defaults.css.  There is a pattern for doing this in the
 docs and has been discussed on this forum.  In it involves a
 classConstruct() function IIRC



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *Amy
 *Sent:* Wednesday, January 21, 2009 9:55 AM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] Re: What determines a component's initial skin?



 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes chimpathe...@...
 wrote:
 
  I've been dinking with extending PopUpButton and have run into
 something
  that really puzzles me - how does it know to load PopUpButtonSkin by
  default? There is no code that mentions it in PopUpButton. Is it
 somehow
  selected based on the class name?

 There's a globals.css that seems to get compiled in by default.

  In my PopUpButton descendant, I want it to load a different skin by
  default. Do I just have to hardcode it into the constructor (or
 somewhere
  else that initializes the component), or is there some more
  standard/graceful way?

 I couldn't find a way to fudge this that was any easier than just
 having a css declaration for the subcomponent. If you want it to
 travel with your component, though, I suspect you'll have to put it
 into the constructor, since you probably don't want to assume other
 developers have included your style declaration in their globals.css.

 HTH;

 Amy

 HTH;

 Amy

   




-- 
Jason


[flexcoders] where is the FB Pro 3.0.2 datavisualization source?

2009-01-14 Thread Pan Troglodytes
I upgraded to 3.0.2 and seem to have a bit of an issue.  The last time I've
seen the datavisualization source distributed is in 3.0.0.  Sometimes when I
trace into SDK units (BubbleSeries.as at the moment), you can tell the
debugger is going to a line from a different version of the file.  Crashing
on a line that contains var minItems:Array /* of BubbleSeriesItem */ = [];
is kind of a dead giveaway.

Is there some way to actually get the updated source or are we screwed?

-- 
Jason


[flexcoders] Re: where is the FB Pro 3.0.2 datavisualization source?

2009-01-14 Thread Pan Troglodytes
Hmm, I should also mention that the error I'm getting is:
TypeError: Error #1009: Cannot access a property or method of a null object
reference.
at
mx.charts.series::BubbleSeries/findDataPoints()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\series\BubbleSeries.as:933]
at
mx.charts.chartClasses::ChartBase/findDataPoints()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\chartClasses\ChartBase.as:1974]
at
mx.charts.chartClasses::ChartBase/mouseOverHandler()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\chartClasses\ChartBase.as:4216]

Which is really odd, considering I don't have a C:\work folder.  It looks
like for some reason it's showing the Adobe developer's paths.

On Thu, Jan 15, 2009 at 12:32 AM, Pan Troglodytes chimpathe...@gmail.comwrote:

 I upgraded to 3.0.2 and seem to have a bit of an issue.  The last time I've
 seen the datavisualization source distributed is in 3.0.0.  Sometimes when I
 trace into SDK units (BubbleSeries.as at the moment), you can tell the
 debugger is going to a line from a different version of the file.  Crashing
 on a line that contains var minItems:Array /* of BubbleSeriesItem */ = [];
 is kind of a dead giveaway.

 Is there some way to actually get the updated source or are we screwed?

 --
 Jason




-- 
Jason


Re: [flexcoders] Re: where is the FB Pro 3.0.2 datavisualization source?

2009-01-14 Thread Pan Troglodytes
Thank you VERY much for the excellent pointer.  I don't know why they don't
install it by default either.  Then again, I also don't know why the
Expressions window can't understand the expression -1!

On Thu, Jan 15, 2009 at 12:44 AM, Sam Lai samuel@gmail.com wrote:


 http://blogs.adobe.com/flexdoc/2008/04/extracting_data_visualization.html

 Substitute 3.0.0 for 3.2.0 and you should be right. Took me a while to
 find this when I needed it - don't know why they don't just install it
 if Flex 3 Pro is detected, but anyway...

 2009/1/15 Pan Troglodytes chimpathe...@gmail.comchimpathetic%40gmail.com
 :

  Hmm, I should also mention that the error I'm getting is:
  TypeError: Error #1009: Cannot access a property or method of a null
 object
  reference.
  at
 
 mx.charts.series::BubbleSeries/findDataPoints()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\series\BubbleSeries.as:933]
  at
 
 mx.charts.chartClasses::ChartBase/findDataPoints()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\chartClasses\ChartBase.as:1974]
  at
 
 mx.charts.chartClasses::ChartBase/mouseOverHandler()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\chartClasses\ChartBase.as:4216]
 
  Which is really odd, considering I don't have a C:\work folder. It looks
  like for some reason it's showing the Adobe developer's paths.
 
  On Thu, Jan 15, 2009 at 12:32 AM, Pan Troglodytes 
 chimpathe...@gmail.com chimpathetic%40gmail.com
  wrote:
 
  I upgraded to 3.0.2 and seem to have a bit of an issue. The last time
  I've seen the datavisualization source distributed is in 3.0.0.
 Sometimes
  when I trace into SDK units (BubbleSeries.as at the moment), you can
 tell
  the debugger is going to a line from a different version of the file.
  Crashing on a line that contains var minItems:Array /* of
 BubbleSeriesItem
  */ = []; is kind of a dead giveaway.
 
  Is there some way to actually get the updated source or are we screwed?
 
  --
  Jason
 
 
 
  --
  Jason
 
  




-- 
Jason


[flexcoders] Strange error about declaration of style conflicting with unrelated class

2009-01-09 Thread Pan Troglodytes
I'm receiving a very peculiar error.  I've boiled it down to a simple
reproducible test.  Given the following two files:

GenericTest.mxml:
?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute
  mx:Script
![CDATA[
  private var test:TestStyle;
]]
  /mx:Script
/mx:Application


TestStyle.as:
package
{
  import mx.core.UIComponent;

  [Style(name=color, type=uint, format=Color, inherit=no)]
  public class TestStyle extends UIComponent
  {
  }
}

I get the following error trying to compile, ever after cleaning the
project:
Severity and DescriptionPathResourceLocationCreation Time
Id
Declaration of style 'color' conflicts with previous declaration in
C:\Program Files\Adobe\Flex Builder
3\sdks\3.2.0\frameworks\libs\framework.swc(mx/core/Container).
GenericTestUnknown123152185967429620

First, I'm pretty sure the claim that it's Container causing the problem is
wrong, as TestStyle is a subclass of UIComponent, not a subclass of
Container.  In the help for UIComponent, there is no color style or property
listed.  Plus if you make it inherit from other things like Object,
DisplayObject, Sprite, etc., the error changes to different files, including
saying the file conflicts with itself (Declaration of style 'color'
conflicts with previous declaration in C:\dev\GenericTest\src\TestStyle.as);

If I change it to inherit=yes, it does not have a problem with it.  My
best guess is that there's something hidden and undocumented.  Doing a
search on all the SDK code found no declaration for it.  If I take out my
Style declaration and call getStyle(color) on a newly created TestStyle
object, I get 0x0B333C.  So it's getting set somewhere.

Anyone want to offer their two cents?  I'm considering filing a bug report
but I don't know exactly if this should be considered a bug (well,
definitely a bug in the compiler error text) or poor documentation or what.

-- 
Jason


[flexcoders] Anyone written a ComboBox that can take an AdvancedDataGrid as a dropdown?

2009-01-06 Thread Pan Troglodytes
I find myself in the position of really needing a ComboBox that can take an
AdvancedDataGrid descendant in the dropdownFactory.  Unfortunately, ComboBox
is pretty hardcoded to use ListBase and AdvancedListBase does not inherit
from it.  Recreating a DataGrid version of my existing ADG descendant will
be a total pain.

Unfortunately, CombBox is written in such a way that mx_internals and other
muck is threaded throughout, making it difficult if not impossible to just
clone and replace references to ListBase.

Anyone here already tilted at this windmill?

-- 
Jason


[flexcoders] My frustrations with the Adobe Bug Report system

2008-12-19 Thread Pan Troglodytes
I've put off writing this for a while out of laziness.  Going out of my way
to report bugs is already sort of outside of the scope of what I should be
working on, but I consider it very important for the quality of the
product.  And it helps that my bugs are typically answered and fixed.  But
griping about the bug report system itself seemed a little too meta.  Plus,
I kept debating on whether I should file it as a bug or email it here or dig
someone at Adobe's address up or what.

So I've settled on this, here goes.

Generally, the bug system works well.  Yes, it can be a bit frustrating to
find out if there's already a bug with the issue you're going to report.
Yes, those old bugs imported from the old DB are maddening when the subject
line makes you think they're the same.  But all in all, it works ok.  There
are really only a few things that really bug me.  Also, I'm sorry for the
terrible pun.

My main problem is with documentation.  There needs to be some explanations
as to what choices in the various combo boxes mean so that we, as users, can
more intelligently give you feedback.

Take for example the bug I'm about to enter.  I found a bug in the compiler
so that it's not parsing the code right.  This happens both in Flex Builder
and in mxmlc.  I start out and it asks Project.  I wasn't sure on the
dropdown if it should be ActionScript Compiler (ASC) or Flex Builder.  I
finally figured out I could go through Browse Projects and click on
individual projects to get descriptions of them, though not all of them had
descriptions.  Even after entering enough bugs to get a t-shirt, it took me
this long to find that.  There's plenty of room on that first page to have a
list of the projects and a short paragraph defining the scope of the project
so submitters can more easily pick the project.  FYI, I eventually decided
on ActionScript Compiler.

Next you have the Issue Type.  If you click on the little help box, you get
this help for feature requests versus minor enhancements:
 *Feature Request* A new feature to the product.  *Minor Enhancement* A new
enhancement to the product.
I had a better idea about the difference between those two BEFORE I clicked
on the help.

No matter if you choose Bug, Feature Request or Minor Enhancement, you still
get the same list of severities on the next page.  So you can choose
Bug-Enhancement/Task or you can choose Minor Enhancement-Crash Hang.  I
realize that this may just be a limitation of JIRA, but it's a little
distracting.  Along with this, minor enhancements get all the other boxes
like Discoverability, Reproducibility, Regression, etc. that really don't
apply to them.  Feature requests don't get that, but then again there's the
whole fuziness about the difference between those two things.

Now you go on to choose the Component the bug is found in.  I have never
found a page that actually gives descriptions of the various components.
And some of these leave me scratching my head.  Much as with the projects,
there should really be an easy way to get a sentence or three about each
component so you can more easily decide where to put new bugs.  Either that,
or force all bugs to go to an unassigned component and let the bug
reviewers sort it properly.

None
Future
Player 10 - Code Complete
Flex 4
QVM 1 - Code Complete
Flex 3 - Beta 2
FP 9.2 - Code Complete
FP 9.1.6 - Code Complete
FP 9.1.5 - GMC Lockdown
FP 9.1 - GMC
Flash 9.0

Erm... I'm using Flex Builder 3 and the compiler is barfing.  Help?

These are specific to each project, so I'm baffled why so many versions
exist for the compiler when generally errors in it will happen before you
ever get to the flash player.

Of course, this is still probably better than the list of version that comes
up when you choose the Flex Builder project:
None
Post Gumbo
SDK Integration
I9
MAX
I18N
3.0.2
I8
I7
I6
I5
3.0.1
I4
I3
Moxie Release (Fix Before Release)
RC6
RC5
RC4
RC3
RC2
RC1
RC 0
Moxie M3 (zero)
Moxie Japanese Beta 2
Moxie M3 (Beta 2)
Moxie M2 (Beta 1)
Moxie M1 (Alpha)
Moxie M0
2.0.1 Hotfix 2
2.0.1 English (Released)
2.0.1 Japanese (Released)
2.0 English (Released)
2.0 Japanese (Released)
(Planning) Moxie Candidates
(Planning) Post Moxie

That's a lot of versions.  I have Flex Builder 3, the current version of FB
that is being sold on Adobe's website, and it is the seventh one on the
list.  I think.

Go to Help-Product Details-Feature Details:
Flex Builder 3
Version: 3.0.205647

I used to think I had version 3.0.2.  Only now as I'm typing this post do I
realize that I misread that and if I go here:

Help-About Adobe Flex Builder 3...  Splash screen comes up and in the
bottom right:
Version 3.0 (build 3.0.1.205647)

Well that's a bit more obvious, isn't it.  It should be, I guess, but since
there was no 3.0 on the list I though they must have some weird numbering
that meant 3.0.205647 was actually 3.0.2 builder 05647.  Not a huge quibble,
but those version numbers need to be a bit more tightened up.

Addendum.  I just upgraded 

Re: [flexcoders] My frustrations with the Adobe Bug Report system

2008-12-19 Thread Pan Troglodytes
Thanks, Matt.  I always appreciate the official feedback on this unofficial
mailing list.  Hopefully you can find whoever is in charge of the build
numbers on the Feature Details box, too.

On Fri, Dec 19, 2008 at 1:11 PM, Matt Chotin mcho...@adobe.com wrote:

   Hi Jason,

 Thanks for your feedback. We probably could see if we could invest some
 time in making sure there are some explanations for the fields. And I agree
 that the sorted order of lots of fields is a nightmare. What you are running
 into is the fact that we have a lot of internal milestones and builds and
 therefore we want the bug system to be able to reflect those for internal
 purposes, but I wonder if there is any way we could provide a filter for
 just the public ones and sort by the most likely for you to encounter them.

 I'll see what we could do to maybe get some help links for some of the
 explanations. I don't know that we can explain every features, we may need
 you to just make your best guess, but at least for projects we can see what
 we need to do.

 Best,
 Matt


 On 12/19/08 10:55 AM, Pan Troglodytes 
 chimpathe...@gmail.comchimpathetic%40gmail.com
 wrote:

 I've put off writing this for a while out of laziness. Going out of my way
 to report bugs is already sort of outside of the scope of what I should be
 working on, but I consider it very important for the quality of the product.
 And it helps that my bugs are typically answered and fixed. But griping
 about the bug report system itself seemed a little too meta. Plus, I kept
 debating on whether I should file it as a bug or email it here or dig
 someone at Adobe's address up or what.

 So I've settled on this, here goes.

 Generally, the bug system works well. Yes, it can be a bit frustrating to
 find out if there's already a bug with the issue you're going to report.
 Yes, those old bugs imported from the old DB are maddening when the subject
 line makes you think they're the same. But all in all, it works ok. There
 are really only a few things that really bug me. Also, I'm sorry for the
 terrible pun.

 My main problem is with documentation. There needs to be some explanations
 as to what choices in the various combo boxes mean so that we, as users, can
 more intelligently give you feedback.

 Take for example the bug I'm about to enter. I found a bug in the compiler
 so that it's not parsing the code right. This happens both in Flex Builder
 and in mxmlc. I start out and it asks Project. I wasn't sure on the
 dropdown if it should be ActionScript Compiler (ASC) or Flex Builder. I
 finally figured out I could go through Browse Projects and click on
 individual projects to get descriptions of them, though not all of them had
 descriptions. Even after entering enough bugs to get a t-shirt, it took me
 this long to find that. There's plenty of room on that first page to have a
 list of the projects and a short paragraph defining the scope of the project
 so submitters can more eas! ily pick the project. FYI, I eventually decided
 on ActionScript Compiler.


 Next you have the Issue Type. If you click on the little help box, you get
 this help for feature requests versus minor enhancements:
 Feature Request A new feature to the product. Minor Enhancement A new
 enhancement to the product.
 I had a better idea about the difference between those two BEFORE I clicked
 on the help.

 No matter if you choose Bug, Feature Request or Minor Enhancement, you
 still get the same list of severities on the next page. So you can choose
 Bug-Enhancement/Task or you can choose Minor Enhancement-Crash Hang. I
 realize that this may just be a limitation of JIRA, but it's a little
 distracting. Along with this, minor enhancements get all the other boxes
 like Discoverability, Reproducibility, Regression, etc. that really don't
 apply to them. Feature requests don't get that, but then again there's the
 whole fuziness about the difference between those two things.

 Now you go on to choose the Component the bug is found in. I have never
 found a page that actually gives descriptions of the various components. And
 some of these leave me scratching my head. Much as with the projects, there
 should really be an easy way to get a sentence or three about each component
 so you can more easily decide where to put new bugs. Either that, or force
 all bugs to go to an unassigned component and let the bug reviewers sort
 it properly.

 None
 Future
 Player 10 - Code Complete
 Flex 4
 QVM 1 - Code Complete
 Flex 3 - Beta 2
 FP 9.2 - Code Complete
 FP 9.1.6 - Code Complete
 FP 9.1.5 - GMC Lockdown
 FP 9.1 - GMC
 Flash 9.0

 Erm... I'm using Flex Builder 3 and the compiler is barfing. Help?

 These are specific to each project, so I'm baffled why so many versions
 exist for the compiler when generally errors in it will happen before you
 ever get to the flash player.

 Of course, this is still probably better than the list of version that
 comes up when you choose the Flex Builder project:
 None

[flexcoders] Replacement Date class?

2008-12-02 Thread Pan Troglodytes
Now that the whole ECMAScript thing has blown over, Adobe is free of being
quite so bound to it as a standard.  They've expressed interest in doing
some things that they previously shied away from because of divergence from
the standard.

Is anyone else really interested in ditching the Date class?  That thing
drives me nuts.  The number one problem is that it's an object.  So you get
something like this:

var myDate:Date = new Date(2008, 1, 1);
var myDate2:Date = myDate;
...
myDate2.month++;

It's an easy mistake to miss, especially for beginners, and it can be very
annoying to track done.  It's also a pain that you can assign values to the
time, day, month, etc. properties and it screws up data bindings and
setters/getters.  For example, if I have:

private var myDate:Date;
[Bindable] public function set myDate(value:Date):void
{
  _myDate = value;
  invalidateDisplayList();
}
public function get myDate():Date
{
  return _myDate;
}

It works great until you do something like:
  myDate.time = newDate.time;
or
  myDate.date++;


Simliar difficulties exist when using a date dropdown control.

So is it time to get a new Date class?  Perhaps a new one called DateTime
and make the old one deprecated.

What I'd love is for it to be a new primitive type (like Number, int,
Boolean) that would be stored the same way as the time property of Date and
would be manipulated through static functions of the DateTime class.
Examples:

var myDate:DateTime = DateTime.now();
trace(myDate:, myDate);
 myDate: 1228248636245

myDate = DateTime.incHour(myDate);
myDate = DateTime.incMinute(myDate, 20);
myDate = DateTime.incMonth(myDate, -3);
myDate = DateTime.incHourUTC(myDate);
myDate = DateTime.encode(2008, 1, 1);
var hours:Number = DateTime.getHours(myDate2 - myDate1);

No more date or fullYear - use the much more intuitive day and
year.  I would also like month to be one-based, but that'd probably make
enough people grumble that I'd be willing to live without it.

I dream of seeing all the existing controls and such that use Date updated
to use this code instead.  I would have already created the DateTime class
if it wasn't for how much trouble daylight savings time, leap year and
internationalization would be.

-- 
Jason


[flexcoders] any overhead for calling simple getters?

2008-12-02 Thread Pan Troglodytes
If I have this:

private var _myvar:int;
public function get myvar():int
{
  return _myvar;
}

should I try to refer to it in other parts of the same class as _myvar, or
is myvar equally efficient?  In Delphi, you can define a property like:

FMyVar: Integer;
property MyVar:Integer read FMyVar;

and all references to MyVar automatically get optimized to FMyVar.  But I'm
wondering if Flex optimizes out the unnecessary function call represented
above.

-- 
Jason


Re: [flexcoders] Can you spare 5 minutes to reproduce this 12 line bug?

2008-11-19 Thread Pan Troglodytes
Just FYI for anyone reading, the bug has been reopened and the tester has
commented.  Apparently the problem was that they were alt-tabbing between
the flex app and flex builder to see the trace output.  Once I posted the
version that outputs the null to the screen, they reproduced it.  Chalk this
up to just providing a user-unfriendly test case.

Thanks Maciek and Tom.


On Wed, Nov 19, 2008 at 3:49 AM, Tom Chiverton [EMAIL PROTECTED]
 wrote:

 On Tuesday 18 Nov 2008, Pan Troglodytes wrote:
  Does anyone know if they read bugs that say resolved but have been
  updated?  Should I clone the bug as a new one?

 I added comments and a patch to a closed bug and it's been reopened
 (http://bugs.adobe.com/jira/browse/SDK-13940)

 --
 Tom Chiverton
 Helping to evangelistically facilitate content



 

 This email is sent for and on behalf of Halliwells LLP.

 Halliwells LLP is a limited liability partnership registered in England and
 Wales under registered number OC307980 whose registered office address is at
 Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB.  A
 list of members is available for inspection at the registered office. Any
 reference to a partner in relation to Halliwells LLP means a member of
 Halliwells LLP.  Regulated by The Solicitors Regulation Authority.

 CONFIDENTIALITY

 This email is intended only for the use of the addressee named above and
 may be confidential or legally privileged.  If you are not the addressee you
 must not read it and must not use any information contained in nor copy it
 nor inform any person other than Halliwells LLP or the addressee of its
 existence or contents.  If you have received this email in error please
 delete it and notify Halliwells LLP IT Department on 0870 365 2500.

 For more information about Halliwells LLP visit www.halliwells.com.

 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location:
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives:
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
 Links






-- 
Jason


[flexcoders] Can you spare 5 minutes to reproduce this 12 line bug?

2008-11-18 Thread Pan Troglodytes
I had a bug marked cannot reproduce, even though it's reproducible with a
12 line application for me.  It might help if a few others here will give it
a shot:

http://bugs.adobe.com/jira/browse/FLEXDMV-1908

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
  layout=vertical
  mouseMove=trace(getQualifiedClassName(getFocus()))
  mx:Script
![CDATA[
  import flash.utils.getQualifiedClassName;
]]
  /mx:Script
  mx:TextInput/
  mx:ColumnChart/
/mx:Application


Steps to reproduce:
1. Click on the app (not on one of the components) and move the mouse
around. You will see null output in the console.
2. Click on the chart and move the mouse around. You will see
mx.charts::ColumnChart output.
3. Click on the chart again and move the mouse around. You will see null
output.
4. Click on the text field and move the mouse around. You will see
mx.core::UITextField output.
5. Repeat from step 2.

...
Sudhir 
Manjunathhttp://bugs.adobe.com/jira/secure/ViewProfile.jspa?name=sudhirm-
[11/18/08
09:36 AM ] Cannot be reproduced. Tried in 2.0.1, 3.0.1 and
3.0.2.(build-214193).


-- 
Jason


Re: [flexcoders] Can you spare 5 minutes to reproduce this 12 line bug?

2008-11-18 Thread Pan Troglodytes
Not to worry.  Clearly the bug reporter couldn't reproduce it, so I'm not
shocked that someone else can't.  All I need is for some people who CAN
reproduce it to prove that my computer doesn't somehow magically work
differently than everyone else's.  But you do make me think of something -
maybe it's dependent on Flash Player 9 and the tester only used 10.  Will
have to try testing that.

On Tue, Nov 18, 2008 at 10:05 AM, Maciek Sakrejda [EMAIL PROTECTED]wrote:

   Hate to break it to you, but I can't repro either

 Flash Player 10,0,12,36 (debug)
 Firefox 3.0.4
 Ubuntu 8.10
 --
 Maciek Sakrejda
 Truviso, Inc.
 http://www.truviso.com


 -Original Message-
 From: Pan Troglodytes [EMAIL PROTECTED] chimpathetic%40gmail.com
 Reply-To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
 To: flexcoders flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
 Subject: [flexcoders] Can you spare 5 minutes to reproduce this 12 line
 bug?
 Date: Tue, 18 Nov 2008 09:45:42 -0600

 I had a bug marked cannot reproduce, even though it's reproducible
 with a 12 line application for me. It might help if a few others here
 will give it a shot:

 http://bugs.adobe.com/jira/browse/FLEXDMV-1908

 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 layout=vertical
 mouseMove=trace(getQualifiedClassName(getFocus()))
 mx:Script
 ![CDATA[
 import flash.utils.getQualifiedClassName;
 ]]
 /mx:Script
 mx:TextInput/
 mx:ColumnChart/
 /mx:Application

 Steps to reproduce:
 1. Click on the app (not on one of the components) and move the mouse
 around. You will see null output in the console.
 2. Click on the chart and move the mouse around. You will see
 mx.charts::ColumnChart output.
 3. Click on the chart again and move the mouse around. You will see
 null output.
 4. Click on the text field and move the mouse around. You will see
 mx.core::UITextField output.
 5. Repeat from step 2.

 ...
 Sudhir Manjunath - [11/18/08 09:36 AM ] Cannot be reproduced. Tried in
 2.0.1, 3.0.1 and 3.0.2. (build-214193).

 --
 Jason

  




-- 
Jason


Re: [flexcoders] Can you spare 5 minutes to reproduce this 12 line bug?

2008-11-18 Thread Pan Troglodytes
Good to hear it's not just me.  And on such a different system, as well.  I
updated the bug with my code for the simpler test version.

Does anyone know if they read bugs that say resolved but have been
updated?  Should I clone the bug as a new one?


On Tue, Nov 18, 2008 at 12:16 PM, Maciek Sakrejda [EMAIL PROTECTED]wrote:

   Actually, it looks like I *can* repro, even building from source. I'm
 not sure what is different between this time and the previous time doing
 it. Steps are even simpler:

 1. Click on chart, move mouse around (app traces out
 mx.charts::ColumnChart)
 2. Click on chart, move mouse again (app traces out null)

 I've added a comment to the ticket.


 --
 Maciek Sakrejda
 Truviso, Inc.
 http://www.truviso.com

 -Original Message-
 From: Pan Troglodytes [EMAIL PROTECTED] chimpathetic%40gmail.com
 Reply-To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
 To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
 Subject: Re: [flexcoders] Can you spare 5 minutes to reproduce this 12
 line bug?
 Date: Tue, 18 Nov 2008 11:59:11 -0600

 Well, I tried it on another machine (also running XP), with FP9 and the
 error count be reproduced. Upgraded to 10 on that machine, error could
 also be reproduced. So clearly it's not that. Could be the version of
 the player for Windows, maybe.

 I'm attaching the HTML/SWF to see if it reproduces if you use the SWF I
 generated.

 As such, I changed the code so that it has a text box (so you don't need
 to look at the console output). If you click on the chart twice in a
 row, you should see null in the bottom text box. Here's the new
 source:

 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 layout=vertical
 mouseMove=focusLbl.text = getQualifiedClassName(getFocus())
 click=focusLbl.text = getQualifiedClassName(getFocus())
 
 mx:Script
 ![CDATA[
 import flash.utils.getQualifiedClassName;
 ]]
 /mx:Script
 mx:TextInput/
 mx:ColumnChart/
 mx:Label id=focusLbl/
 /mx:Application

 On Tue, Nov 18, 2008 at 11:51 AM, Maciek Sakrejda
 [EMAIL PROTECTED] msakrejda%40truviso.com wrote:
 Right, that could certainly be it. Also, for what it's worth,
 I'm on
 Flex SDK 3.0.0.



 -Original Message-
 From: Pan Troglodytes [EMAIL PROTECTED] chimpathetic%40gmail.com
 Reply-To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com

 To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
 Subject: Re: [flexcoders] Can you spare 5 minutes to reproduce
 this 12
 line bug?


 Date: Tue, 18 Nov 2008 11:39:10 -0600

 Not to worry. Clearly the bug reporter couldn't reproduce it, so
 I'm
 not shocked that someone else can't. All I need is for some
 people who
 CAN reproduce it to prove that my computer doesn't somehow
 magically
 work differently than everyone else's. But you do make me think
 of
 something - maybe it's dependent on Flash Player 9 and the
 tester only
 used 10. Will have to try testing that.

 On Tue, Nov 18, 2008 at 10:05 AM, Maciek Sakrejda
 [EMAIL PROTECTED] msakrejda%40truviso.com wrote:
 Hate to break it to you, but I can't repro either

 Flash Player 10,0,12,36 (debug)
 Firefox 3.0.4
 Ubuntu 8.10
 --
 Maciek Sakrejda
 Truviso, Inc.
 http://www.truviso.com




 -Original Message-
 From: Pan Troglodytes [EMAIL PROTECTED] chimpathetic%40gmail.com
 Reply-To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
 To: flexcoders flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
 Subject: [flexcoders] Can you spare 5 minutes to reproduce this
 12 line
 bug?
 Date: Tue, 18 Nov 2008 09:45:42 -0600

 I had a bug marked cannot reproduce, even though it's
 reproducible
 with a 12 line application for me. It might help if a few others
 here
 will give it a shot:

 http://bugs.adobe.com/jira/browse/FLEXDMV-1908

 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 layout=vertical
 mouseMove=trace(getQualifiedClassName(getFocus()))
 mx:Script
 ![CDATA[
 import flash.utils.getQualifiedClassName;
 ]]
 /mx:Script
 mx:TextInput/
 mx:ColumnChart/
 /mx:Application

 Steps to reproduce:
 1. Click on the app (not on one of the components) and move the
 mouse
 around. You will see null output in the console.
 2. Click on the chart and move the mouse around. You will see
 mx.charts::ColumnChart output.
 3. Click on the chart again and move the mouse around. You will
 see
 null output.
 4. Click on the text field and move the mouse around. You will
 see
 mx.core::UITextField output.
 5. Repeat from step 2.

 ...
 Sudhir Manjunath - [11/18/08 09:36 AM ] Cannot be reproduced.
 Tried in
 2.0.1, 3.0.1 and 3.0.2. (build-214193).

 --
 Jason



 --
 Jason



 --
 Jason

  




-- 
Jason


[flexcoders] need some help with an effect I made and its glitches

2008-11-14 Thread Pan Troglodytes
I'm fairly new to making effects, and it's a miracle I have any hair left.
I have created the following effect so that I can transition between various
states of a component.  The problem is that I want to reuse the same
component and not make a new one for every different screen.  So I'm making
a bitmap snapshot, sliding that one out of the way and sliding in the new
one behind it.

I have two problems.  Well, probably more once you read this code, as it's
kinda hacked together.  But the two problems that happen are:
1) when the effect starts, the original box disappears then reappears. bad
flicker.
2) when the effect ends, there is a slight hitch at the end that makes it
look jumpy

Any tips on how I can fix these two problems, or any comments on other
errors in the code?  Thanks.

Slide.as:
/
package nes.effects
{
  import flash.display.DisplayObject;
  import flash.display.DisplayObjectContainer;

  import mx.containers.Canvas;
  import mx.effects.Effect;
  import mx.effects.IEffectInstance;
  import mx.events.EffectEvent;

  import nes.effects.effectClasses.SlideInstance;

  public class Slide extends Effect
  {
public function Slide(target:Object=null)
{
  super(target);
  instanceClass = SlideInstance;
}

override public function getAffectedProperties():Array
{
  return [parent, x, y];
}

override protected function initInstance(instance:IEffectInstance) :
void
{
  super.initInstance(instance);
}

  }  // end class
}  // end package
/

SlideInstance.as:
/
package nes.effects.effectClasses
{
  import flash.display.Bitmap;
  import flash.display.BitmapData;
  import flash.display.DisplayObject;
  import flash.display.DisplayObjectContainer;

  import mx.containers.Canvas;
  import mx.controls.SWFLoader;
  import mx.effects.EffectInstance;
  import mx.effects.Tween;
  import mx.effects.easing.Bounce;

  public class SlideInstance extends EffectInstance
  {
public var before:DisplayObject;
private var canvas:Canvas;
private var tween:Tween;

public function SlideInstance(target:Object)
{
  super(target);
}

private function createSnapshot(screen:DisplayObject):SWFLoader
{
  var originalImage:BitmapData = new BitmapData(screen.width,
screen.height, true, 0);
  originalImage.draw(screen);
  var bmp:Bitmap = new Bitmap(originalImage);
  var loader:SWFLoader = new SWFLoader;
  loader.width = screen.width;
  loader.height = screen.height;
  loader.addChild(bmp);
  return loader;
}

private var targetPercentHeight:Number;
private var targetPercentWidth:Number;

override public function play():void
{
  before = createSnapshot(DisplayObject(target));

  var dt:DisplayObject = DisplayObject(target);
  var tp:DisplayObjectContainer = dt.parent;
  var i:int = dt.parent.getChildIndex(dt);

  canvas = new Canvas;
  canvas.height = dt.height;
  canvas.width = dt.width;
  canvas.x = dt.x;
  canvas.y = dt.y;
  canvas.horizontalScrollPolicy = off;
  canvas.verticalScrollPolicy = off;
  canvas.autoLayout = false;

  before.y = 0;
  before.x = 0;

  dt.y = canvas.height;
  dt.x = 0;

  targetPercentHeight = target.percentHeight;
  targetPercentWidth = target.percentWidth;
  target.height = target.height;
  target.width = target.width;

  canvas.addChild(before);
  canvas.addChild(dt);

  tp.addChildAt(canvas, i);

  tween = new Tween(this, canvas.height, 0, duration, -1, tweenUpdate,
tweenEnd);
  //tween.easingFunction = Bounce.easeOut;

  super.play();
}

private function tweenUpdate(currentValue:Number):void
{
  before.y = currentValue - before.height;
  DisplayObject(target).y = currentValue;
}

private function tweenEnd(currentValue:Number):void
{
  end();
}

override public function finishEffect():void
{
  var cp:DisplayObjectContainer = canvas.parent;
  var i:int = cp.getChildIndex(canvas);
  var dt:DisplayObject = DisplayObject(target);
  cp.removeChild(canvas);
  target.percentHeight = targetPercentHeight;
  target.percentWidth = targetPercentWidth;
  cp.addChildAt(dt, i);
  canvas = null;

  super.finishEffect();
}
  }
}
/

SlideTest.mxml:
/
?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=vertical
  paddingRight=0
  paddingLeft=0
  paddingTop=0
  paddingBottom=0
  
  mx:Script
![CDATA[
  import nes.effects.Slide;
  private function slideit():void
  {
var slide:Slide = new Slide(box);
ac.selectedIndex = 

[flexcoders] threading, forcing code to run in the main thread, URLLoader, etc.

2008-11-12 Thread Pan Troglodytes
I've read that Flash Player runs flex code single threaded, with the
exception of network calls and rendering calls.  So if I have a URLLoader
and I add an event to it for COMPLETE, does that event handler code get run
in the main thread, or in a separate networking thread?

If it's a separate thread, is there a way to run it in the main thread?

I'm doing some work with the f-in-box component and trying to sort out some
strange problems I'm getting.  I will go further into it if necessary, but
since most people here don't use it I was thinking a more abstracted
question would be more helpful.

-- 
Jason


Re: [flexcoders] Re: Accessing *other* browser plugins from Flash

2008-10-26 Thread Pan Troglodytes
You might find this informative:

http://www.f-in-box.com/forum/viewtopic.php?t=509sid=43cc9bffc200ae813c56c988b3b777ad

The examples are in Delphi for the f-in-box component, but the explanations
of ExternalInterface invoke strings might be helpful.

On Wed, Oct 15, 2008 at 4:16 PM, Eric Cooper [EMAIL PROTECTED] wrote:

   Yes. A little further outside the box than my charter would allow at
 this point.

 Thanks, Tracy and Josh, for replies. I will read up on ExternalInterface.

 -eric


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Tracy
 Spratt [EMAIL PROTECTED] wrote:
 
  Now *that's* thinking outside the box!
 
  Tracy
 
 
 
  
 
  From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com [mailto:
 flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] On
  Behalf Of Josh McDonald
  Sent: Tuesday, October 14, 2008 6:02 PM
  To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
  Subject: Re: [flexcoders] Accessing *other* browser plugins from Flash
 
 
 
  Why not embed Player inside your a C++ app and bypass the browser
  entirely?
 
  On Wed, Oct 15, 2008 at 5:39 AM, Tracy Spratt [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED]  wrote:
 
  You can explicitly allow swf scripting in the html wrapper. It might
  take bit to get the security side handled, but it is doable.
 
 
 
  You would actually control/communicate with the other objects by
  scripting them using javascript and ExternalInterface.
 
 
 
  Tracy
 
 
 
  
 
  From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com mailto:
 flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
  [mailto:flexcoders@yahoogroups.com flexcoders%40yahoogroups.commailto:
 flexcoders@yahoogroups.com flexcoders%40yahoogroups.com ]
  On Behalf Of Eric Cooper
  Sent: Tuesday, October 14, 2008 3:05 PM
  To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com mailto:
 flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
  Subject: [flexcoders] Accessing *other* browser plugins from Flash
 
 
 
  Hi,
 
  I have access to some powerful C++ functionality. Porting this to
  ActionScript is not an
  option. However, it looks like I could create a browser plugin that
  would wrap the C++ code.
 
  I am looking for pointers, caveats or advice on how to proceed.
 
  The obvious question is: can a .swf call out to another browser plugin
  or is this prevented by
  the security sandbox of all browsers?
 
  And the followup: if this is possible, how?
 
  Thanks in advance!
 
  -Eric
 
 
 
 
  --
  Therefore, send not to know For whom the bell tolls. It tolls for
  thee.
 
  Like the cut of my jib? Check out my Flex blog!
 
  :: Josh 'G-Funk' McDonald
  :: 0437 221 380 :: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
  :: http://flex.joshmcdonald.info/ http://flex.joshmcdonald.info/
 

  




-- 
Jason


Re: [flexcoders] what is a String? (default encoding question)

2008-10-21 Thread Pan Troglodytes
Thousands of rows of columnar data.

Doesn't really matter, though.  The help for both readUTF and readMultiByte
says:

Returns
String — UTF-8 encoded string.

So no matter what I do, it appears the ByteArray can only return UTF-8
anyway.  Considering this, I might as well write it to the file in UTF-8.
Of course, I suppose that internally ByteArray could read it in as something
different, then convert it to UTF-8.  So that it would read my UTF-8,
convert it to something else, then convert it back to UTF-8 and return it.
That would suck but it's impossible to tell without input from the people
who can actually see that code.  Always frustrating when I bump up against
the wall where open source becomes closed.


On Tue, Oct 21, 2008 at 6:09 AM, Tom Chiverton [EMAIL PROTECTED]
 wrote:

 On Friday 17 Oct 2008, Pan Troglodytes wrote:
  The reason I ask is because I'm reading some string data in from a binary
  file and

 Some ?
 A large amount ? How large ?

 --
 Tom Chiverton
 Helping to centrally deploy high-end dynamic fourth-generation open-source
 action-items



 

 This email is sent for and on behalf of Halliwells LLP.

 Halliwells LLP is a limited liability partnership registered in England and
 Wales under registered number OC307980 whose registered office address is at
 Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB.  A
 list of members is available for inspection at the registered office. Any
 reference to a partner in relation to Halliwells LLP means a member of
 Halliwells LLP.  Regulated by The Solicitors Regulation Authority.

 CONFIDENTIALITY

 This email is intended only for the use of the addressee named above and
 may be confidential or legally privileged.  If you are not the addressee you
 must not read it and must not use any information contained in nor copy it
 nor inform any person other than Halliwells LLP or the addressee of its
 existence or contents.  If you have received this email in error please
 delete it and notify Halliwells LLP IT Department on 0870 365 2500.

 For more information about Halliwells LLP visit www.halliwells.com.

 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location:
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives:
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
 Links







-- 
Jason


Re: [flexcoders] what is a String? (default encoding question)

2008-10-18 Thread Pan Troglodytes
Do you mind asking around?  I'd hate to base my conclusions on timing tests
rather than just being told by the people who write the code.  Thanks!

On Fri, Oct 17, 2008 at 7:08 PM, Gordon Smith [EMAIL PROTECTED] wrote:

I think AS3 uses UTF-16 internally, but I'm not sure about that, and it
 might change in the future. I suggest that you do some timing tests to see
 what's fastest.



 - Gordon



 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Pan Troglodytes
 *Sent:* Friday, October 17, 2008 12:49 PM
 *To:* flexcoders
 *Subject:* [flexcoders] what is a String? (default encoding question)



 How is a string represented internally in Flex?  It never actually says it
 in the help for String.  Is it UTF-8?  I think this because because mxml
 uses utf-8 as the encoding in the ?xml directive, ByteArray seems to treat
 utf-8 specially, and ByteArray.readMultiByte says the return value is a
 utf-8 encoded string.

 The reason I ask is because I'm reading some string data in from a binary
 file and I'm trying to figure out the most CPU efficient way to put it in
 the file.  I want it to be in the file in the same encoding that won't
 require Flex to translate from one encoding to another when storing it in a
 String variable.

 Thanks.

 --
 Jason

   




-- 
Jason


[flexcoders] what is a String? (default encoding question)

2008-10-17 Thread Pan Troglodytes
How is a string represented internally in Flex?  It never actually says it
in the help for String.  Is it UTF-8?  I think this because because mxml
uses utf-8 as the encoding in the ?xml directive, ByteArray seems to treat
utf-8 specially, and ByteArray.readMultiByte says the return value is a
utf-8 encoded string.

The reason I ask is because I'm reading some string data in from a binary
file and I'm trying to figure out the most CPU efficient way to put it in
the file.  I want it to be in the file in the same encoding that won't
require Flex to translate from one encoding to another when storing it in a
String variable.

Thanks.

-- 
Jason


Re: [flexcoders] force SeriesInterpolate on BubbleSeries to preserve bubble order?

2008-10-13 Thread Pan Troglodytes
Well, it's been a while but I've finally been able to get back to this.
Unfortunately, there are cases where this simply won't work.  For example:

  [Bindable] public var d:ArrayCollection = new ArrayCollection([
  new ArrayCollection([
{x:1, y:1, z:10},
{x:2, y:2, z:20},
{x:3, y:3, z:30},
]),
  new ArrayCollection([
{x:1, y:1, z:20},
{x:2, y:2, z:30},
{x:3, y:3, z:10},
])
]);

There is no way you can rearrange the second data such that it won't screw
up one of the bubbles.

I think I'm just going to have to get in there and hack at it to make it
stop trying it's smart bubble rearranging.


On Thu, Sep 25, 2008 at 2:36 AM, Cosmin Cojocar [EMAIL PROTECTED] wrote:

   Hello Jason,

 Here is a good code for what you want:

 ?xml version=1.0 encoding=utf-8?
 mx:WindowedApplication xmlns:mx=http://www.adobe.com/2006/mxml;
 layout=absolute
 mx:Script
 ![CDATA[
   import mx.collections.ArrayCollection;
   [Bindable] public var d:ArrayCollection = new ArrayCollection([
   new ArrayCollection([
 {x:1, y:1, z:10},
 {x:2, y:2, z:20},
 {x:3, y:3, z:30},
 ]),
   new ArrayCollection([
 {x:2, y:2, z:20},
 {x:1, y:1, z:20},
 {x:3, y:3, z:30},
 ])
 ]);

   [Bindable] public var i:int = 0;
 ]]
   /mx:Script

   mx:SeriesInterpolate id=interp /

   mx:BubbleChart
 mx:series
   mx:BubbleSeries id=series1 xField=x yField=y radiusField=z
 creationComplete=series1.dataProvider = d[0] showDataEffect={interp}
   mx:fills
   mx:SolidColor color=red/
   mx:SolidColor color=green/
   mx:SolidColor color=blue/
 /mx:fills
   /mx:BubbleSeries


 /mx:series
   /mx:BubbleChart
   mx:HBox
 mx:Button label=lt; click=i--; series1.dataProvider = d[i]
 enabled={i != 0}/
 mx:Button label= click=i++; series1.dataProvider = d[i]
 enabled={i != d.length - 1}/
   /mx:HBox
 /mx:WindowedApplication

Explication:

   Your order is sorted according to Z field and after that the
 colors are attributed. So when you change the z value for (1,1) element this
 will be second value from red ball (3,3) not (2,2) because the order is made
 according to z value.

 *I also attached a small graphic explication in order.pdf (order
 matters) file.

  *I hope that is what you want. Have a nice day.

 Regards,
 Cosmin
















 On Tue, Sep 23, 2008 at 12:01 AM, Pan Troglodytes [EMAIL PROTECTED]wrote:

   Following is a simplified example of what I'm running into.  Basically,
 BubbleSeries doesn't preserve the order of the bubbles when you switch the
 dataprovider.  Run the following program and click the left and right
 buttons.

 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 layout=vertical
mx:Script
 ![CDATA[
   import mx.collections.ArrayCollection;
   [Bindable] public var d:ArrayCollection = new ArrayCollection([
   new ArrayCollection([
 {x:1, y:1, z:10},
 {x:2, y:2, z:20},
 {x:3, y:3, z:30},
 ]),
   new ArrayCollection([
 {x:1, y:1, z:20},
 {x:2, y:2, z:20},
 {x:3, y:3, z:30},
 ])
 ]);

   [Bindable] public var i:int = 0;
 ]]
   /mx:Script

   mx:SeriesInterpolate id=interp /

   mx:BubbleChart
  mx:series
   mx:BubbleSeries id=series1 xField=x yField=y radiusField=z
 creationComplete=series1.dataProvider = d[0] showDataEffect={interp}
  mx:fills
   mx:SolidColor color=red/
   mx:SolidColor color=green/
   mx:SolidColor color=blue/
 /mx:fills
   /mx:BubbleSeries


 /mx:series
   /mx:BubbleChart
   mx:HBox
 mx:Button label=lt; click=i--; series1.dataProvider = d[i]
 enabled={i != 0}/
  mx:Button label= click=i++; series1.dataProvider = d[i]
 enabled={i != d.length - 1}/
   /mx:HBox
 /mx:Application

 What happens is that the blue bubble swaps places with the green bubble
 and then grows to the size of the green bubble.  What I want is for the blue
 bubble to just grow in place and have the green bubble stay put.  Is there
 some way I'm missing to tell the chart to pay attention to the order of the
 data?  I thought maybe it had something to do with transitionRenderData, but
 the documentation on it is rather ... brief.

 --
 Jason


  




-- 
Jason


[flexcoders] function to get a color uint value from a color name string?

2008-10-13 Thread Pan Troglodytes
Is there a function somewhere that takes something like red as input and
returns 0xFF?  I've looked all over in the docs and can't find it.

Thanks.

-- 
Jason


Re: [flexcoders] function to get a color uint value from a color name string?

2008-10-13 Thread Pan Troglodytes
Ironically, this was the one class I skipped and meant to come back to while
really casting about for anything that might even be close.  Thanks!

On Mon, Oct 13, 2008 at 2:54 PM, Gordon Smith [EMAIL PROTECTED] wrote:

The badly-named StyleManager.getColorName() method.



 - Gordon



 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Pan Troglodytes
 *Sent:* Monday, October 13, 2008 12:50 PM
 *To:* flexcoders
 *Subject:* [flexcoders] function to get a color uint value from a color
 name string?



 Is there a function somewhere that takes something like red as input and
 returns 0xFF?  I've looked all over in the docs and can't find it.

 Thanks.

 --
 Jason

   




-- 
Jason


[flexcoders] using callLater with setter?

2008-10-10 Thread Pan Troglodytes
Is there some way to use callLater to set a property that has a setter?  So
far, all I can think of is to create a dummy function that does the setting
and pass it in the callLater:

private function setSelectedChild(viewStack:ViewStack,
newChild:Container):void
{
  viewStack.selectedChild = newChild;
}

...

callLater(setSelectedChild, [someBox]);


Any better way to do it?

-- 
Jason


Re: [flexcoders] using callLater with setter?

2008-10-10 Thread Pan Troglodytes
Thanks Mike, but that's really what I was trying to avoid.  That's the same
as my example, only the function is anonymous instead.  I thought maybe
there was some way to get Flex to realize I wanted the setter function, not
the property.

On Fri, Oct 10, 2008 at 11:30 AM, Michael Schmalle
[EMAIL PROTECTED]wrote:

   Hi,
 This works, I tested it;

 callLater(function (stack:ViewStack, container:Container):void {
 stack.selectedChild = container;
 }, [viewStack, someBox]);


 Mike


 On Fri, Oct 10, 2008 at 12:10 PM, Pan Troglodytes [EMAIL PROTECTED]wrote:

   Is there some way to use callLater to set a property that has a
 setter?  So far, all I can think of is to create a dummy function that does
 the setting and pass it in the callLater:

 private function setSelectedChild(viewStack:ViewStack,
 newChild:Container):void
 {
   viewStack.selectedChild = newChild;
 }

 ...

 callLater(setSelectedChild, [someBox]);


 Any better way to do it?

 --
 Jason




 --
 Teoti Graphix, LLC
 http://www.teotigraphix.com

 Teoti Graphix Blog
 http://www.blog.teotigraphix.com

 You can find more by solving the problem then by 'asking the question'.
  




-- 
Jason


[flexcoders] any way to integrate 3rd-party help into FB?

2008-10-06 Thread Pan Troglodytes
I'm been hunting around to no avail on this question.  I have created help
for my components using ASDOC.  What's the recommended procedure to get that
help to show up in FB?  Is there one?

Thanks.

-- 
Jason


Re: [flexcoders] any way to integrate 3rd-party help into FB?

2008-10-06 Thread Pan Troglodytes
Michael - Thanks for the response, but I'm a little confused on what it is
you're suggesting.  Could you give a little more explanation on the steps to
do this, from the standpoint of someone who only has FB on their machine
right now?

Will this make your help show up in the context-sensitive help and search
results as well, or only in the contents page?  Is there also a way to make
your help fully linked in, so that that objects in your help like
UIComponent or EventDispatcher can be clicked on to link to the main help?

Thanks!

On Mon, Oct 6, 2008 at 1:19 PM, Michael Schmalle [EMAIL PROTECTED]wrote:

   Hi Jason,
 Eclipse plugin project with a plugin.xml like


 ?xml version=1.0 encoding=UTF-8?
 ?eclipse version=3.2?
 plugin

extension
  point=org.eclipse.help.toc
   toc
 file=toc.xml primary=true
   /toc
/extension

 /plugin


 This is the only way you will get it to show up as a 'book' in the FB help.

 I've done it and it works great, you can even create an update site, that
 can keep the docs fresh.

 You need the PDE plugin to create a plugin. I use a different version of
 eclipse (not FB) to create plugins.

 See the Creating a plugin using the help extension point (in the PDE docs).
  This might be worthy of a blog post someday. :)

 Mike

 On Mon, Oct 6, 2008 at 12:15 PM, Pan Troglodytes [EMAIL PROTECTED]wrote:

   I'm been hunting around to no avail on this question.  I have created
 help for my components using ASDOC.  What's the recommended procedure to get
 that help to show up in FB?  Is there one?

 Thanks.

 --
 Jason




 --
 Teoti Graphix, LLC
 http://www.teotigraphix.com

 Teoti Graphix Blog
 http://www.blog.teotigraphix.com

 You can find more by solving the problem then by 'asking the question'.
  




-- 
Jason


[flexcoders] force SeriesInterpolate on BubbleSeries to preserve bubble order?

2008-09-22 Thread Pan Troglodytes
Following is a simplified example of what I'm running into.  Basically,
BubbleSeries doesn't preserve the order of the bubbles when you switch the
dataprovider.  Run the following program and click the left and right
buttons.

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=vertical
  mx:Script
![CDATA[
  import mx.collections.ArrayCollection;
  [Bindable] public var d:ArrayCollection = new ArrayCollection([
  new ArrayCollection([
{x:1, y:1, z:10},
{x:2, y:2, z:20},
{x:3, y:3, z:30},
]),
  new ArrayCollection([
{x:1, y:1, z:20},
{x:2, y:2, z:20},
{x:3, y:3, z:30},
])
]);

  [Bindable] public var i:int = 0;
]]
  /mx:Script

  mx:SeriesInterpolate id=interp /

  mx:BubbleChart
mx:series
  mx:BubbleSeries id=series1 xField=x yField=y radiusField=z
creationComplete=series1.dataProvider = d[0] showDataEffect={interp}
mx:fills
  mx:SolidColor color=red/
  mx:SolidColor color=green/
  mx:SolidColor color=blue/
/mx:fills
  /mx:BubbleSeries


/mx:series
  /mx:BubbleChart
  mx:HBox
mx:Button label=lt; click=i--; series1.dataProvider = d[i]
enabled={i != 0}/
mx:Button label= click=i++; series1.dataProvider = d[i]
enabled={i != d.length - 1}/
  /mx:HBox
/mx:Application

What happens is that the blue bubble swaps places with the green bubble and
then grows to the size of the green bubble.  What I want is for the blue
bubble to just grow in place and have the green bubble stay put.  Is there
some way I'm missing to tell the chart to pay attention to the order of the
data?  I thought maybe it had something to do with transitionRenderData, but
the documentation on it is rather ... brief.

-- 
Jason


[flexcoders] possible to get bytes from a pre-existing Image?

2008-09-17 Thread Pan Troglodytes
This question is really part of a larger ball of stuff I'm trying to
untangle.  Basically, the first part is that if I have this:

[Embed(source=logo.png)] public var logo:Class;
...
var img:Image = new Image;
img.source = logo;

Is there any way to get a ByteArray from img that can be fed to Loader?
Unfortunately, I'm stuck with Loader.  If you really want to know, I'm
trying to mess with a TextArea that has htmlText with an img tag in it.  I
want to switch the img tag to switch between different images that are
embedded in the SWF. As far as I can tell, there's no way to tell an img
tag to load an image out of the SWF.  Feel free to correct me on that.
Because of some features of the environment, I really want to embed the
images and not load them from the local file system or over the network.

Eventually, I actually want to replace the PNG with an SVG.  This is part of
why I'm wanting to have the files embedded.  But I know this will bring
further challenges, as SVG is a vector format and I will have to get a
raster rendering of the SVG at a certain size before I can ever expect to
feed it to Loader.  But I'm trying to take it one giant hurdle at a time.

Any thoughts, other than that I'm insane to do such a thing?

-- 
Jason


Re: [flexcoders] possible to get bytes from a pre-existing Image?

2008-09-17 Thread Pan Troglodytes
Excellent tip!

Well, here's what I'm trying to do.  I have logos for various companies
embedded in my SWF.  I also have various graphs where the logos will be
shown in the datatip popup.  The contents of this datatip are returned in an
SQL statement.  Why SQL?  Because this is an easy place my boss can change
the stuff so he can play with different wordings and layouts without having
me compile the Flex app every time.

So he might change the query to:

select tip = 'Results for logo' from ...
or
select tip = company_name + 'brlogobr$' + convert(varchar, sales)

That's not exactly it, but you get the drift.  I want to be able to replace
logo with the appropriate logo for the company for the point on the
graph.  It may appear anywhere in the tip text.  He could also put whatever
html markup he wanted in the tip text.

Seems to me the easiest and most flexible way would be to use a TextArea or
similiar and set the htmlText property.  But of course I need to fill in
logo with whatever the correct logo image is.  I want these images to be
embedded in the SWF, so I can't just use img src='http://server/logo.png',
etc.

So what I have done is replace logo with img id='logo' src=''.  So an
example would be:

Footronicsbrimg id='logo'br$123456

I might even go back and take out that step and just have the boss put in
img id='logo' src='' in the first place.  That way he can control
height/width if he wants to.

Right now, I've got only as far as using a TextArea to try to work out how
to do this.  If I assign the above to htmlText, I get an ioerror.  So I set
up a handler to cloak that.  And using your tip, I find that I can
successfully do this:

var ba:ByteArrayAsset = ByteArrayAsset(new logo);

for (var i:int = 0; i  testtext.numChildren; i++)
{
  var o:DisplayObject = testtext.getChildAt(i);
  if (o is UITextField)
  {
var r:Loader = UITextField(o).getImageReference(logo) as Loader;

r.loadBytes(ba);
  }
}

Wonderful!

Well, sort of.  As I said, what I'd really like to use is SVGs.  This method
doesn't work very well with them, I'm sure due to the same problem that
forces you to only be able to use SVGs when they are embedded.  If you try
to use an SVG, you just get a continuous stream in the console log of

[SWF] C:\Documents and Settings\\My Documents\Flex Builder
3\...\bin-debug\.swf - 0 bytes after decompression

Over and over again.  Bother.  I suspect that may sink the whole
ByteArrayAsset approach.  Because I suspect I will have to embed the SVG,
then later create an object that will get make a bitmap version, THEN have
the Loader object load the bytes from it.  Somehow.  If it's even possible.

Unless someone else has a suggestion for a better way to let my boss be able
to type in all this formatted html with embedded logos that are in SVG
format.


On Wed, Sep 17, 2008 at 5:13 PM, Jim Hayes [EMAIL PROTECTED] wrote:


 I as far as I can work out

 [Embed(source=logo.png, mimeType=application/octet-stream)] public var
 logo:Class;

 would enable you to access logo as a bytearray.

 I hope that helps? I'm still not really quite sure what you're trying to
 do, to be honest.

 Anyway, you might want to have a look at this :

 http://dispatchevent.org/roger/embed-almost-anything-in-your-swf/

 which I think might be at least along the lines of what you want to know,
 apologies in advance if I've got the wrong end of the stick.


 -Original Message-
 From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com [mailto:
 flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] On Behalf Of
 Pan Troglodytes
 Sent: 17 September 2008 22:26
 To: flexcoders
 Subject: [flexcoders] possible to get bytes from a pre-existing Image?

 This question is really part of a larger ball of stuff I'm trying to
 untangle.  Basically, the first part is that if I have this:

 [Embed(source=logo.png)] public var logo:Class;
 ...
 var img:Image = new Image;
 img.source = logo;

 Is there any way to get a ByteArray from img that can be fed to Loader?
 Unfortunately, I'm stuck with Loader.  If you really want to know, I'm
 trying to mess with a TextArea that has htmlText with an img tag in it.  I
 want to switch the img tag to switch between different images that are
 embedded in the SWF. As far as I can tell, there's no way to tell an img
 tag to load an image out of the SWF.  Feel free to correct me on that.
 Because of some features of the environment, I really want to embed the
 images and not load them from the local file system or over the network.

 Eventually, I actually want to replace the PNG with an SVG.  This is part
 of why I'm wanting to have the files embedded.  But I know this will bring
 further challenges, as SVG is a vector format and I will have to get a
 raster rendering of the SVG at a certain size before I can ever expect to
 feed it to Loader.  But I'm trying to take it one giant hurdle at a time.

 Any thoughts, other than that I'm insane to do such a thing?

 --
 Jason

Re: [flexcoders] possible to get bytes from a pre-existing Image?

2008-09-17 Thread Pan Troglodytes
Alex - did part of your reply get chopped off?  I'm not quite understanding.

On Wed, Sep 17, 2008 at 6:51 PM, Alex Harui [EMAIL PROTECTED] wrote:

It might be a subclass of Bitmap



 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Jim Hayes
 *Sent:* Wednesday, September 17, 2008 3:13 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* RE: [flexcoders] possible to get bytes from a pre-existing
 Image?




 I as far as I can work out

 [Embed(source=logo.png, mimeType=application/octet-stream)] public var
 logo:Class;

 would enable you to access logo as a bytearray.

 I hope that helps? I'm still not really quite sure what you're trying to
 do, to be honest.

 Anyway, you might want to have a look at this :

 http://dispatchevent.org/roger/embed-almost-anything-in-your-swf/

 which I think might be at least along the lines of what you want to know,
 apologies in advance if I've got the wrong end of the stick.

 -Original Message-
 From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com [mailto:
 flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] On Behalf Of
 Pan Troglodytes
 Sent: 17 September 2008 22:26
 To: flexcoders
 Subject: [flexcoders] possible to get bytes from a pre-existing Image?

 This question is really part of a larger ball of stuff I'm trying to
 untangle.  Basically, the first part is that if I have this:

 [Embed(source=logo.png)] public var logo:Class;
 ...
 var img:Image = new Image;
 img.source = logo;

 Is there any way to get a ByteArray from img that can be fed to Loader?
 Unfortunately, I'm stuck with Loader.  If you really want to know, I'm
 trying to mess with a TextArea that has htmlText with an img tag in it.  I
 want to switch the img tag to switch between different images that are
 embedded in the SWF. As far as I can tell, there's no way to tell an img
 tag to load an image out of the SWF.  Feel free to correct me on that.
 Because of some features of the environment, I really want to embed the
 images and not load them from the local file system or over the network.

 Eventually, I actually want to replace the PNG with an SVG.  This is part
 of why I'm wanting to have the files embedded.  But I know this will bring
 further challenges, as SVG is a vector format and I will have to get a
 raster rendering of the SVG at a certain size before I can ever expect to
 feed it to Loader.  But I'm trying to take it one giant hurdle at a time.

 Any thoughts, other than that I'm insane to do such a thing?

 --
 Jason


 __
 This communication is from Primal Pictures Ltd., a company registered in
 England and Wales with registration No. 02622298 and registered office: 4th
 Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK.
 VAT registration No. 648874577.

 This e-mail is confidential and may be privileged. It may be read, copied
 and used only by the intended recipient. If you have received it in error,
 please contact the sender immediately by return e-mail or by telephoning
 +44(0)20 7637 1010. Please then delete the e-mail and do not disclose its
 contents to any person.
 This email has been scanned for Primal Pictures by the MessageLabs Email
 Security System.
 __

   




-- 
Jason


Re: [flexcoders] possible to get bytes from a pre-existing Image?

2008-09-17 Thread Pan Troglodytes
Well, for one thing, the program is a bit up in the air on final
specifications.  Sometimes it's running off the network, other times it's
running locally.  It's just very handy to move around one single SWF and not
have to drag along all the various logos.  It's also handy for the SWF to
have a builtin list of possible logos to use.  I admit that part of the
reason is just to see if I could, and therefore to add to the toolbox of
abilities I have.

And I'm pleased to announce that I have succeeded!

There might be a better way to do it, but what I'm doing now is this:

var svg:DisplayObject = new logo;
var bd:BitmapData = new BitmapData(svg.width, svg.height);
bd.draw(svg);
var ba:ByteArray = new PNGEncoder().encode(bd);

for (var i:int = 0; i  testtext.numChildren; i++)
{
  var o:DisplayObject = testtext.getChildAt(i);
  if (o is UITextField)
  {
var r:Loader = UITextField(o).getImageReference(logo) as
Loader;
r.loadBytes(ba);
  }
}

There's the minor issue of resizing the svg before converting it to a
bitmap.  But I've made some progress on doing that.  And I'll probably
subclass Text or some component so I can get at textField without having to
iterate through the children.

Thanks to everyone for their help, and I look forward to hearing any further
suggestions, tips or mockery.  ;)

I'll try to write up a more complete example for posterity and post it as a
followup.


On Wed, Sep 17, 2008 at 10:48 PM, Alex Harui [EMAIL PROTECTED] wrote:

I was just thinking that if you didn't specify mimeType, it would give
 you a Bitmap subclass and you wouldn't need to loadbytes it.



 But it looks to me that your main issue is trying to get embedded images
 into a TextField's htmlText, and I can't think of any way to pull that off.
 If you know it is just going to be simple html and an icon, you might just
 parse the html and generate instances of widgets.  See the HTML and Flex
 post on my blog



 But easiest would be to not embed the logos and let the TextField load
 them.  I'm not sure why you want to embed the logos.  Depending on their
 size and quantity and what percentage of them get actually used, it might be
 better to get them over http.  After the first fetch it should be in their
 browser cache.



 -Alex



 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Pan Troglodytes
 *Sent:* Wednesday, September 17, 2008 6:25 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* Re: [flexcoders] possible to get bytes from a pre-existing
 Image?



 Alex - did part of your reply get chopped off?  I'm not quite
 understanding.

 On Wed, Sep 17, 2008 at 6:51 PM, Alex Harui [EMAIL PROTECTED] wrote:

 It might be a subclass of Bitmap



 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Jim Hayes
 *Sent:* Wednesday, September 17, 2008 3:13 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* RE: [flexcoders] possible to get bytes from a pre-existing
 Image?




 I as far as I can work out

 [Embed(source=logo.png, mimeType=application/octet-stream)] public var
 logo:Class;

 would enable you to access logo as a bytearray.

 I hope that helps? I'm still not really quite sure what you're trying to
 do, to be honest.

 Anyway, you might want to have a look at this :

 http://dispatchevent.org/roger/embed-almost-anything-in-your-swf/

 which I think might be at least along the lines of what you want to know,
 apologies in advance if I've got the wrong end of the stick.

 -Original Message-
 From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com [mailto:
 flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] On Behalf Of
 Pan Troglodytes
 Sent: 17 September 2008 22:26
 To: flexcoders
 Subject: [flexcoders] possible to get bytes from a pre-existing Image?

 This question is really part of a larger ball of stuff I'm trying to
 untangle.  Basically, the first part is that if I have this:

 [Embed(source=logo.png)] public var logo:Class;
 ...
 var img:Image = new Image;
 img.source = logo;

 Is there any way to get a ByteArray from img that can be fed to Loader?
 Unfortunately, I'm stuck with Loader.  If you really want to know, I'm
 trying to mess with a TextArea that has htmlText with an img tag in it.  I
 want to switch the img tag to switch between different images that are
 embedded in the SWF. As far as I can tell, there's no way to tell an img
 tag to load an image out of the SWF.  Feel free to correct me on that.
 Because of some features of the environment, I really want to embed the
 images and not load them from the local file system or over the network.

 Eventually, I actually want to replace the PNG with an SVG.  This is part
 of why I'm wanting to have the files embedded.  But I know this will bring
 further challenges, as SVG is a vector format and I will have to get a
 raster rendering of the SVG at a certain size before I can

Re: [flexcoders] Issue with runtime adding of axis labels in DateTimeAxis

2008-09-16 Thread Pan Troglodytes
Off the top of my head, I can't think of an easy answer.  But if you could
work up and example, that would give me something to try and I might be able
to come up with a workaround.

On Mon, Sep 15, 2008 at 11:51 PM, Arun Shankar [EMAIL PROTECTED] wrote:

   dataprovider which is an ArrayCollection for the dateTimeAxis is
 bindable one. My code looks something like this

 ArrayCollection.removeItemAt(0);
 ArrayCollection.addItem(date object);
 ArrayCollection.refresh();

 i believe the first item would get removed and the new date object would
 get added to the end of the list and the call to refresh() should ultimately
 makes the chart to redraw with the new change in the collection.

 i guess flex caches the dateTime axis labels which is ultimately causing
 this problem. I tried clearing the cache but I could not do that because
 there is no straight forward to do that in flex.

 --- On Mon, 15/9/08, Pan Troglodytes [EMAIL 
 PROTECTED]chimpathetic%40gmail.com
 wrote:

  From: Pan Troglodytes [EMAIL PROTECTED] chimpathetic%40gmail.com
 
  Subject: Re: [flexcoders] Issue with runtime adding of axis labels in
 DateTimeAxis
  To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
  Date: Monday, 15 September, 2008, 9:25 PM

  This may be caused by a lack of binding in your data
  objects. Can you post
  an short, simple example that replicates your issue?
 
  On Mon, Sep 15, 2008 at 4:21 AM, arajendr
  [EMAIL PROTECTED] arajendr%40yahoo.co.in wrote:
 
   Hi All,
  
   I've been facing this problem for a while. My
  application gets new
   data every 5 mins and I need to update the DateTime
  axis label at
   runtime to include the new label data which would
  ultimately shift the
   axis one item to the left so that the left most axis
  label would be
   removed from chart and the new axis data would get
  added to the right
   most part of the axis.
  
   I've been able to get the new axis label data on
  the right most part
   but the left axis label data which i've removed
  from the dataProvider
   collection is still appearing in the chart. is it a
  bug with DateTime
   axis? Anyone have come across this problem before? let
  me know if you
   have seen this kind of problem before and whats the
  workaround.
  
   Cheers
   Arun
  
  
  
 
 
 
  --
  Jason

 Connect with friends all over the world. Get Yahoo! India Messenger at
 http://in.messenger.yahoo.com/?wm=n/
  




-- 
Jason


Re: [flexcoders] Re: Styling AdvancedDataGrid's header

2008-09-16 Thread Pan Troglodytes
Yeah, I think your could subclass it and override updateDisplayList for what
you're needing.  Check this out and see if it does what you need:

package nes
{
  import mx.controls.advancedDataGridClasses.AdvancedDataGridHeaderRenderer;

  public class AdvancedDataGridHeaderRendererExt extends
AdvancedDataGridHeaderRenderer
  {
override protected function updateDisplayList(unscaledWidth:Number,

unscaledHeight:Number):void
{
  super.updateDisplayList(unscaledWidth, unscaledHeight);

  graphics.moveTo(0, unscaledHeight);
  graphics.lineStyle(2, 0xFF);
  graphics.lineTo(unscaledWidth, unscaledHeight);
}
  }
}


?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
  xmlns:nes=nes.*
  layout=vertical
  
  mx:Script
![CDATA[
  import mx.collections.ArrayCollection;
  [Bindable] private var d:ArrayCollection = new ArrayCollection([
{value: 1, summaryRow:false},
{value: 2, summaryRow:false},
{value: 3, summaryRow:false},
{value: 4, summaryRow:false},
{value: 5, summaryRow:false},
{value: 6, summaryRow:false},
{value: 21, summaryRow:true}
  ]);
]]
  /mx:Script

  mx:AdvancedDataGrid dataProvider={d} height=100%
mx:columns
  mx:AdvancedDataGridColumn dataField=value headerText=title
mx:headerRenderer
  mx:Component
nes:AdvancedDataGridHeaderRendererExt horizontalAlign=right/
  /mx:Component
/mx:headerRenderer
  /mx:AdvancedDataGridColumn
/mx:columns
  /mx:AdvancedDataGrid
/mx:Application


On Mon, Sep 15, 2008 at 4:48 PM, whatabrain [EMAIL PROTECTED] wrote:

   Thanks! That fixed most of my problems, and could fix my sort arrow
 problem when I get to it.

 But I'm having an absurd amount of trouble drawing a thick horizontal
 line under the headers. The best I could do was add a Shape object to
 the display list in the header renderer, but that had gaps in it
 where the header separators were, and interacted very poorly with
 word wrap.

 Any ideas? Should I be overriding the AdvancedDataGrid's renderer?

 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes
 [EMAIL PROTECTED] wrote:
 
  Check out the help for AdvancedDataGridHeaderRenderer. That's what
 the grid
  is using by default. It should show all the styles there. The
 following
  code worked as expected:
 
  ?xml version=1.0 encoding=utf-8?
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
  layout=vertical
  
  mx:Script
  ![CDATA[
  import mx.collections.ArrayCollection;
  [Bindable] private var d:ArrayCollection = new ArrayCollection
 ([
  {value: 1, summaryRow:false},
  {value: 2, summaryRow:false},
  {value: 3, summaryRow:false},
  {value: 4, summaryRow:false},
  {value: 5, summaryRow:false},
  {value: 6, summaryRow:false},
  {value: 21, summaryRow:true}
  ]);
  ]]
  /mx:Script
 
  mx:AdvancedDataGrid dataProvider={d} height=100%
  mx:columns
  mx:AdvancedDataGridColumn dataField=value
 headerText=title
  mx:headerRenderer
  mx:Component
  mx:AdvancedDataGridHeaderRenderer
 horizontalAlign=right/
  /mx:Component
  /mx:headerRenderer
  /mx:AdvancedDataGridColumn
  /mx:columns
  /mx:AdvancedDataGrid
  /mx:Application
 
 
  On Mon, Sep 15, 2008 at 1:12 PM, whatabrain [EMAIL PROTECTED] wrote:
 
   I'm having trouble getting my AdvancedDataGrid's header to look
 like
   I want, and I can't seem to find any reference for what styles are
   allowed in the headerStyleName class. Worse, I've found that
 some
   styles (like headerColors) can only appear in the table body's
 style.
   Here are the things I'm trying to do:
  
   1) Left-aligned text (text-align doesn't work).
  
   2) Lighter gray borders (borderColor doesn't work).
  
   3) A thick, solid black line below the headers (border-thickness-
   bottom doesn't work).
  
   4) Word wrap.
  
   5) If possible, a Windows-style sort arrow on column headers,
 instead
   of the wierd blocked-off sort arrow used by Flex. I'm guessing I'd
   need a skin for this.
  
   Is there a good reference somewhere on Flex CSS?
  
  
  
 
 
 
  --
  Jason
 

  




-- 
Jason


Re: [flexcoders] AdvancedDataGrid: Exclude last row from sorting

2008-09-16 Thread Pan Troglodytes
Glad you got the result you were looking for.  Yes, it does kind of suck
that they made the sorting method so simple.  The problem is that that part
of the code isn't grid code, it's ICollectionView code.  It winds up using
SortFields, which are very unaware of any griddish concerns.  It's a great
way to do it, from a code design point of view.  But sometimes it can throw
a monkey wrench into practical applications.

On Tue, Sep 16, 2008 at 8:06 AM, DanMurray [EMAIL PROTECTED] wrote:


 Hi Jason,

 I think I have this working as required now with just the one sort method
 used by every column (I think this is OK as I have multi-column sorting
 turned off).

 I have moved the createColumns() method onto the MyAdvancedDataGrid class
 and added the following to that class:

 // map of column objects keyed against their datafields (populated by
 createColumns() method)
 private var mColumns:Object;
 // keep track of currently sorted column
 private var mSortedColumn:AdvancedDataGridColumn;

 public function MyAdvancedDataGrid (id:String)
 {
 snip
 addEventListener(AdvancedDataGridEvent.SORT, sortEventHandler);
 }

 private function sortEventHandler(event:AdvancedDataGridEvent):void
 {
 mSortedColumn = mColumns[event.dataField];
 }

 Then within createColumns() every new column gets

 column.sortCompareFunction = compareExcludeSummaryRow;

 where the sort method is:

 private function compareExcludeSummaryRow(obj1:Object, obj2:Object):int
 {
 // should never be in this state
 if (mSortedColumn == null)
 {
 // TODO log error
 return 0;
 }

 var isSortDescending:Boolean = mSortedColumn .sortDescending;
 var sortField:String = mSortedColumn .dataField;

 if (obj1.summary)
 {
 return isSortDescending ? -1 : 1;
 }
 else if (obj2.summary)
 {
 return isSortDescending ? 1 : -1;
 }
 else if (obj1[sortField]  obj2[sortField])
 {
 return -1;
 }
 else if (obj1[sortField]  obj2[sortField])

 {
 return 1;
 }
 else
 {
 return 0;
 }
 }

 This seems to work nicely now, but as I say I think it is restricted to
 single column sorting, which is fine for me.

 Thanks for your help, and any further comments appreciated!

 Dan.

 Pan Troglodytes wrote:
 
  Sorry Dan, my brain must not have been fully in gear. You do need to
  check
  the columns sort order:
 
  if (obj1.summaryRow)
  return col1.sortDescending ? -1 : 1
  else if (obj2.summaryRow)
  return col1.sortDescending ? 1 : -1
  else if (obj1.value  obj2.value)
  return -1
  else if (obj1.value  obj2.value)
  return 1
  else
  return 0;
 
  Where col1 is the id of the column being sorted. That should (hopefully)
  do
  it.
 

 --
 View this message in context:
 http://www.nabble.com/AdvancedDataGrid%3A-Exclude-last-row-from-sorting-tp19458035p19511454.html
 Sent from the FlexCoders mailing list archive at Nabble.com.

  




-- 
Jason


[flexcoders] any way to use embedded image in htmlText?

2008-09-16 Thread Pan Troglodytes
The answer to this is probably going to be no, but I figure it's worth a
shot.

I have a number of images embedded into my flash application.  I would like
to allow the user to type some html that would include an img tag that
references those images.  That would then get applied to a UITextField's
htmlText property.  Is there any way to do this, or are you stuck with
either loading images for htmlText off the network or off the hard drive?

-- 
Jason


Re: [flexcoders] Drag and Drop question

2008-09-16 Thread Pan Troglodytes
I believe you're going to need to handle the drop events yourself and not
use the dropEnabled=true setting.  When you do that, by default drop is
denied and you have to tell it to allow it, like in the dragEnter event.
For example:

private function dragEnterHandler(e:DragEvent):void
{
  DragManager.acceptDragDrop(UIComponent(e.currentTarget));
  DragManager.showFeedback(DragManager.COPY);
}


On Tue, Sep 16, 2008 at 9:59 AM, zootpeet [EMAIL PROTECTED] wrote:

   I am trying to implement drag and drop onto a tree. In the dropDrop
 handler, I want to be able to deny the drop from happening, based on
 which element of the tree is being dropped on.

 // r is the visible index in the tree
 var dropTarget:Tree = Tree(event.currentTarget);
 var r:int = dropTarget.calculateDropIndex(event);
 dstXmlTree.selectedIndex = r;
 var node:XML = dstXmlTree.selectedItem as XML;

 if (node.toXMLSting == whatever) {
 // Allow drop -- HOW?
 } else {
 // Do NOT allow drop -- HOW?
 }

 How do I deny the drop?

 thanks!

  




-- 
Jason


Re: [flexcoders] Overriding parent's style in custom component

2008-09-16 Thread Pan Troglodytes
This might be kind of a hack, but you could override setStyle, catch the
backgroundcolor style being set and not call the super for it.

On Tue, Sep 16, 2008 at 9:52 AM, aaronius9er9er [EMAIL PROTECTED]wrote:

   Hi all,

 I'm creating a custom component which extends Container. I would like
 to use the backgroundColor style to style certain parts of the custom
 component. I don't have any problem getting access to the style and
 doing what I want with it within my component, but the parent
 Container class uses the style as well and paints the background of
 the whole component (from the very top-left to the very top-right).

 I there an easy way to say...hey parent, don't use the backgroundColor
 style or use NaN instead of what the developer actually set?

 Thanks!

  




-- 
Jason


Re: [flexcoders] Re: Styling AdvancedDataGrid's header

2008-09-16 Thread Pan Troglodytes
I THINK I know what you're talking about.  You mean the grey line that
separates each column, right?  What you're wanting is a line that goes all
the way from the bottom-left of the first column header to the bottom-right
of the last column header, right?  If not, please post a doctored screenshot
of how you want the header to look.

If so, I think you'll need to make your own headerSeparatorSkin for ADG.
This is what is in the default skin, DataGridHeaderSeparator.

override protected function updateDisplayList(w:Number, h:Number):void
{
  super.updateDisplayList(w, h);
  var g:Graphics = graphics;

  g.clear();

  // Highlight
  g.lineStyle(1, 0xFF, 0.5);
  g.moveTo(0, 0);
  g.lineTo(0, h);
  g.lineStyle(1, getStyle(borderColor));
  g.moveTo(1, 0);
  g.lineTo(1, h);
}

I made my own subclass of ProgrammaticSkin that just had nothing in its
updateDisplayList.  That gave me no separator at all.  I'm sure you could
get it to do just what you want.  You're still left with the default border
around the entire block of columns drawn by the grid.  There's probably
another skin you could replace to get rid of that if it's a problem.

On Tue, Sep 16, 2008 at 1:10 PM, whatabrain [EMAIL PROTECTED] wrote:

   That's a little closer than what I was trying (adding a Shape to the
 list of children), but it still has one problem: The column separator
 pixels break up the line.


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes
 [EMAIL PROTECTED] wrote:
 
  Yeah, I think your could subclass it and override updateDisplayList
 for what
  you're needing. Check this out and see if it does what you need:
 
  package nes
  {
  import
 mx.controls.advancedDataGridClasses.AdvancedDataGridHeaderRenderer;
 
  public class AdvancedDataGridHeaderRendererExt extends
  AdvancedDataGridHeaderRenderer
  {
  override protected function updateDisplayList
 (unscaledWidth:Number,
 
  unscaledHeight:Number):void
  {
  super.updateDisplayList(unscaledWidth, unscaledHeight);
 
  graphics.moveTo(0, unscaledHeight);
  graphics.lineStyle(2, 0xFF);
  graphics.lineTo(unscaledWidth, unscaledHeight);
  }
  }
  }
 
 
  ?xml version=1.0 encoding=utf-8?
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
  xmlns:nes=nes.*
  layout=vertical
  
  mx:Script
  ![CDATA[
  import mx.collections.ArrayCollection;
  [Bindable] private var d:ArrayCollection = new ArrayCollection
 ([
  {value: 1, summaryRow:false},
  {value: 2, summaryRow:false},
  {value: 3, summaryRow:false},
  {value: 4, summaryRow:false},
  {value: 5, summaryRow:false},
  {value: 6, summaryRow:false},
  {value: 21, summaryRow:true}
  ]);
  ]]
  /mx:Script
 
  mx:AdvancedDataGrid dataProvider={d} height=100%
  mx:columns
  mx:AdvancedDataGridColumn dataField=value
 headerText=title
  mx:headerRenderer
  mx:Component
  nes:AdvancedDataGridHeaderRendererExt
 horizontalAlign=right/
  /mx:Component
  /mx:headerRenderer
  /mx:AdvancedDataGridColumn
  /mx:columns
  /mx:AdvancedDataGrid
  /mx:Application
 
 
  On Mon, Sep 15, 2008 at 4:48 PM, whatabrain [EMAIL PROTECTED] wrote:
 
   Thanks! That fixed most of my problems, and could fix my sort
 arrow
   problem when I get to it.
  
   But I'm having an absurd amount of trouble drawing a thick
 horizontal
   line under the headers. The best I could do was add a Shape
 object to
   the display list in the header renderer, but that had gaps in it
   where the header separators were, and interacted very poorly with
   word wrap.

  




-- 
Jason


Re: [flexcoders] Re: Styling AdvancedDataGrid's header

2008-09-16 Thread Pan Troglodytes
Did you override just the headerSeparatorSkin, or go farther?

On Tue, Sep 16, 2008 at 2:29 PM, whatabrain [EMAIL PROTECTED] wrote:

   Thanks. That's exactly what I was looking for, and it fixed my
 problem.

 However, overriding the skin also overrode lots of ADG settings, like
 verticalGridLines, alternatingItemColors and sortExpertMode. Is there
 any way to avoid that?


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes
 [EMAIL PROTECTED] wrote:
 
  I THINK I know what you're talking about. You mean the grey line
 that
  separates each column, right? What you're wanting is a line that
 goes all
  the way from the bottom-left of the first column header to the
 bottom-right
  of the last column header, right? If not, please post a doctored
 screenshot
  of how you want the header to look.
 
  If so, I think you'll need to make your own headerSeparatorSkin for
 ADG.
  This is what is in the default skin, DataGridHeaderSeparator.
 
  override protected function updateDisplayList(w:Number,
 h:Number):void
  {
  super.updateDisplayList(w, h);
  var g:Graphics = graphics;
 
  g.clear();
 
  // Highlight
  g.lineStyle(1, 0xFF, 0.5);
  g.moveTo(0, 0);
  g.lineTo(0, h);
  g.lineStyle(1, getStyle(borderColor));
  g.moveTo(1, 0);
  g.lineTo(1, h);
  }
 
  I made my own subclass of ProgrammaticSkin that just had nothing in
 its
  updateDisplayList. That gave me no separator at all. I'm sure you
 could
  get it to do just what you want. You're still left with the
 default border
  around the entire block of columns drawn by the grid. There's
 probably
  another skin you could replace to get rid of that if it's a problem.
 
  On Tue, Sep 16, 2008 at 1:10 PM, whatabrain [EMAIL PROTECTED] wrote:
 
   That's a little closer than what I was trying (adding a Shape
 to the
   list of children), but it still has one problem: The column
 separator
   pixels break up the line.
  
  
   --- In flexcoders@yahoogroups.com 
   flexcoders%40yahoogroups.comflexcoders%
 40yahoogroups.com, Pan

   Troglodytes
   chimpathetic@ wrote:
   
Yeah, I think your could subclass it and override
 updateDisplayList
   for what
you're needing. Check this out and see if it does what you need:
   
package nes
{
import
  
 mx.controls.advancedDataGridClasses.AdvancedDataGridHeaderRenderer;
   
public class AdvancedDataGridHeaderRendererExt extends
AdvancedDataGridHeaderRenderer
{
override protected function updateDisplayList
   (unscaledWidth:Number,
   
unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
   
graphics.moveTo(0, unscaledHeight);
graphics.lineStyle(2, 0xFF);
graphics.lineTo(unscaledWidth, unscaledHeight);
}
}
}
   
   
?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
xmlns:nes=nes.*
layout=vertical

mx:Script
![CDATA[
import mx.collections.ArrayCollection;
[Bindable] private var d:ArrayCollection = new ArrayCollection
   ([
{value: 1, summaryRow:false},
{value: 2, summaryRow:false},
{value: 3, summaryRow:false},
{value: 4, summaryRow:false},
{value: 5, summaryRow:false},
{value: 6, summaryRow:false},
{value: 21, summaryRow:true}
]);
]]
/mx:Script
   
mx:AdvancedDataGrid dataProvider={d} height=100%
mx:columns
mx:AdvancedDataGridColumn dataField=value
   headerText=title
mx:headerRenderer
mx:Component
nes:AdvancedDataGridHeaderRendererExt
   horizontalAlign=right/
/mx:Component
/mx:headerRenderer
/mx:AdvancedDataGridColumn
/mx:columns
/mx:AdvancedDataGrid
/mx:Application
   
   
On Mon, Sep 15, 2008 at 4:48 PM, whatabrain junk1@ wrote:
   
 Thanks! That fixed most of my problems, and could fix my sort
   arrow
 problem when I get to it.

 But I'm having an absurd amount of trouble drawing a thick
   horizontal
 line under the headers. The best I could do was add a Shape
   object to
 the display list in the header renderer, but that had gaps in
 it
 where the header separators were, and interacted very poorly
 with
 word wrap.
  
  
  
 
 
 
  --
  Jason
 

  




-- 
Jason


Re: [flexcoders] Re: Styling AdvancedDataGrid's header

2008-09-16 Thread Pan Troglodytes
I might have to see some code before I can figure it out.  But out of
curiosity, when you say you override headerSeparatorSkin, do you mean you
just do something like:

mx:StandardTreeGrid headerSeparatorSkin=MyHeaderSeparatorSkinClass

or are you talking about doing something in the actual actionscript code?


On Tue, Sep 16, 2008 at 3:24 PM, whatabrain [EMAIL PROTECTED] wrote:

   While trying to answer your question, I found out what was causing the
 problem, but I'm still not sure why.

 I have a class called StandardTreeGrid, which subclasses ADG. It's in
 StandardTreeGrid that I override things like verticalGridLines. Now if
 I override headerSeparatorSkin in StandardTreeGrid, everything works
 fine. But if I subclass StandardTreeGrid and override
 headerSeparatorSkin there, I lose a bunch of ADG attributes.

 Any idea how I can fix this?


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes [EMAIL PROTECTED]
 wrote:
 
  Did you override just the headerSeparatorSkin, or go farther?
 
  On Tue, Sep 16, 2008 at 2:29 PM, whatabrain [EMAIL PROTECTED] wrote:
 
   Thanks. That's exactly what I was looking for, and it fixed my
   problem.
  
   However, overriding the skin also overrode lots of ADG settings,
 like
   verticalGridLines, alternatingItemColors and sortExpertMode. Is
 there
   any way to avoid that?

  




-- 
Jason


Re: [flexcoders] Re: Styling AdvancedDataGrid's header

2008-09-16 Thread Pan Troglodytes
This intrigues me, Pedro.  Could you expand a bit more and/or give
examples?  Even if this is unrelated to the problem here, I'm interested in
it to expand my Flex knowledge.

On Tue, Sep 16, 2008 at 3:31 PM, Pedro Sena [EMAIL PROTECTED] wrote:

   Probably because that are a few protected attributes that become private
 when you subclass StandardTreeGrid instead of direct subclassing ADG.

 I´m not sure if this is the case, but you should take a look at this.

 Hope this helps

 On Tue, Sep 16, 2008 at 5:24 PM, whatabrain [EMAIL PROTECTED] wrote:

   While trying to answer your question, I found out what was causing the
 problem, but I'm still not sure why.

 I have a class called StandardTreeGrid, which subclasses ADG. It's in
 StandardTreeGrid that I override things like verticalGridLines. Now if
 I override headerSeparatorSkin in StandardTreeGrid, everything works
 fine. But if I subclass StandardTreeGrid and override
 headerSeparatorSkin there, I lose a bunch of ADG attributes.

 Any idea how I can fix this?


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pan
 Troglodytes [EMAIL PROTECTED]
 wrote:
 
  Did you override just the headerSeparatorSkin, or go farther?
 
  On Tue, Sep 16, 2008 at 2:29 PM, whatabrain [EMAIL PROTECTED] wrote:
 
   Thanks. That's exactly what I was looking for, and it fixed my
   problem.
  
   However, overriding the skin also overrode lots of ADG settings,
 like
   verticalGridLines, alternatingItemColors and sortExpertMode. Is
 there
   any way to avoid that?




 --
 /**
 * Pedro Sena
 * Systems Architect
 * Sun Certified Java Programmer
 * Sun Certified Web Component Developer
 *
 * Net Sar
 * www.netsar.com.br
 */
  




-- 
Jason


Re: [flexcoders] Property isLoading in class Image?

2008-09-15 Thread Pan Troglodytes
I don't think so, but there is percentLoaded, bytesTotal and bytesLoaded.  I
think those may get you what you need.

On Mon, Sep 15, 2008 at 8:18 AM, João [EMAIL PROTECTED] wrote:

   Hi,

 I need to know on a specific moment if an instance of class Image is
 loading content or not. Is there any property on class Image to
 indicate that?

 Thanks,

 João Saleiro

  




-- 
Jason


Re: [flexcoders] Issue with runtime adding of axis labels in DateTimeAxis

2008-09-15 Thread Pan Troglodytes
This may be caused by a lack of binding in your data objects.  Can you post
an short, simple example that replicates your issue?

On Mon, Sep 15, 2008 at 4:21 AM, arajendr [EMAIL PROTECTED] wrote:

   Hi All,

 I've been facing this problem for a while. My application gets new
 data every 5 mins and I need to update the DateTime axis label at
 runtime to include the new label data which would ultimately shift the
 axis one item to the left so that the left most axis label would be
 removed from chart and the new axis data would get added to the right
 most part of the axis.

 I've been able to get the new axis label data on the right most part
 but the left axis label data which i've removed from the dataProvider
 collection is still appearing in the chart. is it a bug with DateTime
 axis? Anyone have come across this problem before? let me know if you
 have seen this kind of problem before and whats the workaround.

 Cheers
 Arun

  




-- 
Jason


Re: [flexcoders] AdvancedDataGrid: Exclude last row from sorting

2008-09-15 Thread Pan Troglodytes
Sorry Dan, my brain must not have been fully in gear.  You do need to check
the columns sort order:

if (obj1.summaryRow)
  return col1.sortDescending ? -1 : 1
else if (obj2.summaryRow)
  return col1.sortDescending ? 1 : -1
else if (obj1.value  obj2.value)
  return -1
else if (obj1.value  obj2.value)
  return 1
else
  return 0;

Where col1 is the id of the column being sorted.  That should (hopefully) do
it.

On Mon, Sep 15, 2008 at 12:45 PM, DanMurray [EMAIL PROTECTED] wrote:


 Hi Jason,

 Thanks for the reply and the suggestion.

 However I don't think this deals with the ascending and descending sort
 cases does it? I changed your example slightly so that

 if (obj1.summaryRow)
 return 1
 else if (obj2.summaryRow)
 return -1

 i.e. the signs are reversed. So now when you do the initial sort the
 summary
 row stays as the last row. However if the user sorts that column again then
 the sort order is reversed, and the summary row moves to the first row. Am
 I
 missing a simple way to resolve this?

 Thanks again,

 Dan.


 Pan Troglodytes wrote:
 
  Yes, it's fairly easy to do with a custom sort function. Here is an
  example
  function that assumes you set a summaryRow property on the last row
  object:
 
  private function compareWithSummary(obj1:Object, obj2:Object):int
  {
  if (obj1.summaryRow)
  return -1
  else if (obj2.summaryRow)
  return 1
  else if (obj1.fieldbeingsorted  obj2.fieldbeingsorted)
  return -1
  else if (obj1.fieldbeingsorted  obj2.fieldbeingsorted)
  return 1
  else
  return 0;
  }
 
  Where fieldbeingsorted is the field for that column that would
 otherwise
  be sorting on. For example, if you had
 
  AdvancedDataGrid dataField=customerName
  sortCompareFunction=copmareWithSummary/
 
  then fieldbeingsorted would be customerName. You'd need to make a
  different
  compare function for each column in the grid, since Flex doesn't pass in
  the
  column name to the sort compare function.
 
  On Fri, Sep 12, 2008 at 10:21 AM, DanMurray [EMAIL 
  PROTECTED]danomurray%40gmail.com
 wrote:
 
 
  Hi,
 
  I have an AdvancedDataGrid where the last row contains some summary
  information about the data (number of rows, totals for some of the
  columns
  above). I would like to exclude this last row from the sort operations
  i.e.
  always show it last - is there any way to achieve this with custom
  sorting?
 
  (Prev posted to flex-india group my mistake - apologies)
 
  Thanks,
 
  Dan.
  --
  View this message in context:
 
 http://www.nabble.com/AdvancedDataGrid%3A-Exclude-last-row-from-sorting-tp19458035p19458035.html
  Sent from the FlexCoders mailing list archive at Nabble.com.
 
 
 
 
 
 
  --
  Jason
 
 

 --
 View this message in context:
 http://www.nabble.com/AdvancedDataGrid%3A-Exclude-last-row-from-sorting-tp19458035p19497738.html
 Sent from the FlexCoders mailing list archive at Nabble.com.

  




-- 
Jason


Re: [flexcoders] Styling AdvancedDataGrid's header

2008-09-15 Thread Pan Troglodytes
Check out the help for AdvancedDataGridHeaderRenderer.  That's what the grid
is using by default.  It should show all the styles there.  The following
code worked as expected:

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
  layout=vertical
  
  mx:Script
![CDATA[
  import mx.collections.ArrayCollection;
  [Bindable] private var d:ArrayCollection = new ArrayCollection([
{value: 1, summaryRow:false},
{value: 2, summaryRow:false},
{value: 3, summaryRow:false},
{value: 4, summaryRow:false},
{value: 5, summaryRow:false},
{value: 6, summaryRow:false},
{value: 21, summaryRow:true}
  ]);
]]
  /mx:Script

  mx:AdvancedDataGrid dataProvider={d} height=100%
mx:columns
  mx:AdvancedDataGridColumn dataField=value headerText=title
mx:headerRenderer
  mx:Component
mx:AdvancedDataGridHeaderRenderer horizontalAlign=right/
  /mx:Component
/mx:headerRenderer
  /mx:AdvancedDataGridColumn
/mx:columns
  /mx:AdvancedDataGrid
/mx:Application


On Mon, Sep 15, 2008 at 1:12 PM, whatabrain [EMAIL PROTECTED] wrote:

   I'm having trouble getting my AdvancedDataGrid's header to look like
 I want, and I can't seem to find any reference for what styles are
 allowed in the headerStyleName class. Worse, I've found that some
 styles (like headerColors) can only appear in the table body's style.
 Here are the things I'm trying to do:

 1) Left-aligned text (text-align doesn't work).

 2) Lighter gray borders (borderColor doesn't work).

 3) A thick, solid black line below the headers (border-thickness-
 bottom doesn't work).

 4) Word wrap.

 5) If possible, a Windows-style sort arrow on column headers, instead
 of the wierd blocked-off sort arrow used by Flex. I'm guessing I'd
 need a skin for this.

 Is there a good reference somewhere on Flex CSS?

  




-- 
Jason


Re: [flexcoders] Copying graphs to the clipboard

2008-09-13 Thread Pan Troglodytes
As an AIR app, it should definitely be much easier.  With it, you have
access to flash.desktop.Clipboard.  When flash is running in the browser,
it's subject to a lot more restrictions.  You can call System.setClipboard
to copy a string to the clipboard, but that's pretty much it.

Different browsers have different rules/methods for accessing the clipboard
from Javascript.  Here's a page on how to do it in IE, but you'll get a
security warning in more recent versions:
http://www.codehouse.com/javascript/tips/clipboard_send/

There's a config option in the more recent versions of Firefox to allow
clipboard writing from javascript:
http://www.febooti.com/support/website-help/website-javascript-copy-clipboard.html


I'm not up on how each different version treats these things.  Furthermore,
if you have to support users of Safari, Opera, or even Chrome now, you may
run into issues.

Not sure if you need it, but I ran across this article for actually creating
the snapshop in Flex using the new ImageSnapshot class:
http://dougmccune.com/blog/2007/06/11/imagesnapshot-class-in-flex-3-sdk/

On Sat, Sep 13, 2008 at 1:20 AM, Guy Morton [EMAIL PROTECTED] wrote:

   Has anyone got any advice as to how one might allow a user to copy a
 graph to their clipboard (or save it as a file)?

 I'm sure I'm not the first person to ask this, so if there is an
 authoritative copying data from Flex FAQ somewhere please let me know.

 We'll be building this app in Flex 3. We can do server-side stuff if
 need be, but we're not running CF or Flex data services.

 Also, if we were able to distribute the app as an AIR app, would we
 have access to vastly better options?

 TIA

 Guy
  




-- 
Jason


Re: [flexcoders] AdvancedDataGrid: Exclude last row from sorting

2008-09-13 Thread Pan Troglodytes
Yes, it's fairly easy to do with a custom sort function.  Here is an example
function that assumes you set a summaryRow property on the last row
object:

  private function compareWithSummary(obj1:Object, obj2:Object):int
  {
if (obj1.summaryRow)
  return -1
else if (obj2.summaryRow)
  return 1
else if (obj1.fieldbeingsorted  obj2.fieldbeingsorted)
  return -1
else if (obj1.fieldbeingsorted  obj2.fieldbeingsorted)
  return 1
else
  return 0;
  }

Where fieldbeingsorted is the field for that column that would otherwise
be sorting on.  For example, if you had

AdvancedDataGrid dataField=customerName
sortCompareFunction=copmareWithSummary/

then fieldbeingsorted would be customerName.  You'd need to make a different
compare function for each column in the grid, since Flex doesn't pass in the
column name to the sort compare function.

On Fri, Sep 12, 2008 at 10:21 AM, DanMurray [EMAIL PROTECTED] wrote:


 Hi,

 I have an AdvancedDataGrid where the last row contains some summary
 information about the data (number of rows, totals for some of the columns
 above). I would like to exclude this last row from the sort operations i.e.
 always show it last - is there any way to achieve this with custom sorting?

 (Prev posted to flex-india group my mistake - apologies)

 Thanks,

 Dan.
 --
 View this message in context:
 http://www.nabble.com/AdvancedDataGrid%3A-Exclude-last-row-from-sorting-tp19458035p19458035.html
 Sent from the FlexCoders mailing list archive at Nabble.com.

  




-- 
Jason


Re: [flexcoders] Not able to capture event dispached from custom state override - what's wrong?

2008-09-13 Thread Pan Troglodytes
You need to register your event handler with the object actually dispatching
events.

t:TestOverride id=mytest/
...
mytest.addEventListener(testEvent, handleIt)


On Wed, Sep 10, 2008 at 1:39 PM, Dan [EMAIL PROTECTED] wrote:

   I have a class TestOverride that implements IOverride. This class is
 dispatching event. I am trying to handle this event in application
 that contains states definition with one state that has TestOverride
 added, but to no avail.
 Why am I not able to capture this event?

 Here is my code, it is very simple:
 1. TestOverride

 package org.testEvents
 {
 import flash.display.*;
 import flash.events.Event;

 import mx.core.*;
 import mx.states.*

 public class TestOverride extends Shape implements IOverride
 {
 public function TestOverride()
 {
 }

 public function initialize():void{
 }

 public function apply(parent:UIComponent):void
 {
 this.execute();
 }

 public function remove(parent:UIComponent):void
 {
 //TODO: implement function
 }

 public function execute():void{
 trace(execute)
 dispatchEvent(new Event(testEvent,true))
 }
 }
 }

 2. Application:
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 xmlns:t=org.testEvents.*
 layout=absolute
 mx:Script![CDATA[

 protected override function initializationComplete():void{
 addEventListener(testEvent, handleIt)
 currentState = start
 super.initializationComplete()
 }

 public function handleIt(event:Event):void{
 trace(event handled)
 }
 ]]/mx:Script

 mx:states
 mx:State name=start
 t:TestOverride /
 /mx:State
 /mx:states
 /mx:Application

 When I debug the application, discpatchEvent is called and word
 execute written to console.

  




-- 
Jason


Re: [flexcoders] Browser Bug ? Display 2 scrollbars

2008-09-13 Thread Pan Troglodytes
It would probably help a lot if you can post a small test app the shows what
you're talking about.  Keep it as simple as possible to illustrate your
problem.

But my first instinct is that it's kind of an age-old problem in programming
with scrollbars.  Say you have an element that is 500 pixels wide, just wide
enough to show everything it contains.  Then it gets a lot of info in it,
which causes it to need a vertical scrollbar.  Well, that scrollbar then
steals some width from that 500, so that now the element can only be, say,
484 pixels wide because there's a scrollbar taking up the next 16 pixels.
Well, now if you have scrollbars set to automatically pop up when the
element isn't wide enough to display the text width, the horizontal
scrollbar shows up, too.

The fix for this in flex is to set the horizontal widths as a % of the
parent's width.  That way when the vertical scrollbar pops up, the element
and hence its children will resize to be smaller to accomodate the
scrollbar.

If this isn't clear, post your example and I can show you the changes to fix
it.

On Wed, Sep 10, 2008 at 6:19 AM, itdanny2002 [EMAIL PROTECTED] wrote:

   I create Vbox with fixed width. Then I add Canvas
 inside. Afterwards, I add TextArea as child. Scrollbar
 policy of canvas is off.

 If there are many childs but within boundary e.g. 700 pixel.
 No scrollbar. If it is over screen height e.g. 900 pixel.
 It displays scrollbars. Anyway, it displays TWO: Vertical and
 Horizontal. I try to set MaxWidth but still has 2 scrollbars
 instead of just vertical.

 More information. I add TextArea child programmingly. I trace
 the width of Canvas. The width is longer than what I expect
 even in startup mode.

 Any idea ?

  




-- 
Jason


Re: [flexcoders] How to do a State Change Area Chart with Time Series State Change Source Data?

2008-09-13 Thread Pan Troglodytes
This shouldn't really be hard at all.  Have you actually tried it and are
running into difficulties?  You need to make sure your x values are in the
format that Date() likes, and if using a DateTimeAxis doesn't work, you can
use a LinearAxis and a custom axis label function.  If you want a stairstep
instead of a straight line between points, that's also possible with a
certain property/style of the series.

On Tue, Sep 9, 2008 at 7:27 PM, azurebell [EMAIL PROTECTED] wrote:

   We want to see an Area Chart with the ON STATE corresponding to a y-
 axis value of 1 and the OFF STATE corresponding to a y-axis value of 0.
 We might have a series of data like this:

 23May08 11:43:35 ON
 23May08 11:43:39 OFF
 01Jun08 12:55:03 ON
 05Jul08 06:32:01 OFF
 08Sep08 08:00:02 ON

 In reality this data could show a state change at any time. Note in the
 first instance, above, the state was ON for only 4 seconds. We need to
 see that on the graph, as a visible line, even though the graph might
 be displaying for six months. We need to display this graph for a
 defined period with each ON state change being represented by the area
 chart showing as 1 on the y-axis.

 So can we pass this data to a flex chart and have it represented as an
 area graph? I would hate to have to generate millions of values to
 achive this. Four months of one second data is about 10,368,000 lines
 of data!

 Any ideas on an approach?
 TIA

 Cheers
 Mark

  




-- 
Jason


Re: [flexcoders] Bug ? IE FireFox Menubar

2008-09-13 Thread Pan Troglodytes
I believe you're just running into how different browsers handle embedded
flash objects.  Once you click on a flash app, firefox generally lets it
have every keystroke after that until you actually click somewhere outside
it.  IE is less permissive and continues to listen for keystrokes even when
a flash app is focused.  Once you click outside a flash app in either
browser, your browser no longer receives keystroke messages because it's no
longer focused.

On Mon, Sep 8, 2008 at 11:08 PM, itdanny2002 [EMAIL PROTECTED] wrote:

   I write a very simple with a TextInput Box.

 On IE, I can use Tab to move around IE menubar
 and my application. But, when I press ALT-D to address
 bar, I can't use any method to go it back to my
 application except use a mouse to click it.

 On FireFox, I cannot use hotkey such as ALT-F to
 access menu bar.

 Is it a bug ?
 Any workaround ?

  




-- 
Jason


Re: [flexcoders] Custom vertical axis line on plot chart

2008-09-13 Thread Pan Troglodytes
There are several ways you could go about doing it, though nothing built in
to support it.

One way would be to make your data so that 30 is actually 0 in the
underlying data.  You'd write an axis label function that would add 30 to
the values for labelling.  If you wanted datahints, you'd have to write a
function to do the same for them.  Then you'd set the major tick interval
really high so that you'd only ever get a single grid line at your fake 0
point.

Another way would be to create a ChartElement that just draws a line at 30
and stick it in the BackgroundElements, along with a GridLines that is set
to horizontal only (if thats what you want).

On Mon, Sep 8, 2008 at 10:26 AM, kirilminevgroups 
[EMAIL PROTECTED] wrote:

   I need to have only one of my vertical lines on my plot chart. For
 example when plotting my data points I need to make only the line on
 30 visible on my grid and the rest hidden. Can that be accomplished.

 Technically I need to have one cross on my plot chart and all the
 points plotted around it.

 Thanks in advance.

  




-- 
Jason


Re: [flexcoders] Date field in either arraycollection or datagrid

2008-09-13 Thread Pan Troglodytes
For #2, look at ArrayCollection.sort.  You can create a sort object and use
a slightly modified version of your date_sortCompareFunc for the
compareFunction of the Sort object.

I've never really found a good way to do #1, so I'd be interested in that if
you or anyone else finds a way.

On Thu, Sep 4, 2008 at 5:09 PM, leonpidgeon [EMAIL PROTECTED] wrote:

   hi

 getting frustrated with this.

 i have an arraycollection which populates a datagrid. the
 arraycollection has one field which is date and contains dates in the
 format dd/mm/.

 the date column in the date grid has
 sortCompareFunction=date_sortCompareFunc which i have found
 elsewhere on the internet and works perfectly when the column header
 is clicked. However, when the datagrid is populated it needs sorting
 so i think the 2 options i have are either,

 1) call something to do this sort as if someone has clicked on the
 header
 2) sort the array collection on the date field.

 any thoughts on how i could do either of these and it will be greatly
 appreciated.

 Leon

  




-- 
Jason


Re: [flexcoders] Flex Charting Issue with Data Effects

2008-09-13 Thread Pan Troglodytes
Okay, I think I figured it out.  I had the same problem in the 3.1 SDK.  You
were definitely being stumped because you didn't have the Pro source code.
I went ahead and created a bug and entered the reason it's broken and how
you can go about working around it.  If you vote for the issue, there's more
of a chance it will be fixed in a future SDK release.

On Thu, Sep 4, 2008 at 8:03 AM, omnautic [EMAIL PROTECTED] wrote:

   Hi,

 I'm hoping someone can help me out.

 I seem to have found a bug with the Flex 3 charting components. Since
 the these components are not open source, perhaps this is the best way
 to get a quick response. I've searched high and low and have found
 nothing relating to my problem.

 So, here goes:
 I'm trying to use the SeriesInterpolate effect with some ColumnSeries.
 The documented events are not being triggered. effectEnd is triggered,
 actually. But effectStart, tweenBegin, tweenEnd, tweenUpdate are not.

 I tried the other data effects: SeriesSlide and SeriesZoom as well.
 They both failed to trigger the above events also.

 The documentation states that the effectStart is triggered by a
 showData event, but I don't see that event documented (or I'd try to
 snag it, too).

 Have there been any updates to the charting components since Flex 3
 was released? Maybe these issues were already addressed? I checked the
 downloads and see an update to the SDK, but nothing on the charting
 components.

 Another little bit about what I'm really trying to do:
 I'd like to update the label, too, as the column expands/contracts.
 The data label retains the old value until the column tween is
 complete, then it updates to the new value. An option to update the
 label for the SeriesInterpolate effect would be really nice. At the
 very least, an option to hide the label while tweening, perhaps?

 At this point, I think I'm going to have the programmatically change
 the values with a Timer event, in conjunction with the data effect.

 Thanks a lot,
 K

  




-- 
Jason


Re: [flexcoders] Flex Charting Issue with Data Effects

2008-09-13 Thread Pan Troglodytes
Ooops, the bug report is at:
https://bugs.adobe.com/jira/browse/FLEXDMV-1879

On Sat, Sep 13, 2008 at 2:12 PM, Pan Troglodytes [EMAIL PROTECTED]wrote:

 Okay, I think I figured it out.  I had the same problem in the 3.1 SDK.
 You were definitely being stumped because you didn't have the Pro source
 code.  I went ahead and created a bug and entered the reason it's broken and
 how you can go about working around it.  If you vote for the issue, there's
 more of a chance it will be fixed in a future SDK release.


 On Thu, Sep 4, 2008 at 8:03 AM, omnautic [EMAIL PROTECTED] wrote:

   Hi,

 I'm hoping someone can help me out.

 I seem to have found a bug with the Flex 3 charting components. Since
 the these components are not open source, perhaps this is the best way
 to get a quick response. I've searched high and low and have found
 nothing relating to my problem.

 So, here goes:
 I'm trying to use the SeriesInterpolate effect with some ColumnSeries.
 The documented events are not being triggered. effectEnd is triggered,
 actually. But effectStart, tweenBegin, tweenEnd, tweenUpdate are not.

 I tried the other data effects: SeriesSlide and SeriesZoom as well.
 They both failed to trigger the above events also.

 The documentation states that the effectStart is triggered by a
 showData event, but I don't see that event documented (or I'd try to
 snag it, too).

 Have there been any updates to the charting components since Flex 3
 was released? Maybe these issues were already addressed? I checked the
 downloads and see an update to the SDK, but nothing on the charting
 components.

 Another little bit about what I'm really trying to do:
 I'd like to update the label, too, as the column expands/contracts.
 The data label retains the old value until the column tween is
 complete, then it updates to the new value. An option to update the
 label for the SeriesInterpolate effect would be really nice. At the
 very least, an option to hide the label while tweening, perhaps?

 At this point, I think I'm going to have the programmatically change
 the values with a Timer event, in conjunction with the data effect.

 Thanks a lot,
 K

  




 --
 Jason




-- 
Jason


Re: [flexcoders] Getting a the supplied DisplayObject must be a child of the caller error

2008-09-13 Thread Pan Troglodytes
The problem is your line:
addChild(win);

Omit that and you should stop getting that error.


On Wed, Sep 3, 2008 at 4:26 PM, lynnkuh [EMAIL PROTECTED] wrote:

   I'm using the Flex MDI Explorer and instead of using

 flexmdi:MDICanvas id=mdiCanvas horizontalScrollPolicy=off
 verticalScrollPolicy=off
 width=100% height=100% backgroundColor=#FF
 backgroundAlpha=0
 flexmdi:MDIWindow id=win1
 title=Window 1 has a really really long title to show support for
 truncation
 x=30 y=30 width=400 height=200 /
 flexmdi:MDIWindow id=win2
 title=Window 2
 x=450 y=30 width=250 height=300
 ns:SampleContent id=sample height=100% width=100% /
 /flexmdi:MDIWindow
 /flexmdi:MDICanvas

 I created an actionscript variable mdiCanvas. I'm getting the error
 when I try and minimize the window, close the window, or make it full
 size after calling the addWindow function. Here's my addWindow function:

 private function addWindow():void
 {
 var win:MDIWindow = new MDIWindow();
 win.width = 350;
 win.title = Window  +
 String(mdiCanvas.windowManager.windowList.length + 1);
 mdiCanvas.windowManager.add(win);
 win.addChild(new SampleContent());
 addChild(win);
 }

 How can I get the windows to work? I don't want the MXML windows open
 when I first start the application which is the default.

  




-- 
Jason


Re: [flexcoders] tree control child node color

2008-09-13 Thread Pan Troglodytes
First off, which menu do you mean at the website?  I only saw a menu at the
top, and all the nodes were all one color as far as I can tell.

But if you just wanted to specific a lit of colors for different levels, I
believe the depthColors style of Tree would be what you wanted.

On Tue, Sep 2, 2008 at 9:25 AM, ptelang2000 [EMAIL PROTECTED]
 wrote:

   I am using tree control to design a menu.I would like to have my menu
 exactly resembled with the menu which is there in www.knuth.de

 However I am unable to set color for the font(test) used in child node

 When the parent node is clicked how to open the child nodes with blue
 color?

 Thanks

  




-- 
Jason


Re: [flexcoders] circleItemRenderer border color

2008-09-13 Thread Pan Troglodytes
You may have already figured this out, but just in case - you need to use
the stroke style of the LineSeries:

mx:series
mx:LineSeries id=series yField=@open form=curve
displayName=Open stroke={circleStroke} /
/mx:series
/mx:LineChart

mx:Stroke id=circleStroke color=0x00FF00/


On Thu, Aug 28, 2008 at 2:25 AM, lolr3a [EMAIL PROTECTED] wrote:

   Hi, I've created circles for my data in a line chart.

 I'm able to change the line color to black, and the series' circles
 color to black,

 but I just can't change the circles border orange color - it seems to
 take it from the series default color...

 ?xml version=1.0?
 !--
 http://blog.flexexamples.com/2007/11/15/displaying-grid-lines-in-a-flex-\
 linechart-control/http://blog.flexexamples.com/2007/11/15/displaying-grid-lines-in-a-flex-linechart-control/--
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 layout=vertical
 verticalAlign=middle
 backgroundColor=white creationComplete=init()

 mx:Script
 ![CDATA[

 import mx.charts.renderers.CircleItemRenderer;
 import mx.graphics.Stroke;

 public function init():void{

 series.setStyle(lineStroke, new Stroke(0x00, 2,
 0.4));
 series.setStyle(fill, 0x00);

 series.setStyle(radius, 10);
 series.setStyle(adjustedRadius, 2);
 series.setStyle(itemRenderer, new
 ClassFactory(CircleItemRenderer));
 }

 ]]
 /mx:Script

 mx:XMLListCollection id=dp
 mx:source
 mx:XMLList
 quote date=8/27/2007 open=40.38 close=40.81 /
 quote date=8/24/2007 open=40.5 close=40.41 /
 quote date=8/23/2007 open=40.82 close=40.6 /
 quote date=8/22/2007 open=40.4 close=40.77 /
 quote date=8/21/2007 open=40.41 close=40.13 /
 quote date=8/20/2007 open=40.55 close=40.74 /
 /mx:XMLList
 /mx:source
 /mx:XMLListCollection

 mx:ApplicationControlBar dock=true
 mx:Form styleName=plain
 mx:FormItem label=GridLines direction:
 mx:ToggleButtonBar id=toggleButtonBar
 selectedIndex=0
 mx:dataProvider
 mx:Array
 mx:Stringhorizontal/mx:String
 mx:Stringvertical/mx:String
 mx:Stringboth/mx:String
 /mx:Array
 /mx:dataProvider
 /mx:ToggleButtonBar
 /mx:FormItem
 /mx:Form
 /mx:ApplicationControlBar

 mx:LineChart id=lineChart
 showDataTips=true
 dataProvider={dp}
 width=100%
 height=100%

 mx:backgroundElements
 mx:GridLines
 direction={toggleButtonBar.dataProvider.getItemAt(toggleButtonBar.selec\
 tedIndex)} /
 /mx:backgroundElements

 !-- vertical axis --
 mx:verticalAxis
 mx:LinearAxis baseAtZero=false title=Price /
 /mx:verticalAxis

 !-- horizontal axis --
 mx:horizontalAxis
 mx:CategoryAxis id=ca categoryField=@date title=Date
 /
 /mx:horizontalAxis

 !-- horizontal axis renderer --
 mx:horizontalAxisRenderers
 mx:AxisRenderer axis={ca} canDropLabels=true /
 /mx:horizontalAxisRenderers

 !-- series --
 mx:series
 mx:LineSeries id=series yField=@open form=curve
 displayName=Open /
 /mx:series
 /mx:LineChart

 /mx:Application

  




-- 
Jason


  1   2   3   4   >