This content has been marked as final. Show 4 replies
It sounds like you're testing for null after the text is updated. You want to find the place in your code where the new value from the DB is set into text. Test for null there.
How, when and where does your code add the "null" entry to the text sprite? That's the moment to check the value of the entry. Here's some pseudo-code:
if myDatabaseEntry = "null" then
myTextMember.text = ""
myTextMember.text = myDatabaseEntry
The values are entered in enterframe and I can build the value checking to the phase when the database value is put to the text member. I was just wondering if there is some simple option, because I have 50 text sprites each with separate "enter this database value to this sprite" code.
start learning about behaviors, scope, OOP programming and how Director handles OOP, and then you'll see the benefits to attaching behaviors to sprites, parent scripts and movie scripts.
The reason why a frame script is a bad idea (if you're using frame scripts or even if you're using on enterframe handler in a behavior script) is that if you looped on that frame or the playhead passed over that frame several times then the code would be called repeatedly unless a conditional was put in place to control that... in which case I would then think to myself there's probably a better way to do this... the type of code you want to put in an on enterframe or frame script is code that typically needs to be updated every frame such as moving a sprite on the stage or changing it's colour, or checking the status of some sprite property, for instance... what you want to use is a movie script or a parent script with some behavior scripts attached to your text sprites as listeners... so, your movie or parent script would do all the difficult database stuff and then it would send the appropriate message and data to the text sprites.