tags:

views:

104

answers:

3

how can I fix this error ?

Target of assignment must be a reference value

for (var z:int=0; z<this.tags.getItemAt(i).yearPopularity.length; z++) {    
  summedPopularity.getItemAt(z) = summedPopularity.getItemAt(z) + tags.getItemAt(i).yearPopularity.getItemAt(z);
                }

thanks

A: 

I'm not sure you can assign to the value returned by getItemAt()

try:

for (var z:int=0; z<this.tags.getItemAt(i).yearPopularity.length; z++) {    
  var tempItem:Object = summedPopularity.getItemAt(z) + tags.getItemAt(i).yearPopularity.getItemAt(z);
  summedPopularity.setItemAt(tempItem, z);
}
quoo
A: 

This error means your trying to give a value (or a read only object) a value. If summedPopularity.getItemAt(z) is the only thing accepting anything,try changing that to a var

var someVariable:Number =0;
for (var z:int=0; z<this.tags.getItemAt(i).yearPopularity.length; z++) {    
  someVariable = summedPopularity.getItemAt(z) + tags.getItemAt(i).yearPopularity.getItemAt(z);
}

I think this would work fine,

thus denoting summedPopularity.getItemAt(z) is an object type.

trace(summedPopularity.getItemAt(z)); //<<< Debug stop and inspect

Try that, aside from that, you'll have to give us more code and show us what summedPopularity is.

Hope it helps.

Glycerine
A: 

I've solved with summedPopularity[i] instead of summedPopularity.getItemAt(i)

Patrick