Friday, June 12, 2009

AS3 Keyboard Events

Learn how to respond to Keyboard Events in AS3.

Labels: ,

Monday, April 27, 2009

ActionScript 3.0 Migration Cookbook

Adobe is still trying to get Flashers to migrate to ActionScript 3.0. It's so late in the game with this, but their efforts have stepped up now with the ActionScript 3.0 Migration Cookbook. 21 PDF pages of code examples and a list of 5 misconceptions about AS3 and a list of 5 benefits of AS3.

So if you're still AS2, then you'll want to check this out.

Labels: ,

Tuesday, April 14, 2009

Beginner's Guide to ActionScript 3.0

At FlashDen.net, there's a new video series by Doug Winnie titled Beginner's Guide to ActionScript 3.0, which are hosted at tv.adobe.com. It's pretty amazing to me that anyone is producing video's of this, since ActionScript 3 has been around for so long now. I guess there's still a lot of ActionScript 2 development going on out there.

Enjoy.

Labels: , , ,

Friday, March 20, 2009

Simple XML Gallery

I posted a Simple XML Gallery to FlashDen: http://www.flashden.net/item/strongsimplestrong-strongxmlstrong-gallery/34538. Cool app that is very easy to customize. There is adequate documentation for the gallery.

It features preloaders for the images being loaded and hidden next/previous buttons that appear when you hover over the right/left side of the stage.

Labels: , ,

Friday, February 20, 2009

TweenMax/TweenLite

I took an advanced ActionScript class a few weeks ago and was introduced to TweeLite (http://www.tweenlite.com), an AS Tween Library. I was skeptical at first, but after playing with it for a while, it's got some really great features. On the site, you can preview all of the possible animations and filters. You can also do this with the SWFs that come with the download.

You'll have to import the appropriate classes to begin with. They are all located in the gs folder.

import gs.*;

Then you have access to the Tweens. Here's an example [nested in a function] of a MovieClip called mover, being transformed:

function makeGrow(e:MouseEvent):void {
TweenLite.to(mover, 2, {scaleX:6.5, scaleY:6.5, x:300, y:90, rotation: 15, alpha: 0.3, delay:1});
}

As you can see, this is pretty powerful stuff as you can couple more than one property into the function, unlike Flash's built-in Tween object. The delay property is nice to, because you can set a string of events.

If you have multiple clips you want to move, you can use something called a Tween Group. Here's an example:

function moveBoxes(e:MouseEvent):void {
TweenGroup.allTo([box1, box2, box3, box4], 1, {y:78});
}

Another thing you can do is apply filters to clips, like Drop-Shadow, Blur, etc. Here's an example:

function blurThis(e:MouseEvent):void {
TweenMax.to(cross, 1, {blurFilter:{blurX:40}});
TweenLite.to(cross, 2, {x:30, delay: 0.2});
TweenMax.to(cross, 3, {blurFilter{blurX:0}});
}

I'm still working out some things, like getting multiple objects separate tween instances and getting more filter effects to work. But the results are great and easy to implement. There have been other Tween packages in the past, but this one is pretty powerful.

Labels: , , ,

Friday, January 30, 2009

Flash AS3 MP3 Player with XML

I'm working on an XML-based MP3 player in AS3 and there are so many things to think about here. For example, AS3 allows you to read ID3 tags from MP3 files. But I found out with a lot of testing, that it doesn't read all ID3 tags. In my case, I gave it a bunch of different MP3 files and it didn't read anything.

Here's the code:

var url:String = "Falling Down.mp3";
var request:URLRequest = new URLRequest(url);
var mp3:Sound = new Sound(request);
mp3.addEventListener(Event.ID3, id3Handler)
mp3.play();

function id3Handler(event:Event):void {
var song:Sound = Sound(event.target);
var songInfo:ID3Info = ID3Info(song.id3);
trace("ID3 loaded");
trace("\t artist: " + songInfo.artist);
trace("\t track: " + songInfo.track);
trace("\t comment: " + songInfo.comment);
trace("\t songName: " + songInfo.songName);
trace("\t album: " + songInfo.album);
trace("\t genre: " + songInfo.genre);
trace("\t year: " + songInfo.year);
textArea.text += "album" + ":\t" + song.id3.album + "\n";
textArea.text += "artist" + ":\t" + song.id3.artist + "\n";
textArea.text += "comment" + ":\t" + song.id3.comment + "\n";
textArea.text += "genre" + ":\t" + song.id3.genre + "\n";
textArea.text += "songName" + ":\t" + song.id3.songName + "\n";
textArea.text += "track" + ":\t" + song.id3.track + "\n";
textArea.text += "year" + ":\t" + song.id3.year + "\n";
textArea.text += "---------------------------------";
}

No luck with this. Anyone else have a problem with ID3? I think a more common practice is to get the info from an XML file. The problem with that is now you have to continuously update or change the XML file.

Anyhow, let me know what you think.

Labels: ,

Wednesday, October 22, 2008

Nice AS3 Tweening Tutorial

Kirupa has posted a nice tutorial on ActionScript tweening.

Labels: , , ,

Monday, July 28, 2008

Against AS3

Colin Moock, author of Essential ActionScript 3.0, makes excellent arguments surrounding the difficulty for typical Flashers to get used to the new adaptations in the mindset of AS3 as compared to AS2. I heartily agree with all of his arguments, especially from the standpoint of teaching Flash. It is more difficult to teach ActionScript now because of the inherent hurdle of teaching programming terms and skills. It was so easy to tell a button to gotoAndPlay something before, and now I have to explain what event listeners are and why we need to construct them, etc.

It's also impossible (well, at least I think it is) to teach ActionScript the old way - by having students chunk together portions of code from the AS library in the ActionScript panel. It's too laborious to put together any code, even with Script Assist. I now have to approach AS3 like I do with HTML - which leaves the students dependent on code examples and pre-written samples that work without error.

The comment that Adobe has abandoned it's former user base is not that far off the mark. I was completely confident in my AS2 abilities and by the time Flash CS3 came around, I was able to put together just about anything. I have to admit, that when it came to AS3, I struggled with it. Some of it looked familiar and the more I did it, the better I understood, but having to deal with a class-based system and not a timeline-based language seemed a pretty far jump to me.

Having gone through Moock's book, I thought I had a good handle on it - but it still feels very foreign to me - probably because I am not a traditional programmer. I don't know C, or C++, or even JAVA. The only language that I was truly comfortable with was AS. It's hard to say that I didn't feel alienated by Adobe when AS3 came out or that I feel behind the ball this time.

What makes things more complicated is Flex. When we had a single authoring tool, it made it easy to see what needed to be done to get something working. Now it seems like I have to make a decision about what tool to use for what situation. That doesn't seem to make a lot of sense to me. Add on top of that MXML - yet another language that you need to know for Flex.

All of this makes pure animation and video very attractive to me right now. I enjoy designing and creating things. I shouldn't have to read 500+ page manuals to have to put together an interactive environment.

Labels: , , , ,

Friday, September 07, 2007

Flash Player Penetration

Flash Player 9 has reached 91.2% penetration, according to Adobe. This data comes out a year later after its release. What I'm curious about is what developers are actually doing. Are they developing AS2 files for Flash Player 9 or AS3 files?

Labels: , ,

Thursday, August 23, 2007

Preloading in Flash CS3: Addendum

OK, I don't speak Italian, but Flep does. Not only does he speak Italian, but he speaks AS3. Thanks to his post: Preloader for Beginners, I finally found a really good solution for preloading. The only thing I wish it had was a progress bar. Great stuff Flep.

Labels: , , , ,

Preloading in Flash CS3

You'd think that something as important and standard as a preloader would be simple in the latest version of Flash. Not only is preloading pretty much undocumented - probably because there are so many ways to do it - the information both in books and on the internet is fairly sparse. So far, I've found at least four different techniques and none of them to my liking.

What's even more daunting is to find out how it's implemented - with classes. Now I've been using Flash since version 2 and I'm pretty fluent in AS 2.0, but this whole business about classes in CS3, although it's slowly sinking in, is a bit much. Instead of a few lines of code, now I need a whole separate .as file as a document class for my Flash file?!? Try teaching that to first time Flash users!

Anyhow, I thought I'd share what I found, so you could pass it along. First there's this post over at BIT-101 entitled: Preloaders in AS3. For something a little more straightforward, you can try Koen De Weggheleire's solution, which doesn't require a class, but isn't all that flexible either: Preloader in Flash CS3 - Actionscript 3.0 way. Weggheleire follows up with another tutorial on a different technique, this time with a class: More About Preloading in Flash CS3. This approach is promising and easy to tweak. Finally, there's ProgressBar Component of Flash CS3, by Flep. This technique utilizes the Progress Bar Component included in Flash CS3.

Actually, preloading has never been an exact science and everybody has different approaches to the whole thing. I just think Adobe could've implemented it better in this release.

Labels: , , , ,

Monday, August 20, 2007

AS3 reference

I'm tackling AS3 now and it's been slow going. Finding good information about it on the Adobe website is frustrating. I did stumble on this today and I thought I'd share it with you. It's an 800 page AS3 reference by Adobe - go figure.

Labels: , ,

Friday, May 18, 2007

Getting used to AS 3.0

So I downloaded the trial version of Flash CS3 (finally, thanks to Adobe. The new welcome screen allows you to create a couple of different document types, one is Flash Document AS 2.0 and the other is Flash Document AS 3.0. The difference between AS 2 & 3 is huge, so I'm tearing all over the web to look for good resources.

Senocular has an article called Getting Started with ActionScript 3.0 in Adobe Flash CS3. One of the changes, for example, is the fact that you can no longer put scripts on objects, i.e. buttons, movie clips. All of the scripts you write have to be in the timeline only!?!

Event handling is so different now. In AS 2.0 you could easily write an onClipEvent script for a MovieClip or an on (release) event on a button to get things going. No longer. The method is completely different.

There are other big changes too, so check out the article.

Labels: , ,