[flexcoders] Get parent object in an array collection

2008-11-26 Thread timgerr
Hello all,
I am using an array collection as a dataprovider for the Kap Lab
(http://lab.kapit.fr/display/visualizer/Visualizer) which is like a
spring graph.  So when I click on an end node, I get the id of the
node. If I have an id to an object, how can find the parent object and
get access to it?  Has anyone done this before?  Here is my
ArrayCollection:

private var myDataProvider:ArrayCollection = new ArrayCollection([
{Region:Southwest,ID:1, children: [
 {Region:Arizona,ID:2, children: [  
{Territory_Rep:Barbara Jennings, ID:3}, 
{Territory_Rep:Dana Binn,ID:4}]},  
 {Region:Central California,ID:5, children: [ 
 {Territory_Rep:Joe Smith, ID:6}]},  
 {Region:Nevada, ID:7, children: [ 
 {Territory_Rep:Bethany Pittman,ID:8}]},  
 {Region:Northern California, ID:9, children: [ 
 {Territory_Rep:Lauren Ipsum,ID:10}, 
 {Territory_Rep:T.R. Smith,ID:11}]},  
 {Region:Southern California,ID:'12', children: [ 
 {Territory_Rep:Alice Treu, ID:'13'}, 
 {Territory_Rep:Jane Grove,ID:14}]}
]}
]);

Thanks for the read,
happy TGiving ,
timgerr



RE: [flexcoders] Get parent object in an array collection

2008-11-26 Thread Alex Harui
If you are just using dynamic objects, I would pre-process the objects and add 
parent properties.

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of timgerr
Sent: Wednesday, November 26, 2008 1:51 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Get parent object in an array collection


Hello all,
I am using an array collection as a dataprovider for the Kap Lab
(http://lab.kapit.fr/display/visualizer/Visualizer) which is like a
spring graph. So when I click on an end node, I get the id of the
node. If I have an id to an object, how can find the parent object and
get access to it? Has anyone done this before? Here is my
ArrayCollection:

private var myDataProvider:ArrayCollection = new ArrayCollection([
{Region:Southwest,ID:1, children: [
{Region:Arizona,ID:2, children: [
{Territory_Rep:Barbara Jennings, ID:3},
{Territory_Rep:Dana Binn,ID:4}]},
{Region:Central California,ID:5, children: [
{Territory_Rep:Joe Smith, ID:6}]},
{Region:Nevada, ID:7, children: [
{Territory_Rep:Bethany Pittman,ID:8}]},
{Region:Northern California, ID:9, children: [
{Territory_Rep:Lauren Ipsum,ID:10},
{Territory_Rep:T.R. Smith,ID:11}]},
{Region:Southern California,ID:'12', children: [
{Territory_Rep:Alice Treu, ID:'13'},
{Territory_Rep:Jane Grove,ID:14}]}
]}
]);

Thanks for the read,
happy TGiving ,
timgerr