Archive for the 'ActionScript 3.0' Category

How to Pause and Loop the Timeline in Flash CS3 (AS3)

Monday, November 26th, 2007
Flash ActionScript 3.0

How to pause the main timeline (or any timeline), and how to loop it, are fairly common questions on the Adobe forums — not super hot topics, but they continue to crop up every few months.  I suggested an AS2 approach to both questions in “How to Pause a Timeline (AS2)” and “How to Loop a Movie Three Times (AS2)” in 2006, but now with Flash CS3’s support for ActionScript 3.0, a couple of updates make good sense.

Check out “Using ActionScript to pause and loop the timeline in Flash,” in the Adobe Design Center, to see how things have changed.  Looping, as it turns out, can be handled in practically the same way.  The recommended approach for pausing now calls for the Timer class, which operates very differently from the setInterval() used in AS2.

And the Winner of Essential ActionScript 3.0 is …

Thursday, November 15th, 2007
Flash Meridian ActionScript 3.0

First of all, I’d like to give a big thanks to everyone who sent in a post card!  :)   Meridian has shown a great interest in maps lately, so (as it happens) we bought her a windshield-sized world map not long ago and had it mounted on foam board.  She’s been noting places we’ve traveled with stick pins, and as post cards started to arrive, we had fun discussing what places they came from.  I really think it’s neat that people visit this blog from over a dozen different countries!

Post cards were deposited into a pillowcase, and Meridian chose one without looking.  The winner was John in Sweden, whom I’ve contacted via email for shipping information.  Here’s the post card drawing in five photos.  Enjoy Moock’s Essential ActionScript 3.0, John — it’s a winner!

How to Load External Flash Video (FLV) Files (AS3)

Tuesday, November 13th, 2007
Flash ActionScript 3.0

This article can be considered a sequel to “How to Load External Flash Video (FLV) Files (AS2).”  The code suggested here is nothing more than the ActionScript 3.0 way to accomplish the same goal achieved earlier; namely, to load an external Flash video (FLV) file at runtime — without using the FLVPlayback component.  To be sure, there’s nothing wrong with FLVPlayback.  Its skins are customizable (all the more so in Flash CS3, which is the first version of Flash to support AS3) and it provides plenty of built-in widgets, such as play/pause, a volume slider, mute button, and the like.  But to get those features, even if you choose a non-skinned component, you pay a 49KB price in an ActionScript 3.0 document.  If you go without the component, it costs you less than 1KB.  That means site visitors can spend their bandwidth on your video content itself, rather than the video player.  Keep reading »

Chance to Win a Free Copy of Moock’s Essential ActionScript 3.0

Thursday, October 25th, 2007
General ActionScript 3.0

Note:  This contest has now ended, with results posted here.  Thanks for the post cards, everybody!

I’m an admirer of the clarity, thoroughness, and encouraging tone of Colin Moock’s books.  To that end, I pre-ordered his Essential ActionScript 3.0 (O’Reilly) long before it was available and was delighted when it arrived on my doorstep several months later.  Flash forward (pun) from that moment to just over a month ago, when I arrived in Boston for a terrific Flashforward conference.  Kevin Lynch, Adobe Chief Software Architect and keynote speaker, arranged to have a copy of Essential ActionScript 3.0 for every attendee, which was a fantastic and generous gift.  What that means is that I have a mint condition extra copy of Moock’s latest, and I’m happy to give it away.  I’ll pay shipping to anywhere in the world.

If you send me a post card and it gets here between now and November 15, 2007, I’ll have my three-year-old daughter, Meridian, choose randomly from the pile on that date.  I’m hoping three weeks gives everyone a fair chance, whether or not you’re in the US.  I’d love to hear about how this blog has helped you, if it has, but most importantly, I will of course need your return address, email address, or some other handy way to get your shipping address.

Send post cards to:

David Stiller
1700 Gray Slate Court
Virginia Beach, VA  23456

How to Play Flash Video Files (FLV) Sequentially

Friday, October 19th, 2007
ActionScript 2.0 ActionScript 3.0

Half a year ago, I wrote a brief article on “How to Play Sound Files Sequentially” (AS2).  Recently, a reader was asking how to apply the same principle to video.  In his case, Paul had to play a commercial first, then follow it with a longer content video — and the user controls (buttons, scrubber, etc.) needed to be disabled wile the commercial was playing.  As it turns out, Paul worked out a solution of his own, partly based on some of the other articles here, but I thought it would be fun to do a quick version too.  That way, he can compare notes and anyone else can look on.  Keep reading »

How to Use Flash Video (FLV) Cue Points

Tuesday, October 9th, 2007
Flash ActionScript 2.0 ActionScript 3.0

Video cue points can be used for all sorts of things in Flash.  Typical uses involve triggering other activity, such as peripheral movie clips whose animations enhance the video content, or triggering text, such as closed captions.  I’ve seen some developers in the Adobe forums even use a cue point to signal that a video clip has reached its end.  Strictly speaking, cue points aren’t needed for that last goal (see “How to Determine the Completion of a Flash Video (FLV) File”), but it’s certainly a possible way to go.

If you’re interested in cue points yourself, but don’t know where to begin, let’s dive in.  Keep reading »

How to Retrieve FlashVars Data in ActionScript 3.0

Tuesday, September 25th, 2007
Flash ActionScript 3.0

Last year around this time, I described how to pass variables into a SWF by way of something called FlashVars.  This was discussed in “How to Tell a SWF What File(s) to Load — From the Outside” which works for pretty much any sort of simple data you may want to pass in, as long as you’re talking about relatively small groups of name/value pairs.  Complex data is more likely to be suited to XML.  In that earlier blog entry, the purpose was to re-use a single SWF numerous times to load a variety of MP3 files, by specifying which audio in the HTML.  Pretty flexible solution!  You could use the same technique for loading JPGs or FLVs, to populate dynamic text fields, or whatever you like.  The article has been fairly popular and continues to be useful — as long as your SWF is published for ActionScript 2.0 (or even 1.0 if you drop the post colon suffixes — :String, :Number, and the like).  In ActionScript 3.0, things are different.  Keep reading »

How to Pause a Timeline (AS3)

Monday, August 27th, 2007
Flash ActionScript 3.0

If the title of this blog entry sounds familiar, it may be because you saw the ActionScript 2.0 equivalent on this site over a year ago.  In the comments to that article, a reader named Eric asked how to pause a timeline in ActionScript 3.0 (very different from AS2, as it turns out).  There’s a significant benefit to using ActionScript (whatever version) to temporarily halt the timeline, then resume after a few seconds:  it’s all about saving yourself the hassle of horizontal scrolling.  Consider pausing for five whole minutes.  At the default 12fps, that would require 3,600 frames of timeline real estate.  With code, you can pull it off in a single frame.  Let’s take a look.  Keep reading »

ActionScript:  Figuring Out Where to Begin

Friday, August 24th, 2007
Flash ActionScript 2.0 ActionScript 3.0

Here’s the third of my Notes on Design guest blog entries.  It was published yesterday already, but I missed it.  Too quick for me!

http://blog.sessions.edu/graphic-design/actionscript-figuring- out-where-to-begin/

How to Save Bandwidth when Displaying Flash Video

Friday, August 17th, 2007
Flash ActionScript 2.0 ActionScript 3.0

I’m on the technical advisory board for Sessions School of Design, a distance learning school based in New York.  Anjula Duggal, managing editor for the Sessions blog (DesignSessions:  Notes on Design), recently asked me to guest author a handful of articles for them, which I’m happy to do.  Thanks to Anjula and editor Katie Feo for helping to get me squared away!  :)

My first article is here:

http://blog.sessions.edu/web-design/how-to-save-bandwidth- when-displaying-flash-video/