Jump to content
Search Community

LoaderMax with percentage of field

milcon test
Moderator Tag

Recommended Posts

Hi, I want to do with Loader Max a percentage of field, but get the error:

:?

 

This is my code without percentage of field, that function well:

 

package Max_SWF {

import com.greensock.loading.LoaderMax;
import com.greensock.events.LoaderEvent;
import com.greensock.loading.SWFLoader;


import flash.display.MovieClip;

public class LoaderMaxSWF extends MovieClip {







	public function LoaderMaxSWF() {
		var queue:LoaderMax=new LoaderMax({onProgress:progressHandler});
		queue.append(new SWFLoader("contatti.swf",{onComplete:completeHandler}));
		queue.load();

	}



	public function completeHandler(event:LoaderEvent):void {
		addChild(event.target.content);
	}


	public function progressHandler(event:LoaderEvent):void {
             myProgressBar.scaleX=event.target.progress;


	}
}
}

 

 

 

Here the code with percentage of field creating error:

 

package Max_SWF {

import com.greensock.loading.LoaderMax;
import com.greensock.events.LoaderEvent;
import com.greensock.loading.SWFLoader;


import flash.display.MovieClip;

public class LoaderMaxSWF extends MovieClip {
       private var kbps:Number;






	public function LoaderMaxSWF() {
		var queue:LoaderMax=new LoaderMax({onProgress:progressHandler});
		queue.append(new SWFLoader("contatti.swf",{onComplete:completeHandler}));
		queue.load();

	}



	public function completeHandler(event:LoaderEvent):void {
		addChild(event.target.content);
	}


	public function progressHandler(event:LoaderEvent):void {
                kbps+=(event.bytesLoaded / event.loadTime) / 1024;
                   mc_txt.text="loading"+ kbps.ToString()+"%";
		myProgressBar.scaleX=event.target.progress;
	}
}
}

 

 

 

thanks for your help

 

milcon

Link to comment
Share on other sites

G'day mate,

 

What error are you getting?

 

And just quickly glancing over your code, with this line:

 

mc_txt.text="loading"+ kbps.ToString()+"%";

 

The ToString method should be .toString. ie no capital on the T

 

mc_txt.text="loading"+ kbps.toString()+"%";

 

But yeah if you can post the error your getting it might help find the problem as well.

 

Cheers

 

-Z

Link to comment
Share on other sites

thanks for your answer, but my code not function:

 

the error is :

1119: Access of possibly undefined property bytesLoaded through a reference with static type com.greensock.events:LoaderEvent.

 

I have also imported the all package:

 

import com.greensock.loading.*;

 

and I did as you told me...

 

 kbps+=Number=(event.bytesLoaded/event.loadTime)/1024;
		mc_txt.text="loading"+kbps.toString()+"%";

:cry:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...