From Adobe “You can assign a value to a variable, but you cannot assign a value to another value”. For me this happened when the ObjectProxy was not editable, but the object property on it was.
What does this mean? What is the difference between a value and a variable?
So it is pretty intuitive that a variable is a dynamic property that can change. But a value – what is that? Apparently a value is something that CANNOT CHANGE. So a read-only property, or something. So this error happens when you try and say something equivalent to 2=3. Make sure the thing on the left side of your assignment is allowed to change.
See http://curtismorley.com/2008/02/15/flex-2-flash-cs3-actionscript-error-1105 for a good theoretical example. The problem is that this error is triggered in situations where it wouldn’t seem like things you are assigning values to are read-only or un-changeable. But I think the bottom line is, if you get an 1105 error, you can assume that the thing on the left side of your assignment DOESN’T allow you to change it.
For me this happened because I wrapped an object in an object proxy, and then tried to set the value of the object proxy to the CreditVO (a custom Value Object based on a Remote class), instead of setting the object contained in the ObjectProxy (a variable) to the CreditVO. So the ObjectProxy itself was not editable, but the object property on it was.
“1105 Target of assignment must be a reference value. Description – You can assign a value to a variable, but you cannot assign a value to another value.”
//Simplified
myObjectProxy = theCredit;
//Mine
model.creditSearchResult.getItemAt(opener.creditSearchResultGrid.selectedIndex) = theCredit;
Should be:
//Simplified
myObjectProxy.<span style="color:red">object</span> = theCredit;
//Mine
model.creditSearchResult.getItemAt(opener.creditSearchResultGrid.selectedIndex).<span style="color:red">object</span>= theCredit;
same thing for both codes?
Sorry about the bad code snippet. There was a small difference, but I should have highlighted the code. In case you’re still interested, the difference was that assigning an ObjectProxy to a value is not allowed, but you CAN and SHOULD assign the ObjectProxy’s object attribute a value. So ObjectProxy.object = myObject instead of ObjectProxy = myObject.
Essentially, if you get an 1005, the thing on the left of the assignment in not changeable/editable/writable.
Thanks for the feedback. I’m in the process of cleaning the posts up.