• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Tracing the size of my file in my AIR app + tracing size of my server file?

Contributor ,
Jan 08, 2018 Jan 08, 2018

Copy link to clipboard

Copied

I've got an xml file in my AIR app and I'm trying to determine his size. Here's what I did :

var file:File = File.applicationStorageDirectory.resolvePath("horaires3.xml"); 
trace
(file.url); //path to the file trace(file.size);

But I've got this error : Error #3003: File or directory does not exist.

The file.url is working, but the file.size is throwing the error..

2nd question (related) :

Can I check the size of a file in my server with AS3 code ?

Would it be something as simple as :

var myURL:URLRequest = new URLRequest("http://www.mywebsite/my_xml.xml");
trace(myURL.size); 

What I want to do is :

If (file.size == myURL.size)
{
//do nothing
}
else{
downloadmyURL
();
}
TOPICS
ActionScript

Views

471

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 09, 2018 Jan 09, 2018

Copy link to clipboard

Copied

The File class does not have a size property.  For the size you can use the FileReference class.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 09, 2018 Jan 09, 2018

Copy link to clipboard

Copied

What do you mean ?

var file:FileReference = File.applicationStorageDirectory.resolvePath("horaires3.xml");

??

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 10, 2018 Jan 10, 2018

Copy link to clipboard

Copied

LATEST

What I mean is that you should be looking at how to work with the FileReference class instead of the File class if you want to get the file size.  Classes are basically all the same in that they have properties, methods, and events.  So any time you are wondering what information you can acquire from a particular AS3 class, you can look it up in the AS3 documentation and see what is available.  Then you can look for examples on how to implement the class so that you are able to acquire the information you are seeking.

FileReference - Adobe ActionScript® 3 (AS3 ) API Reference

File - Adobe ActionScript® 3 (AS3 ) API Reference

Adobe Flash Platform * Using the FileReference class

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines