This is a translated page. The original can be found here: http://www.designscripting.com/2008/10/calculating-filesize-converting-loaded-bytes/
Home » ActionScript 2.0 , ActionScript 3.0 Domů » ActionScript 2.0 , ActionScript 3.0

Calculating fileSize / converting loaded bytes Výpočet velikost souboru / konverze naloženo bytů

21 October 2008 21.října 2008 No Comment Bez komentáře

The function calculates values from Bytes to KB or MB. Funkce vypočítá hodnoty z bytů na KB nebo MB.
Here we are first checking the value of bytes and if its less that zero or not a number returns null. Zde jsme první kontrola hodnoty bytů a pokud je její menší než nula nebo není číslo vrací null.

Otherwise we are calculating, V opačném případě jsme pro výpočet,
1024 Bytes = 1 KB. 1024 bajtů = 1 KB.
1024 KB = 1 MB 1024 kilobajt = 1 MB

/** / **
* Calculates the File size * Počítá Velikost souboru
* *
* @param bytes Loaded bytes or file size in bytes * @ Param bytů Nabito bytů nebo velikost souboru v bajtech
* @return converted bytes to String. * @ Return převést byty na String.
*/ * /
function fileSize( bytes : Number ) : String Funkce velikost souboru (v bytech: Number): Řetězec
{ (
if(bytes<0 number =” Number(bytes/1024);” string =” Math.round(fileSize)”>0?(fileSize>1024?(fileSize/1024).toFixed(2)+”MB”:((fileSize.toFixed(2))+”KB”)):(fileSize*1024)+”Bytes” ; if (bajty <0 počet = "Číslo (bytes/1024)," string = "Math.round (velikost souboru)"> 0? (velikost souboru> 1024? (fileSize/1024). toFixed (2) + "MB": ( (fileSize.toFixed (2)) + "KB ")):( velikost souboru * 1024) +" bajtů ";

return FileSize_str; návrat FileSize_str;
} )

Download Source file Stáhněte si zdrojový soubor

VN:F [1.7.7_1013] VN: F [1.7.7_1013]
Rating: 0.0/ 10 (0 votes cast) Hodnocení: 0.0 / 10 (0 hlasů)
VN:F [1.7.7_1013] VN: F [1.7.7_1013]
Rating: 0 (from 0 votes) Hodnocení: 0 (z 0 hlasů)
Translate this post Přeložit tento příspěvek




Leave your response! Nechte Vaši odpověď!

Add your comment below, or trackback from your own site. Přidejte svůj komentář níže, nebo trackback z vašich vlastních stránek. You can also subscribe to these comments via RSS. Můžete si také objednat tyto komentáře přes RSS.

Be nice. Be Nice. Keep it clean. Udržujte jej v čistotě. Stay on topic. Pobyt na téma. No spam. Ne spam.

You can use these tags: Můžete použít tyto tagy:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To je Gravatar povolen-weblog. To get your own globally-recognized-avatar, please register at Gravatar . Chcete-li si své vlastní-celosvětově uznávaný-avatar, zaregistrujte se na Gravatar .

CAPTCHA Image
Obnovit obrázek