Comments (4)
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.
from feathersui-starling.
You don't need to call all of those other methods after setting the text
property. You can, in fact, be sure that the rendered text will change when the text
setter is called. The text
setter calls invalidate()
, which will cause the Label
to update itself before the next time that Starling renders.
public function set minutes(value:Number):void
{
_minutes = value;
if(_minutesInt != (value | 0)) {
// trace("[TimeTextLabel] - update text", value);
_minutesInt = value | 0;
this.text = Info.minutesToText(_minutesInt);
}
}
from feathersui-starling.
The problem is a bit more complex.
We are trying to draw on a RenderTexture
the same Object, that extends a Sprite, containing this extended Label, multiple times. This is done only once on first run and texture is saved to png.
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 for loop
. We were not able to validate it and force it to show. If we donβt add that extra code it will render a texture with 00:00 only. We need to force it to paint on each update.
Maybe there is a better way to fill the texture with numbers. Any sugestion is appriciated.
The other issue here is this error:
Uncaught Error // Error // Error: Error #3768 // Error: Error #3768
at starling.textures::ConcreteTexture/dispose()
at feathers.controls.text::TextBlockTextRenderer/dispose()
at starling.display::DisplayObjectContainer/removeChildAt()
at starling.display::DisplayObjectContainer/removeChild()
at feathers.controls::Label/createTextRenderer()
at ro.app.items::TimeTextLabel/set minutes()
One sollution would be to add a condition and stop calling createTextRenderer()
, since it's only required for texture generation. Out of the errors I've read, they were not in the texture generation part. I think error is given when probably app is in background. This might not be the most elegant fix.
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.
from feathersui-starling.
After the text
gets set, the Label
will be invalid, and it will need to update. Normally, this would happen before Starling renders the next frame. However, you can force it to happen immediately, like this:
label.minutes = newMinutes;
label.validate();
from feathersui-starling.
Related Issues (20)
- how to creat Vertica TextBlockTextRenderer? HOT 4
- Hidden rendering bug
- Null Object Reference when removing feathers control while parent is added to stage HOT 1
- BottomDrawerPopUpContentManager ignored panel.headerFactory
- Callout at borderline forgets to override arrowSkin
- LayoutGroup visible property HOT 11
- Is that a way to position the 'Toast' on top? HOT 1
- SoundChannelPeakVisualizer Implementation HOT 2
- VideoPlayer and screen rotation. HOT 2
- Error #1009 on Scroller/focusOutHandler HOT 2
- Default scale factor of MetalWorksDesktopTheme? HOT 1
- SDK Manager HOT 1
- TextInput width changes from focus in / focus out - Android Only HOT 8
- Object not removed from Stage on Android - Starling maybe? HOT 1
- VerticalLayout without virtual layout throws error on drag/drop HOT 2
- TextInput promptTextRenderer has no stateContext added
- Getting quite a few of these 3768 HOT 4
- Space triggers the last pressed button HOT 2
- Possible minor tweening issue in `BaseEffectContext` @ `playReverse()` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from feathersui-starling.