views:

74

answers:

1

public class myObject{
private var numVar:Number
}

My AS file:
var temp:MyObject
temp.numVar = 0;

When I debug, temp.numVar contains a value of 0, but does not show anything on the UI. If this object is then saved to the DB, and then displayed to the UI, it shows a 0. My question is - how do I get temp.numVar to display 0 before persistenting it to the DB?

A: 

Try converting the value of temp.numVar to a string before you send it to the TextField.

See my example:

var numVar:Number = 0;

someTextField.appendText(String(temp.numVar));
letseatfood
i'm setting all the values on the backing object in the AS, and then the backing object is being used to display the properties on the screen. so since, the attribute `numVar` is of type Number, i cannot convert it to a string.
bwong
Can you describe what you mean by "backing object"? I'm not sure what that means.
letseatfood
the properties of `MyObject` are being set in AS, and then it is sent to the UI, and the attributes of `MyObject` are used to populate the fields on the UI. when the attributes of `MyObject` are being set, `numVar` is set to a zero value.
bwong
Do you have access to the UI code? It would help a lot if you could provide more code.
letseatfood
i'm using a framework that takes care of the UI presentation. and i don't have the source for that.but on the same topic, although the 0 value doesn't show up when using a new object, when it is saved into the database, it persists as an actual 0 value, and then when i'm grabbing the data from the DB, (using the same procedure - putting the values on the attributes of the object, and then passing it to the UI), the 0 value is displayed on the screen. i've seen that the Number datatype in AS treats 0 and null as the same. do you think this has anything to do with my issue?
bwong