views:

2575

answers:

2

Hi guys,

I'm working on a flash site with lots of video-based section-to-section transitions. The transition videos themselves are only a few seconds long but are fairly weighty (~700kb) as they're very high-resolution; given the number of sections and section-to-section transition combinations (and therefore videos), preloading all of the transitions on initial site load isn't feasible.

What I'd like to do is have a quick load of each transition video on an as-needed basis; e.g., if you're in area A and click navigation for area B, the A->B video loads (only a few seconds' wait for most users) and is then played back. However, I'd also like a quick loader graphic displayed as the transition loads, before it gets played back (something simple like a loadbar, but more than just a spinner or the like, as the sense of definite progress is important).

What's the best way to do this in Actionscript 3? It was relatively straightforward in AS2 (http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001036.html) but I've yet to see an simple solution for AS3. I'm using standard code-based techniques for FLV playback in AS3 (NetConnection, NetStream, Video objects)--no FLVPlaybackComponents or similar.

Thanks a lot!

A: 

It's not much different in AS3. Just use a Timer instead of an interval. Were you having problems converting that code to AS3?

quoo
Thanks. I hadn't realized that bytesLoaded and bytesTotal were still part of the NetStream object in as3--your recommendation did the trick nicely.
justinbach
A: 

That example on Adobe's website still works, just prepend:

import flash.utils.setInterval;
Christopher W. Allen-Poole