-
Notifications
You must be signed in to change notification settings - Fork 385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extending the Label class #1814
Comments
We are using this code to generate a list of labels containg the hours of the day, that we then convert to a texture and use when needed. |
You don't need to call all of those other methods after setting the
|
The problem is a bit more complex. We are trying to draw on a So rather than creating multiple objects, we try to create one, and draw it in different positions and with different text, and we do this in a Maybe there is a better way to fill the texture with numbers. Any sugestion is appriciated. The other issue here is this error:
One sollution would be to add a condition and stop calling Since February we had about 1000 errors related to this. Same object class is used multiple times, during the normal usage of the app, but I don't have a statistic for that. So 1000 errors could be low, or coult be high, but it's certanly enough to demand a patch. Maybe in the future we will skip this dynamic generation and have all textures stored on a server based on DPI and download after install. Right now it's like a procedural texture, and saves the app 1-2Mb. For 3x resolution, this code generates 4 textures of 2048x2048px. But this is also a perfect copy of what air will render for text, and this was the main goal when we created this monster. |
After the label.minutes = newMinutes;
label.validate(); |
Hello,
We have extended the label class, but in order to get the text to actually update on the stage, we have to do some extra steps, that i think are time consuming.
this.textRenderer.text = Info.minutesToText(_minutesInt);
And then we need to call:
this.createTextRenderer(); this.refreshTextRendererData(); this.refreshEnabled(); this.refreshTextRendererStyles(); this.layoutChildren();
Without these last 5 lines, we can't be sure that the text actually changes on the stage.
Wondering if we can do it in a smarter way. Any help is appreciated.
Thank you.
The whole class looks like this:
`public class TimeTextLabel extends Label
{
private var _minutes:Number;
private var _minutesInt:int;
The text was updated successfully, but these errors were encountered: