Actually, i don’t know if these qualify as gothcas or just wierd stuff. For some reason I seem to be running into little wierd flash issues that I’ve never noticed before.
First, I was using LoadVars.sendAndLoad to send some data to a script. The script wasnt sending anything back to flash yet, it just executed it’s code and that was it. But, I had already defined an onLoad event for the LoadVars object, which looked like this:
bc[as]. myVars_lv.onLoad = function(success){
if (success){
display.tl.gotoAndPlay(”success”);
}else{
display.tl.gotoAndPlay(”error”);
}
}
Strange enough, the onLoad event fired and sent the playhead to the success” frame. Im not sure whats going on there, I was thinking maybe there was some sort of communication going on where the server was telling flash that the script executed successfully?
The other little tiny bit of wierdness had to do with text fields. When you have an input text field (this one was created in the authoring environment), and you dont assign a character limit to to it, when you enter too much text into the textfield’s visible area it will start to push the text at the beginning of the text field off to the left.
That’s pretty basic and expected behavior. The situation I ran into was having a button that checked the value of the text field onPress, and if it was not a valid string it would set the text of the text field to some text like “not valid” (or whatever error message). Since the text has been overflowed to the left of the text field, any reassignment of text using the TextField.text property leaves the newly assigned text off to the left and out of sight.
The solution I came up with was to use the Selection object to refocus the text field, then reassign text to the field using TextField.replaceSel():
bc[as]. btn_mc.onPress = function(){
Selection.setFocus(this._parent.test_txt);
this._parent.test_txt.replaceSel(”not valid”)
}