[flexcoders] selecting a cell in an advanced data grid

2008-07-17 Thread fb6668
Hi, I have an advanced data grid with hierarchical data, displayed in
tree view.
Selecting a cell updates a pie chart to show the breakdown for the
node, by passing to a modelLocator value:
model.expenditure.selectedItem = e.itemRenderer.data as CategoryObject;
which the pie is bound to.

This is straightforward enough, but I also need it to work in the
other direction, so that if the pie segment is drilled-down into, the
selected cell in the ADG is changed. (The pie click updates the
model.expenditure.selectedItem). However, I don't know how to go about
finding this cell!
How can I loop through the ADG's elements to find the co-ordinates for
the cell to select??

I really hope you can help, this is driving me crazy!

mx:AdvancedDataGrid
designViewDataType=tree 
dataProvider={new 
HierarchicalData(rptAccordions.currentItem.children)}
showHeaders=false width=100% selectable=true
selectionMode=singleCell
variableRowHeight=true
creationComplete=addToDisplayItemArray(event) 
itemOpening=openTreeItem(event) itemClose=closeTreeItem(event) 
change=selectItem(event) 
mx:columns
mx:AdvancedDataGridColumn dataField=name width=202 /
mx:AdvancedDataGridColumn labelFunction=getClientAmount
width=108 /
mx:AdvancedDataGridColumn labelFunction=getPartnerAmount
width=108 /
mx:AdvancedDataGridColumn labelFunction=getJointAmount 
width=108 /
mx:AdvancedDataGridColumn labelFunction=getCombinedAmount /
/mx:columns
/mx:AdvancedDataGrid



[flexcoders] Dissolving between two charts

2008-07-08 Thread fb6668
Hi,

I have a line chart and a stacked column chart laid one over the other
in a canvas. I would like, when a button is pressed, to dissolve from
on to the other.

I figured setting the alpha of one chart to 0 and then doing a state
transition with an mx:Dissolve ../ would do the trick, and it works
to a large extent, but I have a real problem with the axes.

Setting the alpha property of the chart hides *only* the line or bars,
not the axes. Exactly the same setting the alpha of the chart's
container; only the coloured section of the chart is hidden. I set the
alpha on the AxisRenderers to 0, too, but this seemed to do nothing!

So the code below still shows the axes, which means that both chart
axes are visible in every state.

mx:Canvas width=70% height=100% id=cvsColumnChart alpha=0.0
mx:ColumnChart alpha=0.0
id=columnChart  
dataProvider={dpStackedLineChart} 
creationComplete=changeSeries()
width=100% height=100%
showDataTips=true 
dataTipFunction=renderColumnTips 
type=stacked

mx:verticalAxisRenderers
mx:AxisRenderer id=colChartVerticalAxis canDropLabels=true
axis={va1} alpha=0.0/
/mx:verticalAxisRenderers
mx:horizontalAxisRenderers
mx:AxisRenderer id=colChartHorizontalAxis 
canDropLabels=true
axis={catAxis1} alpha=0.0/
/mx:horizontalAxisRenderers
mx:verticalAxis
mx:LinearAxis id=va1/
/mx:verticalAxis
mx:horizontalAxis
mx:CategoryAxis labelFunction=renderDate id=catAxis1/
/mx:horizontalAxis
/mx:ColumnChart

/mx:Canvas

Any ideas how I can achieve a nice dissolve from one chart to another,
including the axes?

Thanks!



[flexcoders] selecting a pre-determined row in a datagrid

2008-06-26 Thread fb6668
Hi.

I have a datagrid component which has a dataProvider of an
arraycollection of objects.

I also have a variable selectedItem, which holds an object that has
been selected elsewhere in the application.

What I need is, when I create my datagrid, to set the background
colour of the row corresponding to this selectedItem object.

So I guess I need to loop through the dg's rows, comparing the
dataItem of the row to selectedItem. However, I don't know how to loop
the rows in a DataGrid?? 
It's so easy in C#.NET, and not here, so I think I may be approaching
this from the wrong angle.

Any ideas?

Thanks!



[flexcoders] Re: 'Pointer' in actionscript?

2008-06-19 Thread fb6668
Thanks, I figured it out that when using simple object types, things
seem to be passed by value, whereas with complex data types, they are
passed by reference.
So your suggestion of simply changing itemLocation to an
ArrayCollection sorted it out.

Cheers!

--- In flexcoders@yahoogroups.com, Amy [EMAIL PROTECTED] wrote:

 --- In flexcoders@yahoogroups.com, fb6668 fiona@ wrote:
 
  Hi.
  I have a custom component which uses data from my modellocator.
  Depending on the way this component is called depends where abouts
  this data comes from,
  
  ie:
  
  private var _itemLocation:Object;
  [Bindable]
  protected function get itemLocation():Object
  {
  if(isAssets)
  _itemLocation = model.factfind.assets;
  else
  _itemLocation = model.factfind.liabilities;
  
  return _itemLocation;
  }
  
  protected function set itemLocation(value:Object):void
  {
  _itemLocation = value;
  }
 
 You may want to try some combination of the following:
 
 1) Do the setting in the setter tather than the getter
 2) Type itemLocation as ArrayCollection rather than Object
 3) Use BindingUtils to set up a binding as shown in this example 
 http://www.returnundefined.com/2006/11/creating-truly-reusable-
 renderers-with-classfactory
 
 HTH;
 
 Amy





[flexcoders] binding mx:tree to custom class

2008-06-19 Thread fb6668
Hi,

I have a data structure which looks a little like this:

items:ArrayCollection  is an array of objects with class Item:

Item:
name:String
category:String
data:ArrayCollection  is an array of objects with class Detail:

Detail:
name:String
type:String  //either income or detail
val:Object

So, I would like to create a tree with dataProvider={items} that
looks like:
-Item[name]
  Detail[name]
  Detail[name]
  Detail[name]
-Item[name]
  Detail[name]
  Detail[name]

Now, if the data was in XML or just a basic ArrayCollection, this
would be straightforward, but not sure how to accomplish it with my
custom classes?

Sorry about the simple question, quite new to Flex!

Thanks for your help,

F



[flexcoders] 'Pointer' in actionscript?

2008-06-16 Thread fb6668
Hi.
I have a custom component which uses data from my modellocator.
Depending on the way this component is called depends where abouts
this data comes from,

ie:

private var _itemLocation:Object;
[Bindable]
protected function get itemLocation():Object
{
if(isAssets)
_itemLocation = model.factfind.assets;
else
_itemLocation = model.factfind.liabilities;

return _itemLocation;
}

protected function set itemLocation(value:Object):void
{
_itemLocation = value;
}

model.factfind.assets and model.factfind.liabilities are both
ArrayCollections.

then, later on, I have 

mx:Label text={itemLocation.selectedAssets.getItemAt(0).name}/

Now, this doesn't update as I'd expect when the first item in
itemLocation.selectedAssets changes (whatever itemLocation refers to)

If I change it to 
mx:Label
text={model.factfind.assets.selectedAssets.getItemAt(0).name}/
it works perfectly.

So it seems that when I do the set/get on itemLocation, it copies the
value of model.factfind.assets/liabilities rather than acting as a
pointer to that.

How do I get it to work like a pointer so when model.factfind.assets
changes, so does itemLocation, in order that I can use the same
component for both assets and liabilities?

Thanks



[flexcoders] Re: Thinking about going to the dark side....Apple Mac Book

2008-06-06 Thread fb6668
I use a little ole' MacBook for most of my development. All my .NET
stuff runs on my Windows partition using Parallels and Virtue
Desktops, faster than my fully-fledged PC lappy, and then enerything
else is done on OSX. I was a little dubious at first when this
configuration was advised to me, but it works fantastically. Devving,
testing and debugging in the two environments within one little
(beautifully crafted and developed) box. Awesome. 
If you are looking to get one, the new MacBook Pro is rumoured to be
announced on 9th June, so wait for that, and whatver you do, buy the
minimum RAM from Apple and upgrade it yourself, cuz theirs is a rip-off!

Personally, I would never buy a Dell after years of having problems
with their cheap and shoddy components. They may have got better in
recent years, but my previous experiences make me shudder every time I
hear the word Dell. 

--- In flexcoders@yahoogroups.com, Joseph Balderson [EMAIL PROTECTED] wrote:

 (Slightly off-topic) Recently I wanted to get a fully-loaded, workhorse 
 PC with XP-OEM installed, no crapware, and a matt screen (cause I
cannot 
 STAND the highly reflective screens that seem to be all the rage 
 nowadays) -- and I found it in the Dell Latitude D830. My review here:

http://www.joeflash.ca/blog/2008/04/how-i-bought-my-perfect-xp-laptop.html
 
 The other reason I bought it is that it's got a really solid 
 construction, no cheap plastic, and without weighing a ton -- and at my 
 former employers', that's all they would buy were the Latitude, so I 
 know they can take quite a beating.
 
 So if you're going to buy a PC laptop, it pays to dig for the 
 not-so-newest-fad to find quality.
 
 
 ___
 
 Joseph Balderson, Flash Platform Developer | http://joeflash.ca
 
 
 Anatole Tartakovsky wrote:
  I would stay away from Vaio for developers machine - a lot of
components 
  with proprietary Sony drivers, XP models are not compatible with
Vista 
  ones, no driver upgrades - they are OK for occasional/office user,
but 
  hard to work with if you need to re-image or add/replace hardware.
The 
  only one laptop comparable in my mind to MBP is Thinkpad T61 -
good LCDs 
  and hard drives, power supply that does work on airplane, cheap
memory 
  and comparable performance - but the quality has been declining
steadily 
  for years, so it becomes chancy. However, the parts and design are
still 
  OK for machine with lifespan of 2 years. We still buy them for our
staff 
  that goes to Windows only shops - the difference in the price for 
  identical hardware spec is about 30%.
  
  HTH,
  Anatole   
  
  On Thu, Jun 5, 2008 at 6:50 PM, Josh McDonald [EMAIL PROTECTED] 
  mailto:[EMAIL PROTECTED] wrote:
  
  They're not really pricey if you care about build and component
  quality and style though - Sure I could buy a cheap fugly dell for
  2/3 the price, but if I were stuck in Windows I wouldn't be caught
  dead using consumer laptops. Lousy components, ugly and too much
  cheap plastic. I'd have to go for a Vaio, which is priced like a
  Mackbook Pro anyway.
  
  
  
  On Fri, Jun 6, 2008 at 8:32 AM, Rob Rusher [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
  
  For years I said that I couldn't/wouldn't switch to a Mac
  because I always need to do Windows specific tasks. But, with
  the Intel-based MacBook Pro and Parallels, I have install
  Windows XP SP3 on a separate partition and can run the two
OS in
  tandem.
  
  So I've been on a Mac for a little over a year now. I love the
  form factor of the machine; light and small. It is very
  powerful. I can test alpha/beta software on Windows and Mac. I
  can do .NET development on Windows. I do Flex/AIR
development on
  both platforms.
  
  I'd say that I'm fat and happy, but I only weigh a buck forty.
  But I'm am happy!
  
  The down side, Macs are a little pricey.
  
  Regards,
  Rob
  
  On Thu, Jun 5, 2008 at 4:20 PM, Josh McDonald [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
  
  Anecdote of the minute: I'm fine on my bigass iMac, but
  there's 2 or 3 vista laptops in the office, and soapUI
seems
  to have some Vista incompatibilities. Could be the fact
  we're using 2.0.3 which AFAIK is still unreleased, but it
  could be Vista too :)
  
  On Fri, Jun 6, 2008 at 4:54 AM, Nancy Gill
  [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:
  
  Microsoft is already on record as pushing Windows
7 out
  the door as soon as possible (probably late 2009)
due to
  the Vista debacle .. remember Windows ME?   :)
   
  Nancy
   
  
  - Original Message -

[flexcoders] choosing line series

2008-06-05 Thread fb6668
I have a question about adding series to a LineChart.

My data looks like this (simplified pseudo-code):

selectedItems:ArrayCollection
{
   Item:myClass
   {
  id:int
  history:ArrayCollection
  {
 date:Date
 val:Number
  }
   }
}

so, a user adds objects of myClass to the selectedItem
ArrayCollection. There may be any number of these.

Now, I currently have a linechart which displays the history data for
any one myClass object:

mx:LineChart 
id=lineChart 
dataProvider={dp}
mx:horizontalAxis
mx:CategoryAxis categoryField=date /
/mx:horizontalAxis
mx:series
mx:LineSeries yField=val /
/mx:series
/mx:LineChart

So this plots val by date.
What I would like to do is amend this so that, rather than passing an
individual myClass object to the linechart, I pass an ArrayCollection
containing several, and then plot the val for *each* object's history
on a separate line.

The only examples of multiple series I have seen expects each object
to have a property relating to each series:

new ArrayCollection( [
{ Month: Jan, Profit: 2000, Expenses: 1500, Amount: 450 },
{ Month: Feb, Profit: 1000, Expenses: 200, Amount: 600 },
{ Month: Mar, Profit: 1500, Expenses: 500, Amount: 300 } ])
and then plotting Profit, Expenses and Amount as the three series
against Month.

Mine's subtley different... any ideas?

Thanks!



[flexcoders] confusion with events

2008-06-03 Thread fb6668
I have a question about how events are used.

I have a component which has the following sub-components:

mx:HBox width=100% id=assetBox
  view:AssetGraphPanel height=100%/
  view:AssetAccordion id=accordion /
/mx:HBox

The AssetGraphPanel itself contains components:

mx:PieChart id=topPie ...
/mx:PieChart

assets:SmallGraph person=Joint/
assets:SmallGraph person=Client/
assets:SmallGraph person=Partner/

These graphs need to change when a button inside the AssetAccordion is
clicked, by calling a function in SmallGraph called 'updateChart()'.
There will be other things that should also trigger this function to
be called, from other components.
So, how do I add an event listener/dispatcher so that the SmallGraph
can hear it whereever in the application it was fired from?
Seems to me I want the opposite of bubbling?

Thanks for your patience.



[flexcoders] Re: adding a label to a Panel header?

2008-06-02 Thread fb6668
Yippee!
Awesome, thanks guys, added a height and width and it worked a treat.

F

--- In flexcoders@yahoogroups.com, ben.clinkinbeard
[EMAIL PROTECTED] wrote:

  Is the size of the label actually being set?
 
 My guess would be no. Raw children are not automatically sized like
 normal children are so if its not being explicitly sized its probably
 got a width and height of 0.
 
 HTH,
 Ben
 
 
 
 --- In flexcoders@yahoogroups.com, Daniel Freiman FreimanCQ@ wrote:
 
  Is the size of the label actually being set?
  
  - Daniel Freiman
  
  On Fri, May 30, 2008 at 11:18 AM, fb6668 fiona@ wrote:
  
 Hi, I've extended the Panel container, and would now like to add a
   second text field to the header.
  
   I currently have code which has added am expand/contract button
to the
   header, using:
  
   rawChildren.addChild(btStateUp);
   rawChildren.addChild(btStateDown);
  
   but when I try to add a label, as follows, nothing is displayed:
  
   in createChildren():
  
   lblTotal = new Label();
   lblTotal.text = £200**;
   rawChildren.addChild(lblTotal);
  
   and in updateDisplayList():
  
   lblTotal.move(unscaledWidth - lblTotal.width - 10, y);
  
   Can anyone shed any light why it's not showing? I can include the
   whole script if required, but it's based on MaxRestorePanel which is
   in the FlexGrocer app.
  
   Thanks!
  

  
 





[flexcoders] adding a label to a Panel header?

2008-05-30 Thread fb6668
Hi, I've extended the Panel container, and would now like to add a
second text field to the header.

I currently have code which has added am expand/contract button to the
header, using:

rawChildren.addChild(btStateUp);
rawChildren.addChild(btStateDown);

but when I try to add a label, as follows, nothing is displayed:

in createChildren():

lblTotal = new Label();
lblTotal.text = £200**;
rawChildren.addChild(lblTotal);

and in updateDisplayList():

lblTotal.move(unscaledWidth - lblTotal.width - 10, y);

Can anyone shed any light why it's not showing? I can include the
whole script if required, but it's based on MaxRestorePanel which is
in the FlexGrocer app.

Thanks!