I've been working on a pre-loader for a little bit. I've had two problems, one is that when using the 'if(x){x}' function, I could not use variables and had to use the direct names. Another problem that I cannot solve is that I cannot figure out why the code doesn't make the animation play, but instead just keeps at 100% instead of auto-directing to video. Flash CS6, if you were wondering.
There are no errors, but it does just keep repeating this into the 'output': TypeError: Error #1009: Cannot access a property or method of a null object reference.
at InProgress1_fla::MainTimeline/Entering(). Though is only when simulated at T1 speed and above.
Finally here is the code:
stop();
addEventListener(Event.ENTER_FRAME, Entering);
function Entering (event:Event):void{
var bytes_loaded:Number = loaderInfo.bytesLoaded
var bytes_total:Number = loaderInfo.bytesTotal
var text_percentage:Number = bytes_loaded/bytes_total
var Rounded = Math.floor(text_percentage*100)
Bar.scaleX = text_percentage
textBox_txt.text = "%" + Rounded.toString() + "Loaded...";
} if (loaderInfo.bytesLoaded==loaderInfo.bytesTotal) {
removeEventListener(Event.ENTER_FRAME, Entering);
gotoAndPlay(2);
}
I'm nothing special, though I do master in the art of idiocy.