You can do this, but you need to break up your "loop", and keep an index of where you are up to, then break out of that script to redraw the screen , then return back to the loop where you left off...
eg: if you are loading a large bitmap the one of the first 54 characters will tell you the size of the file..
so now you can ( in pseudo code)
store a global variable called index=0; //or wherever to start loading file/drawing large bitmap etc
store a global variable called size
and another called percentage=.1; //.1 =10 percent
then open the file, and get the size of the bitmap... for example lets say 500k
now in the loading routine
- Code: Select all
if (notloaded==true)
for (i=index;i<percentage*size) //do to 10 percent of size (from 0 to 50k)
{
//loading code here
}
index = i //current position ( if needed when you came back to this loop) now at 50k ( if size was 500k)
percent=percent +.1 //add another 10 percent
if (percent=>1)
(
notloaded =false
)
now in your view routine, or an actor for your fileprogress bar
- Code: Select all
if (notloaded==true)
{
//update progress bar here
)
then you can return to the file loading until complete
eg:
- Code: Select all
for (i=index;i<percentage*size) //do another 10 percent of size (this time from from 50 to 100k)
or something like that
feral (sorry haven't been around much)