-
how would I increment a value (1, 2, 3, 4, etc.) in a textbox. The value is to be incremented by one each time object1 hits object2. I have this...but it stays at 1.
var cal = i;
i = 1;
if (this.hitTest(_root.box1)){
_root.score = i++;
}
}
-
var cal = i;
i = 1;
if (this.hitTest(_root.box1)){
_root.score = i++;
}
} [/B][/QUOTE]
Don't use the variable method. Use the object method:
Assuming yoor score field is given an instance name of score_txt (always use _txt as a prefix, so that the code editor gives you code clues)
var cal = i;
i = 1;
if (this.hitTest(_root.box1)){
_root.score_txt.text = i++;
}
}
-
can you explain a little more why I need to use the .text and give the textbox an instance name? I thought that by giving it a var name was enough. Is this new to flash mx?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|