all groups > flash actionscript > august 2005 >
You're in the

flash actionscript

group:

Problem Numbers


Problem Numbers nomis_take
8/11/2005 7:41:57 PM
flash actionscript:
Hey there,
Does anyone know how to make for example 11,16946% to show as only 11% ?
So i want just to use/see te number before the comma...

Re: Problem Numbers NSurveyor
8/11/2005 7:55:31 PM
Use Math.floor... ie:

percent = 11,16946;
trace(""+percent+"%");
percent = Math.floor(percent);
Re: Problem Numbers kglad
8/11/2005 7:55:47 PM
that looks like a string, not a number. if so, use the string methods. for example:

yourS="11,16946%";
Re: Problem Numbers NSurveyor
8/11/2005 7:57:45 PM
Re: Problem Numbers nomis_take
8/12/2005 12:00:00 AM
Wel ok, it wasn't that clear... so here is the code that generates the % loaded
of a *.swf file.
So how can i make it so that LoadingProject_mc.loadedbytes_txt.text =
percentLoaded+" % loaded"; displays only the numbers before the period? not
something like 15.164684 % loaded but just 15 % loaded....

var loader:MovieClipLoader = new MovieClipLoader();

var loadListener:Object = new Object();
loadListener.onLoadStart = function(loadTarget) {
//some thing to preform on the load
};

loadListener.onLoadProgress = function(loadTarget, bytesLoaded, bytesTotal) {
var percentLoaded = bytesLoaded/bytesTotal*100;
LoadingProject_mc.loadedbytes_txt.text = percentLoaded+" % loaded";
};
loadListener.onLoadComplete = function(loadTarget) {
//some thing to preform on the complete
};

loader.addListener(loadListener);


Thanks for the help!

I'm not at a spanish like person by the way, rather belgium. :)

Matbe you geys now the solution of this little problem:
I have a site with some navigation buttons to brows trough some pictures (next
and prev)
Some times these buttons don't seem to respond correctly. Moving away from the
button and then again on it makes it work again. Sometimes it works without a
problem, somtimes it doesn't... strange
This is the code:

forward_btn.onRelease = function (){
this._parent.MainTarget_mc.nextFrame();

back_btn.onRelease = function (){
this._parent.MainTarget_mc.prevFrame();

Any suggestions? this is the site with these buttons http://www.nu-web.be
Re: Problem Numbers nomis_take
8/12/2005 12:00:00 AM
Re: Problem Numbers nomis_take
8/12/2005 12:00:00 AM
Thanx guys, Math.floor did the job!

Re: Problem Numbers NSurveyor
8/12/2005 12:00:00 AM
Re: Problem Numbers kglad
8/12/2005 4:21:42 AM
in europe they use a comma where we use periods for encoding numbers. but that
last symbol looks like a percent sign to me.

it could be a modolo sign, but then there should be another number that
follows % if it's really a modolo sign.

as often happens, i think the people answering these questions put a lot more
thought into their answers than the posters put into their questions. my guess
is the poster has moved on to something else already.
Re: Problem Numbers NSurveyor
8/12/2005 4:32:52 AM
I agree with you 100% ;) Just assuming by what the OP posted... it looks the
valeus from like some sort of preloader which means, he/she already has the
number part... I guess assumptions aren't enough... if only posters would give
detailed descriptions and describe the situation completely... these kinds of
things wouldn't happen, but you can't really do anything about it. Just have to
deal with it.
AddThis Social Bookmark Button