Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-24-2007, 12:49 PM
Member
 
Join Date: May 2007
Posts: 53
Default getURL slows down

I need to download files from network in my project.
i used:
inet.getUrl(distr_url, TMP_distrib_file_path);
ExternalInterface.call('MyGetUrl', distr_url, TMP_distrib_file_path);
fscommand('FFish_Eval', 'MyGetUrl("'+distr_url+'", "'+TMP_distrib_file_path+'")');

In any case, the app stopps performing any action while the file is not downloaded.

And another problem. When i use String(ExternalInterface.call('fileSize', appPath)), and rin my app from local disk drive, all works properly. But u run the app from a network shared folder it causes crytical error and my app closes immediately.

Now, i've found a solution: to rewrite this code http://msdn2.microsoft.com/en-us/library/aa384104.aspx in SWFKit :-)))
But, maybe you could show me a better way?

Thanks in advance.
__________________
#define true false //happy debugging, friends
Reply With Quote
  #2 (permalink)  
Old 05-24-2007, 01:49 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:getURL slows down

The File object in SWFKit does not work with a network shared file. Please use the following function to get the size of a shared file.

Code:
dllimport "kernel32.dll" stdcall long CreateFileA(String, long, long, 
pointer, long, long, long) as win32_createFile;
dllimport "kernel32.dll" stdcall long GetFileSize(long, pointer) as win32_getFileSize;
dllimport "kernel32.dll" stdcall Boolean CloseHandle(long) as win32_closeHandle;

function myGetFileSize(filename) {
if (filename.indexOf("\\\\") == 0) {
// a newwork shared file
var handle = win32_createFile(filename, 0x80000000/*GENERIC_READ*/, 
0x00000001/*FILE_SHARE_READ*/, null, 3/*OPEN_EXISTING*/, 
0x00000080/*FILE_ATTRIBUTE_NORMAL*/, 0);
if (handle != 0xFFFFFFFF) {
var size = win32_getFileSize(handle, null);
win32_closeHandle(handle);
return size;
}

return -1;
} else {
var f = new File(filename);
return f.size;
}
}
Reply With Quote
  #3 (permalink)  
Old 05-24-2007, 02:04 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:getURL slows down

The Inet object runs in block mode. That is to say, it will block the main window. To avoid the problem, you will have to give the main window chances to handle messages, for example, mouse clicks, repaint, etc, during downloading. That can be done by calling the processMsg method in the "onGetUrl" event handler.

Code:
var inet = new Inet;
inet.onGetUrl = function (type, msg) {
if (!processMsg()) 
return false;
return true;
}
inet.getUrl("...", "...");
Reply With Quote
  #4 (permalink)  
Old 05-24-2007, 04:22 PM
Member
 
Join Date: May 2007
Posts: 53
Default Re:getURL slows down

Thanks, it all works!
__________________
#define true false //happy debugging, friends
Reply With Quote
  #5 (permalink)  
Old 05-28-2007, 02:06 PM
Member
 
Join Date: May 2007
Posts: 53
Default Re:getURL slows down

The problem appearing when the inet.getUrl() blocks my app remains on some computers. I cant find the reason, but the problem exists on 2 computers from 10 tested. :-((
__________________
#define true false //happy debugging, friends
Reply With Quote
  #6 (permalink)  
Old 05-28-2007, 03:34 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:getURL slows down

Because the file downloading does not run in a separate thread, it is very hard to make the program 100% smooth, especially on a computer with a narrow band internet connection. If you think it is unacceptable, please wait for our http downloader activex component. But it also has its disadvantage that it supports only http files.
Reply With Quote
  #7 (permalink)  
Old 05-28-2007, 03:50 PM
Member
 
Join Date: May 2007
Posts: 53
Default Re:getURL slows down

Well, its quite needed feature. It is used, mainly, for auto-downloading newer versions of our app. And when the app hungs up for 1-15 mins - its, really, unacceptable.
What about that ActiveX component?
__________________
#define true false //happy debugging, friends
Reply With Quote
  #8 (permalink)  
Old 05-29-2007, 11:06 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:getURL slows down

http://www.swfkit.com/forum/thread_1_1772.html

It also supports FTP files, but it cannot resume a FTP download.
Reply With Quote
  #9 (permalink)  
Old 02-23-2009, 09:44 AM
Junior Member
 
Join Date: Feb 2009
Posts: 1
Default still can't work



my code

var inet = new Inet;
var filesize = inet.getHttpFileSize("http://www.baidu.com/img/baidu_logo.gif");


inet.onGetUrl = function(type, msg){
percent = Math.ceil((msg/filesize)*100);
FlashPlayer.targetGotoFrame("bar", percent);

if (!processMsg())return false;
return true;

}

inet.getUrl("http://www.baidu.com/img/baidu_logo.gif", getAppDir()+"baidu_logo.gif");


who can tell my, what's happen

code still can't work

when i run app, the main win is block

i have use processMsg();
Reply With Quote
  #10 (permalink)  
Old 12-03-2011, 03:41 PM
Junior Member
 
Join Date: Dec 2011
Posts: 4
Default

Quote:
Originally Posted by SWFKit View Post
http://www.swfkit.com/forum/thread_1_1772.html

It also supports FTP files, but it cannot resume a FTP download.
The link is dead. Where can I find this download component?
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:17 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.