I'm trying to create a preloader for a flex application I'm making and I'm
using Ted's Custom Preloader as a basis for a start point. The problem I'm
having is when I try to add my child canvas to the screen that has the
labels I added to that canvas it is not showing on the screen. Is there
something more I need to do to be able to add the canvas to the stage? Any
help would be much appreciated. Here is the following code I have that
returns the canvas and does the addChild(). With this code I'm not returning
any errors so kind of at a loss atm.
// ----------------------------------------------------------------
// *****************CREATE LOADER INFO METHOD**********************
// ----------------------------------------------------------------
public function createLoadInfo():Canvas {
canvas = new Canvas();
canvas.width = 380, canvas.height = 115;
canvas.setStyle("backgroundColor", 0xFFFFFF);
label = new Label();
label.id = "gatewayText";
label.x = 0, label.y = 0;
label.setStyle("color", 0xFFFFFF);
label.setStyle("fontSize", 12);
label.text = "Initializing CFMX Gateway";
canvas.addChild(label);
label = new Label();
label.id = "securityText";
label.x = 0, label.y = 30;
label.setStyle("color", 0xFFFFFF);
label.setStyle("fontSize", 12);
label.text = "Initializing Security Checks";
canvas.addChild(label);
return canvas;
}
// ----------------------------------------------------------------
// *****************UPDATE VIEW METHOD*****************************
// ----------------------------------------------------------------
public function updateView(event:TimerEvent):void {
if( this.alpha < 1){
this.alpha = this.alpha + this.fadeInRate;
}
var loaderCanvas:Canvas = createLoadInfo();
loaderCanvas.x = loaderCanvas.y = 100;
this.stage.addChild(loaderCanvas);
this.stage.addChild(this);
this.x = this.stage.stageWidth/2 - this.width/2
this.y = this.stage.stageHeight/2 - this.height/2
this.visible = true;
if( this.ready && timer.currentCount > this.timeAutoClose )
gatewayHandler()
}