preload FLV in Actionscript 3? - actionscript-3

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!

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

That example on Adobe's website still works, just prepend:
import flash.utils.setInterval;

Related

Is it possible to play an HTML5 audio element for a very specific duration (less than total duration of the sound bite)

I have a sound element that is actually a composition of several different sounds. My approach had been to only have to load a single source for sound, and play different segments based on the desired sound bite.
I can seek to the start point just fine by setting the 'currentTime' property. However, setting the 'duration' property does not seem to have any affect what-so-ever.
I've tried to use a setTimeout, but, as expected, the timer resolution is not sufficient to get consistent behavior in the audio (sometimes it does not play at all, and when it does play it's 'stop' point is inconsistent).
Is this possible? Or will I be stuck loading each sound bite in it's own individual element?
Remy Sharp has posted about this as Audio Sprites (and fixes for iOS). Does that implementation work for you?

HTML above flash without wmode?

Could someone settle this little dispute please.
If I set wmode=transparent on the flash template everything works magically. However, the flash developer says that by doing this the template will be slowed down significantly..
So the questions.
1) How much of an impact does wmode have on performance today?
2) Is there any other way to place HTML on top of flash?
It should be noted the HTML only appears on top of the flash when they click on a video -> rare. The flash only is animated again after the video is closed and the user clicks on a rollover or whatever.
I've done a bunch of websites with transparent flash objects and heavy animations, etc.. I've never noticed any change. I think it should only matter if you had issues with performance to start with (zillions of vectors being animated or something).

I've only programmed in AS3; What's the easiest practice in Flash CS4 to create simple animations?

So I've been using Flash for awhile, but rarely ever use the authoring tool. I want to create a quick little slideshow in which a user clicks buttons, and assets on the screen fade in an out as you move from slide to slide. I don't want to do this programatically...what's the quickest route to go about doing this, with using some AS3 but primarily relying on CS4's authoring tools? I remember when I first learned flash, years ago, you placed elements on stage and stretched them out over multiple frames. That seems like a lot of work...I'd rather just have, say, 10 total frames, each frame being a step in the slideshow, and each click of the next button going to that next frame, with each frame having its own animations.
I think you should work with framescripts, flash IDE also gives you this possibility to code while you make frame animations. This way you will take the most advantage of working in the IDE.

ActionScript 3: Smooth programmatic animation

I want to animate MoviveClips/Sprite objects as smootly as possible. However so far the only method that works is placing the movement code into the EnterFrame event handler. There is one problem with this approach: when the framerate on a specific machine is below the desired framerate then the whole game slows down. I want to be able to do this in a time-independent manner.
There are two ways to do programmatic animation within the Flash player. The first you already pointed out by using a onEnterFrame. However, as you might already have noticed, to get a smooth animation you need to increase the overall frame rate of your movie. Doing this will also increase the CPU load for the entire period of time your SWF runs. This is not something you always want.
The other way of doing programmatic animation is by using a timer. Within a timer handler it is possible to call a function named updateAfterEvent which will update the screen independent from the FPS you'd set for your SWF. Therefore, using a timer leaves a gateway to do smooth animation within the Flash player without increasing the overall frame rate of your SWF.
Two years ago or so I set out to create my own tween libraries for Flash (because of my frustrations with the then existing tween libraries available). I released it under the name Coretween and this library lets you, among other things, choose what type of animation you prefer for every individual tween. On the documentation page I give an example of the difference between frame based and time based animation. The example SWF on that page runs at 12 fps but as you can see, the lower circle tweens much smoother because it's controlled by a timer that ticks at 60 fps and updates the screen in-depended from the SWF frame rate. Do keep in mind though that even the timer ticks at 60 fps in reality the Flash Player will never be able to achieve this frame rate. However, it will try to achieve this frame rate which results in a much smoother overall animation.
Unfortunately until now I've not been able to release a 1.0 version of my library but as far as I know it's pretty stable. You're more than welcome to use it in any way you see fit. I've used Coretween in many commercial productions including this one we did for StGeorge bank here in Australia.
Here are a few Actionscript based animation libraries:
TweenMax
Tweener
They both work well, and should help you with what you need.

Actionscript 3.0 Tween Question

I am currently working on a website for a construction company and I am trying to build a very simple flash intro. I have two images in the falsh intro: a tractor and a picture of clouds in the background.
I am trying to have the clouds appear to float by in the background. It is a very wide image that I am trying to loop through very slowly. It looks pretty cool :) IMO.
For tweening, I have always used TweenLite. The problem I am having is that while the image is moving, it 'blips' and looks pretty choppy. I have adjusted fps and about every other thing I can think of. The only thing that fixes it is when I use Hardware Acceleration (Level 2 - GPU). But this creates all sorts of problems for the HTML page.
My Question Is:
I am just a terrible coder, or would I be better off using Tweener (or something of the sort) or using the native tween engine in flash cs4? Any advice would be great!
Try these:
If the image is in your Library, make sure "Allow smoothing" is checked in your Bitmap Properties (select the image in the Library and go to "Properties" in the Library menu).
Or, if you are loading the bitmap dynamically and using the BitmapData class, make sure you've set the "smoothing" property to "true" on your BitmapData.