Copy link to clipboard
Copied
i checking speed test. so this script showing like 504.254654 value.
but i don't want to after desimal(.) numbers.
(like 504 only)
value.text = String( ( ( file.size/myTimer.currentCount ) / 1024 ) * 8 );
value.text = String( int(( ( file.size/myTimer.currentCount ) / 1024 ) * 8 ));
You can just cast it to a type that doesn't support floating point values, like ints.
Copy link to clipboard
Copied
var splitString:String = String( ( ( file.size/myTimer.currentCount ) / 1024 ) * 8 );
var splitStringArra:Array = splitString.split('.');
value.text =
splitStringArra[0].toString();
Copy link to clipboard
Copied
value.text = String( int(( ( file.size/myTimer.currentCount ) / 1024 ) * 8 ));
You can just cast it to a type that doesn't support floating point values, like ints.
Copy link to clipboard
Copied
YOu can just convert the number to an int before you convert it to a String...
value.text = String( int( ( file.size/myTimer.currentCount ) / 1024 ) * 8 );
Copy link to clipboard
Copied
Beat you by 5 minutes! Haha
Copy link to clipboard
Copied
Thank you for all.
and one more thing
in my function >= 256 this test pass visible upPass button. but not showing in this function. what am i worng?
function show_message(e:DataEvent)
{
tm.stop();
value.text = String( int( ( ( file.size/tm.currentCount ) / 1024 ) * 8 ) );
uploadTest();
}
function uploadTest()
{
if (Number(upSpeeds) >= 256)
{
upPass.visible = true;
}
else{
upFail.visible = false;
}
}
Copy link to clipboard
Copied
I think if the speed is >= 256 then you want upPass.visible = true; like you have it but if it's less then you should set upFail.visible = true;. You're currently setting its visibility to false;
Aside that, are you saying the upPass button isn't showing if the speed is greater than 256? Is the instance name (not the library name) of upPass and upFail set properly? Is the alpha also set to 1?
Copy link to clipboard
Copied
upFail.visible = true; is currect, that is my mistack.
i'm using trace but showing only "Fail".
i getting value in "upSpeeds" text 256 above but showing "Fail"...
function uploadTest()
{
if (Number(upSpeeds) >= 256)
{
upPass.visible = true;
}
else{
upFail.visible = true;
}
}
Copy link to clipboard
Copied
Can you run a trace inside that function to verify data?
e.g.:
function uploadTest()
{
trace("upSpeeds: " + upSpeeds); // see what the function sees
if (int(upSpeeds) > 256)
{
upPass.visible = true;
}
else
{
upFail.visible = true;
}
}
Typically you may see the text is correct but if the variable wasn't defined in a global scope it is not available to the function and it will trace this to output:
upSpeeds: undefined
If that's the case you know upSpeeds needs to be defined on a global level so it can be utilized in that function.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Ah then it would have traced:
upSpeeds: [object TextField]
And then you'd know why it wasn't working . Trace often if you can, it's a very simple tool to debug.
Glad you got it working and good luck!
Copy link to clipboard
Copied
yes really.
i am beginner, so.....some mistacks.
any way Thank you.
Copy link to clipboard
Copied
You are welcome and good luck!