Skip to content

Instantly share code, notes, and snippets.

@alun
Last active December 18, 2015 17:49
Show Gist options
  • Save alun/5820995 to your computer and use it in GitHub Desktop.
Save alun/5820995 to your computer and use it in GitHub Desktop.
The demo case how to wait until all images are loaded
package {
import com.oggi.Utilities.events.Synchronizer;
import com.oggi.Utilities.ui.DisplayList;
import com.oggi.ui.controls.Image;
import com.oggi.unit.Banner;
import flash.display.DisplayObject;
import flash.events.Event;
public class MyBanner extends Banner {
public function MyBanner() {
super();
waitImages();
}
protected function waitImages():void {
var images:Array = [];
DisplayList.walk(this, function (elem:DisplayObject):void {
if (elem is Image) {
images.push(elem);
}
});
new Synchronizer(images, allImagesLoaded).
useReleaseEvent(Event.COMPLETE);
}
protected function allImagesLoaded():void {
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment