Preloader

"undefined property bytesTotal"

Page 1 of 1

4 Replies - 2010 Views - Last Post: 03 November 2009 - 04:34 PM

#1 ಠ_ಠ  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 114
  • Joined: 26-September 08

Preloader

Post icon  Posted 28 October 2009 - 12:14 PM

I'm trying to access some built in functions but i keep getting errors.
I'm using ActionScript 3.

I'm following this tutorial:
http://www.youtube.c...h?v=oC31Pc5SCHM

stop();

addEventListener(Event.ENTER_FRAME,LoaderF);

function LoaderF (e:Event):void{
	var toLoad:Number = LoaderInfo.bytesTotal;
	var Loaded:Number = LoaderInfo.bytesLoaded;
	var Total:Number = Loaded/toLoad; 
	if (Loaded == toLoad)
	{
		removeEventListener(Event.ENTER_FRAME,LoaderF);
		gotoAndStop(2);
	} 
	else 
	{
		Preloader_MC.Preloader_FillBar.scaleX = Total;
		Preloader_MC.Precent_txt.text = Math.floor(Total = 100) + "%";
		Preloader_MC.Of_Bytestxt.text = Loaded + "Bytes";
		Preloader_MC.Total_Bytes.text = toLoad + "Bytes";
	}
}



Errors:

1119: Access of possibly undefined property bytesTotal through a reference with static type Class.

1119: Access of possibly undefined property bytesLoaded through a reference with static type Class.


Heres the file:
http://www.mediafire.com/?u4y3gahijj0

Is This A Good Question/Topic? 0
  • +

Replies To: Preloader

#2 thehat  Icon User is offline

  • awake ? web();
  • member icon

Reputation: 106
  • View blog
  • Posts: 951
  • Joined: 28-February 08

Re: Preloader

Posted 29 October 2009 - 02:11 AM

In as3 every display object has a loaderInfo property. You should use this rather than the actual LoaderInfo class. I'll assume that you're wanting to monitor the loading progress of your swf:
var toLoad:Number = this.root.loaderInfo.bytesTotal;
 var Loaded:Number = this.root.loaderInfo.bytesLoaded;


Was This Post Helpful? 1
  • +
  • -

#3 ಠ_ಠ  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 114
  • Joined: 26-September 08

Re: Preloader

Posted 29 October 2009 - 02:38 PM

That did it.
I'm having trouble with the percent, it just stays at 100%.

stop();

addEventListener(Event.ENTER_FRAME,LoaderF);

function LoaderF (e:Event):void{
	var toLoad:Number = this.root.loaderInfo.bytesTotal;
 	var Loaded:Number = this.root.loaderInfo.bytesLoaded;
	var Total:Number = Loaded/toLoad;
	if (Loaded == toLoad)
	{
		removeEventListener(Event.ENTER_FRAME,LoaderF);
		gotoAndPlay(2);
	}
	else
	{
		Bar.scaleX = Total;
		Percent.text = Math.floor(Total = 100) + "%";
		DT_Loaded.text =  Loaded + ": Bytes Loaded";
		DT_Bytes_Loaded.text = (toLoad - Loaded)  + " :Bytes Left";
	}
}



Heres the file:
http://www.filefacto...n/Loading_2_fla

Also, How the do you turn off that little circle when you use the line tool.Its driving me nuts.

This post has been edited by ಠ_ಠ: 29 October 2009 - 03:51 PM

Was This Post Helpful? 0
  • +
  • -

#4 thehat  Icon User is offline

  • awake ? web();
  • member icon

Reputation: 106
  • View blog
  • Posts: 951
  • Joined: 28-February 08

Re: Preloader

Posted 30 October 2009 - 02:18 AM

What you're doing here:
Percent.text = Math.floor(Total = 100) + "%";

is setting the value of Total to 100, then appending a percentage sign. To calculate a percentage you divide the bytesLoaded by the result of bytesTotal divided by 100, or:
var perc:Number = Loaded/(toLoad/100);


That little circle you're talking about, is that the snapping indicator that locks lines to multiples of 90 degrees? Try turn off object snapping, View -> Snapping -> Snap to Objects.
Was This Post Helpful? 1
  • +
  • -

#5 ಠ_ಠ  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 114
  • Joined: 26-September 08

Re: Preloader

Posted 03 November 2009 - 04:34 PM

Thank you.
Everything works now. :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1