Copy link to clipboard
Copied
Hey, I was just in the middle of my programming and I wrote this onto some dynamic text:
var wood:Number;
wood = 0;
var water:Number;
water = 0;
var s_water:String;
s_water = toString(water);
var s_wood:String;
s_wood = toString(wood);
statsInstance.text = "wood: " + s_wood + " water: " + s_water;
And then when I run it, the text shows:
wood: [object object] water: [object object]
Please help!
Thanks.
there is a method toString(), it's not used like that.
and, it's not clear what you're trying to do but you'll probably come closer to what you want by casting wood and water as strings:
var wood:Number;
wood = 0;
var water:Number;
water = 0;
var s_water:String;
s_water = String(water);
var s_wood:String;
s_wood = String(wood);
statsInstance.text = "wood: " + s_wood + " water: " + s_water;
Copy link to clipboard
Copied
there is a method toString(), it's not used like that.
and, it's not clear what you're trying to do but you'll probably come closer to what you want by casting wood and water as strings:
var wood:Number;
wood = 0;
var water:Number;
water = 0;
var s_water:String;
s_water = String(water);
var s_wood:String;
s_wood = String(wood);
statsInstance.text = "wood: " + s_wood + " water: " + s_water;
Copy link to clipboard
Copied
Thx! You helped me alot!!!!!!!! XD XD
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now