Doublezer0
08-26-2010, 11:42 AM
In the Scaleform UILoader.as class in the onLoadComplete function we have this comment
private function onLoadComplete():Void {
onEnterFrame = null;
_loadOK = true;
draw(); // Use draw instead of invalidate to avoid flicker
dispatchEvent({type:"complete"});
}
However I found I was still left with the flicker problem with autosize enabled and sought to rectify the problem.
The fix was shuffling around the position of where visible was set and adding a couple of new places. If you want to get rid of the flicker just create a new UILoader class with a draw() function over-ride like so..
class com.f00n.xUILoader extends gfx.controls.UILoader {
public function xUILoader() {
super();
}
private function draw():Void {
if (!_loadOK) { return; }
contentHolder._xscale = contentHolder._yscale = 100;
//visibility was set here. Now moved below
if (!_autoSize) {
visible = _visiblilityBeforeLoad;
return;
}
if (contentHolder._width <= 0) {
if (_sizeRetries < 10) {
_sizeRetries++;
invalidate();
}
else { trace("Error: " + targetPath(this) + " cannot be autoSized because content _width is <= 0!"); }
return;
}
if (_maintainAspectRatio) {
contentHolder._xscale = contentHolder._yscale = Math.min(height/contentHolder._height,width/contentHolder._width) * 100;
contentHolder._x = (__width-contentHolder._width>>1);
contentHolder._y = (__height-contentHolder._height>>1);
visible = _visiblilityBeforeLoad; //added by 00
} else {
contentHolder._width = __width;
contentHolder._height = __height;
visible = _visiblilityBeforeLoad; //added by 00
}
}
}
Hope that helps avoid your flicking problems ;)
private function onLoadComplete():Void {
onEnterFrame = null;
_loadOK = true;
draw(); // Use draw instead of invalidate to avoid flicker
dispatchEvent({type:"complete"});
}
However I found I was still left with the flicker problem with autosize enabled and sought to rectify the problem.
The fix was shuffling around the position of where visible was set and adding a couple of new places. If you want to get rid of the flicker just create a new UILoader class with a draw() function over-ride like so..
class com.f00n.xUILoader extends gfx.controls.UILoader {
public function xUILoader() {
super();
}
private function draw():Void {
if (!_loadOK) { return; }
contentHolder._xscale = contentHolder._yscale = 100;
//visibility was set here. Now moved below
if (!_autoSize) {
visible = _visiblilityBeforeLoad;
return;
}
if (contentHolder._width <= 0) {
if (_sizeRetries < 10) {
_sizeRetries++;
invalidate();
}
else { trace("Error: " + targetPath(this) + " cannot be autoSized because content _width is <= 0!"); }
return;
}
if (_maintainAspectRatio) {
contentHolder._xscale = contentHolder._yscale = Math.min(height/contentHolder._height,width/contentHolder._width) * 100;
contentHolder._x = (__width-contentHolder._width>>1);
contentHolder._y = (__height-contentHolder._height>>1);
visible = _visiblilityBeforeLoad; //added by 00
} else {
contentHolder._width = __width;
contentHolder._height = __height;
visible = _visiblilityBeforeLoad; //added by 00
}
}
}
Hope that helps avoid your flicking problems ;)