On Tue, Feb 23, 2010 at 12:04 PM, Glen Pike <g...@engineeredarts.co.uk>wrote:

> Are you "listening" for Event.INIT or Event.COMPLETE for your preloader?
>  You should possibly use the former to make sure all your child clips are
> instanciated before you run AS3 code that accesses these child clips.
>

Yes. I changed COMPLETE to INIT and got the same error:

package
{
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.MovieClip;
import com.greensock.*;
import com.greensock.easing.*;
import flash.display.Loader;
import flash.events.ProgressEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
import flash.net.URLRequest;
 public class Preloader extends MovieClip
{
private var l:Loader = new Loader();
private var myTextField:TextField = new TextField();
 function Preloader()
{
init();
}
 function init()
{
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
l.load(new URLRequest("Splash.swf"));
addChild(myTextField);
myTextField.width = 250;
myTextField.x = stage.stageWidth/2 - 50;
myTextField.y = stage.stageHeight/2;
myTextField.selectable = false;
myTextField.border = false;
myTextField.borderColor = 0xAA0000;
myTextField.autoSize = TextFieldAutoSize.LEFT;
var myFormat:TextFormat = new TextFormat();
myFormat.color = 0xAA0000;
myFormat.size = 24;
myFormat.italic = true;
//myTextField.setTextFormat(myFormat);
myTextField.defaultTextFormat = myFormat;
}

function loop(e:ProgressEvent):void
{
var perc:Number = e.bytesLoaded/e.bytesTotal;
myTextField.text = Math.ceil(perc*100).toString() + "%";
}

function done(e:Event):void
{
removeChildAt(0);
myTextField = null;
addChild(l);
}
}
}

For Hendrik, I am currently downloading the debugger. It's big!
TIA,
Victor
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to