So I load a variable, length, into a LoadVars instance.
trace(this.length); //outputs 3
var tempLength:Number = this.length; //tempLength should be the number representation of the loaded value
thisObj.buttonLength = tempLength+2; //I need to add 2 onto the this.length value
trace(thisObj.buttonLength); //outputs 32, which kind of makes sense, but I need it to output 5.
Any ideas on how to go about this?
EDIT: Forgot to add-
thisObj.buttonLength is declared as a number, and Flash does not output a type mismatch.
try use Number() and put inside brackets what you need
like Number(tempLength)
this.length is what?
Ive tried your code… When I declare this.length as a string, no type mismatch warning, no nothing and the result is 32. When I declare this.length as a number, it works… It seem that type mismatch error is thrown only on direct value input as var variable:Number = “string”… I suggest you should use Number(this.length) to convert it to number.
Worked like a bloody charm gvozden, thanks a lot (you too, mathew.er ;))
I’m loading the number of pages from a MySQL database, the manually adding a home page on the top, and user admin page on the bottom, hence the need to add 2 to the number of pages loaded.