The easy answer is, "No." The harder answer is maybe....
All the code in a given frame will need to execute before that frame can be rendered and there is no way around that. So if your init() function is doing a lot of math and loops and stuff and such you will just have to wait until the whole init() function is executed before the frame will be finished.
But if the calculations can be broken down into steps then you can figure out what is a reasonable sized step, calculate it, update the "preloader," do the next step. Sometimes that process can make the whole thing take a bit longr, but 7 seconds of updated progress is much better than 5 seconds of apparent frozenness. (Is that a word?) At least to my way of thinking.
I don't know what the issue is with the local vs. on-line issue, but chunking up the problem will probably fix that too.
If you can share what you are doing perhaps there is a common solution?
what i'm doing is a lot of vector graphics creation. i'm trying to avoid loading bitmaps so nearly everything on screen is a vector graphic or text field.
the thing i don't understand with your chunking solution is, if everything has to ultimately execute at startup, how do i stop and update the preloader in the middle of the subroutines if the entire startup routine has to execute. what's the action to stop/update but then continue after the update?
this is all in code. nothing in frames in the timeline.
The usual way is to use a Timer or a setInterval. So if you know that you need to create 1,000 vector shapes and you know that it takes 10 second to do all of them. So instead of trying to do them all in one function you would set a Timer that called a function every little bit -- something like 50 milliseconds or so.
Then you would make a list of the shapes you needed to create, start a timer that called a function every 50 milliseconds, each time the timer calls the function it will make (just to be on the safe side) 4 of the vectors, crosses them off the list of those that need to be created, then the function would be done, the frame would render, any preloader could render, and so on. It would repeat until the list of vectors that need to be created was empty.
You would probably want a custom class that handled this and dispatched some kind of progress and complete events.
However I'm not sure why you are taking this approach. You can create all the clips inside the Flash IDE and then export them for actionscript. Then it is just a mater of loading them and the preloaders for that are generally simpler that what you are doing.
There are also probably tricks to making things appear to be created and load more quickly.
thx a lot rothrock. breaking it up with setTimer() did the trick. updates are now happening between subroutines. that's a big help!
but i'm curious about your other solution. i understand creating the vectors in the IDE and exporting to actionscript but won't i still have the same loading issue after exporting them to actionscript? are you referring to not using the actionscript exports in an .as file like i'm doing but creating some sort of component out of each vector that live in the library and letting the IDE preload rather than doing it in code?
When you create a MovieClip in the Library you can select to have it Export for Actionscript and then give it a name and/or class. Exactly how this all works depends upon if you are using AS2 or AS3. Then you either use attachMovie or the new ClassName() constructor to create instances of the item as you need them.
It all depends upon how tricky the shapes are and how big they are, but you might have good tradeoffs.
thx rothrock. i've only been doing that with bitmap imports. didn't think to do that with the vectors i create internally. great idea. thx a lot for your time/help. helps a lot.