Update object or merge

Advertisement
Hello!
Given 2 objects:
bigObj={id:1,name:"Test",time:3,colour:"blue"};
smallObj={name:"Test X",time:10};
How can I update the bigObj with data from smallObj?
Is there another way besides the classing 1-on-1 assignments: bigObj.name=smallObj.name etc?
Thanks!
Advertisement

Replay

Something like this maybe?
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               creationComplete="init()">
    <fx:Script>
        <![CDATA[
            protected function init():void
                var bigObj:Object = {name: 'donovan', color: 'blue', team: 'usa'};
                var smallObj:Object = {name: 'howard', color: 'black'};
                // copy the small object values into the big object
                for (var property:Object in smallObj)
                    bigObj[property] = smallObj[property];
                // print big object after updating the values
                trace(bigObj.name);
                trace(bigObj.color);
                trace(bigObj.team);
        ]]>
    </fx:Script>
</s:Application>