The Array that is being passed in to the class, is in the format of
Object, not Array. The array is coming from an ArrayCollection, and I
am using getItemAt to reference it.

Below is my PieChart class.

It will display the first object in the array as an item in the chart
legend, but only the first object. Maybe my array isn't formatted right.

So if this is my array that is being passed in:
Array({label: 'A', label: 'B', label: 'C', label: 'D'});

..the legend is showing A, and only A

public class CustomPie extends PieChart{

        public var alternateLegendData:Object;
                
                public function CustomPie(){
                        super();
                        
                }
                
                override public function get legendData():Array{
                        
                        trace("CustomPie: " + 
ArrayUtil.toArray(alternateLegendData));
                        
                        var tmpArray:Array = new Array();
                        if (alternateLegendDataArray != null){
                                tmpArray = alternateLegendData as Array;
                        }
                        return tmpArray;
                }
        }
}


--- In [email protected], "Ralf Bokelberg"
<[EMAIL PROTECTED]> wrote:
>
> Hi Jayson
> 
> What exactly is not working?
> 
> Ralf.
> 
> On Wed, Aug 20, 2008 at 8:32 PM, Jayson <[EMAIL PROTECTED]> wrote:
> > Yeah, Flex suggests that when you do Array(Object) - it gives you a
> > warning and suggests do to what you suggested. That didn't work for me
> > either.
> >
> > --- In [email protected], "Ralf Bokelberg"
> >
> > <ralf.bokelberg@> wrote:
> >>
> >> The "as" operator might help you out, eg.
> >>
> >> var a : Array = SomethingFromSomwhere as Array;
> >>
> >> Ralf.
> >>
> >>
> >> On Wed, Aug 20, 2008 at 7:39 PM, Jayson <j4ys0n@> wrote:
> >> > I have a class that extends PieChart(I'm calling this
CustomPie) and
> >> > I'm passing in an array returned from an ArrayCollection. The new
> >> > array I've called "alternateLegendData." So I define this as a
public
> >> > variable(Object) in the class and I can now pass in a new
parameter.
> >> > My goal is to use this array being passed in as the data for the
> >> > PieChart legend.
> >> >
> >> > In mxml in CustomPie, I have
> >> > alternateLegendData="{myArrayCollection.getItemAt(x)}" - this
works,
> >> > and it passes in the right array, but for some reason it is an
Object
> >> > and not an Array and I cannot manipulate it.
> >> >
> >> > So my problem is that I built an ArrayCollection:
> >> >
> >> > myArrayCollection.addItem(array1);
> >> > myArrayCollection.addItem(array2);
> >> > myArrayCollection.addItem(array3);
> >> > myArrayCollection.addItem(array4);
> >> >
> >> > So essentially the ArrayCollection is, as the name states, a
> >> > collection of arrays.
> >> >
> >> > When I do, for example, myArrayCollection.getItemAt(1), an
Object is
> >> > returned and not an Array.
> >> >
> >> > I've tried doing Array(myArrayCollection.getItemAt(1)),
> >> > ArrayUtil.toArray(myArrayCollection.getItemAt(1)) - neither of
these
> >> > will return an array.
> >> >
> >> > Anyone have an idea?
> >> >
> >> >
> >>
> >
> >
>


Reply via email to