Using variables to add and subtract a number in a text field?
The adding bit works fine:
// get this pconn count
var this_p_conn:Number = Object(this).parent.p_conn;
// get current pconn total
var c_this_p_conn:Number = Object(root).part_count.p_conn_count.text
// add this pconn count to total pconn
var v_this_p_conn:Number = Number(this_p_conn+c_this_p_conn);
// Update total pconn with new value
Object(root).part_count.p_conn_count.text = String(v_this_p_conn)
Removing a value from the total is another story, this looks like it should work but it does not:
// get this pconn count
var count_p_conn:Number = Object(this).parent.p_conn;
// get current pconn total
var total_p_conn:Number = Object(root).part_count.p_conn_count.text;
// subtract this pconn count from total pconn
var new_p_conn:Number = Number(total_p_conn-count_p_conn);
// Update total pconn with new value
Object(root).part_count.p_conn_count.text = String(new_p_conn);
Any ideas or suggestions? My eyes are a bit blurry from looking at code, maybe I missed something obvious. Thanks in advance!
