Jump to content
Search Community

How to display loading 100% in a dynamic text box

Nickbee test
Moderator Tag

Recommended Posts

I know this is more of an action script question but here it is….

 

When I use the following:

 

function progressHandler(event:LoaderEvent):void {
trace("progress: " + event.target.progress);
var pcent:Number = Math.ceil((event.target.progress)*100);
loading_txt.text = "loading portfolio " + pcent.toString() + “%”;
}

 

Is displays fine until it gets to a higher number then I get just loading portfolio in my text box with no number or %

 

If I drop the “%” from the end of my text like so

 

 function progressHandler(event:LoaderEvent):void {
trace("progress: " + event.target.progress);
var pcent:Number = Math.ceil((event.target.progress)*100);
loading_txt.text = "loading portfolio " + pcent.toString() ;
}

 

I get up to loading portfolio 100 with no issues.

 

What would be the proper way to display loading portfolio 100% ???????

 

Thanks!

Link to comment
Share on other sites

What exactly is a "higher number"? Over 50?

 

Might it have to do with the fact that you're using funky double quotes like “” instead of ""? Otherwise, I can't see any problem with your code that would cause that issue. If you're still having trouble, please post a simple FLA that demonstrates the issue so we can publish it on our end and see it happening.

Link to comment
Share on other sites

I'm confused - I just tested your file multiple times and the loading percent populated that TextField perfectly every time. I watched it go from 0 to 100% smoothly over time. Never glitched. What do I need to do in order to see the problem?

 

(by the way, just for kicks, have you tried removing the .toString() from your variable? It should automatically cast it as a String anyway)

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...