School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!
You're Browsing As A Guest! Register Now...
Become an Expert!

Join 353,769 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,864 people online right now.Registration is fast and FREE... Join Now!



Preloader

Preloader "undefined property bytesTotal"

#1 ಠ_ಠ  Icon User is offline

  • D.I.C Head
  • PipPip

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


Dream Kudos: 0

Post icon  Posted 28 October 2009 - 11:14 AM

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
Was This Post Helpful? 0
  • +
  • -


#2 thehat  Icon User is offline

  • awake ? web();
  • Icon

Reputation: 100
  • View blog
  • Posts: 943
  • Joined: 28-February 08


Dream Kudos: 275

Re: Preloader

Posted 29 October 2009 - 01: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
  • PipPip

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


Dream Kudos: 0

Re: Preloader

Posted 29 October 2009 - 01: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 - 02:51 PM

Was This Post Helpful? 0
  • +
  • -

#4 thehat  Icon User is offline

  • awake ? web();
  • Icon

Reputation: 100
  • View blog
  • Posts: 943
  • Joined: 28-February 08


Dream Kudos: 275

Re: Preloader

Posted 30 October 2009 - 01: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
  • PipPip

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


Dream Kudos: 0

Re: Preloader

Posted 03 November 2009 - 03:34 PM

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



Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month