00:00
00:00
Newgrounds Background Image Theme

MatthieuxDancingDead just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Problems with pre-loaders?

294 Views | 2 Replies
New Topic Respond to this Topic

Problems with pre-loaders? 2014-04-09 21:09:09


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);
}

Problems with pre-loaders?


I'm nothing special, though I do master in the art of idiocy.

BBS Signature

Response to Problems with pre-loaders? 2014-04-09 21:14:43


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 (bytes_loaded == bytes_total) {
		
		removeEventListener(Event.ENTER_FRAME, Entering);
		gotoAndPlay(2);
	}
}

The problem is that your if(){} was not inside the function(){}.

Response to Problems with pre-loaders? 2014-04-09 21:55:35


The problem is that your if(){} was not inside the function(){}.

Thank you fine sir, you have assisted me in my quest of understanding Action Script 3.0, I'd been searchin' for a solution all day. Here, take a metaphorical cookie. *Hands cookie*


I'm nothing special, though I do master in the art of idiocy.

BBS Signature