![]() |
![]() |
||||||
|
|||||||
| Tags: |
![]() |
|
|||
|
I have a database project and database values are shown in text sprites.
However, empty entries in database are shown as "null" text in sprites, and I'd like to remove that. Currently I have done that with enterframe function (which checks the values in text sprites and removes "null" texts). It works, but the "null" texts blinks for a second in the sprites before they're removed. Is there a way that I could control text sprites all the time, and remove "null" texts immediately? |
| Sponsored Links |
|
|||
|
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 = "" else myTextMember.text = myDatabaseEntry end if |
|
|||
|
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. To note, the text property does not belong to the sprite, but rather to the member so if you had a text member, created many sprites on the stage from that member and changed the text in one of them then that change will be reflected in all the text member's sprites. 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 then the code would be called again 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. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise