I am stuck on some basic AS syntax.

Here is some Adobe sample code:

[Bindable]
        public var dpac:ArrayCollection =  new ArrayCollection([
           {A:2000},{A:3000}, {A:6000} ]);
    
        public function addDataItem():void {
            var o:Object = {"A":2000};
            dpac.addItem(o);
        }
////////////////////////////////////////

Inside a loop, I need to add a data item to an arraycollection, but I
need to get the name of the data  and the result of the data from an XML
file.
OK I've got those two things working, but now my name and dataresult are
variables not ints and strings.

[Bindable]
        public var dpac:ArrayCollection =  new ArrayCollection;
        for each ( var something:XML in myXML.children()) {
                var dataresult:Obj = something ;  // don't know type of result 
ahead of time...
                var name:String = something.name ;
                
                var o:Object = { name + ':' + dataresult } // WRONG! ////////
                dpac.addItem(o);

        }

I am going wrong where I try to create an object out of method-results or 
variables that can be additem'ed to an arraycollection. 
And I don't really get the curly brace syntax, as you can see...

Thanks for guidance here...
John

PS what is the proper name for this like 'passing by reference vs passing by 
value' or?


Reply via email to