Actionscript, Old Articles - 2 years, 9 months ago - 7 Comments

Actionscript 3 - New Capabilities

Actionscript 3 opens up a whole new range of possibilities for web based applications which you may miss at first glance of the new Language Reference.

I dont blame you, after all there is a tonne of new stuff to play with, learn and read about. My suggestion would be to think of a cool application and build it using Zorn and Actionscript 3 to get up to speed with the new language and its capabilities (Who knows you might even find some bugs and help the Engineering Team while your at it).

Taking my own advice, i have been busy coding a fully Flash based Email & News Client. Using the new Binary Sockets in Actionscript 3 i have successfully implemented four common internet protocols (SMTP, Pop3, IMAP and NNTP) which i will release the source-code for in the very near future. Not only that, but i have also learn’t a tonne about the language and the new capabilities.

Here are my favourites new additions to the language, some of which, you may or may not have noticed yet:

Loader.loadBytes()

This is very significant, this method allows you to create items directly on the display list from binary data. So, for example in my email client if an email that is downloaded from a Pop3 server contains an attachment, i check the mime-type of the attachment, and if it is a type that the player supports, then i can read the binary source of the attachment into a ByteArray and display the attachment inside of the Flash Player. This means that my email client can display PNG, JPEG, GIF and SWF attachments.

If i had the time, i could go one step further and also use the ByteArray class to convert the binary source of other email attachments into formats that the Flash Player can display. ie… converting other image formats such as TIF into JPEG’s which the player can display.

You can also use this method to load compiled actionscript libraries from a server over a socket connection, so that the source is not available on the client machine to be decompiled.

The possibilites are endless!

Sound.computeSpectrum()

Globally analayzes all the sound that is playing and returns a ByteArray containing 512 normalized values (-1 to 1) that can be used to visually display the waveform of sound. 256 values for the left channel and 256 values for the right channel. You can use these values to create Spectrum Analyzer displays for Audio Players like the ones you see in Winamp and other such Media Players. Not only that but you can also use this data to create visual experiments that react to the sound that is being played. Awesome addition. Ill post an example shortly.

flash.net.Socket

You can now make Flash talk in many different protocols. Connect to a port on a remote computer and talk in your own language if you like. No longer do you need a server-side script to send email from Flash, now you can just connect directly to an SMTP server, speak its language (The SMTP Protocol) and tell it to send the email for you. I have written classes that allow Flash to retrieve email from Pop3 or IMAP Servers, send email using SMTP Servers and read newsgroups from NNTP servers.

It’s a shame that there is no File I/0 Capabilities, because then we could make an FTP client in Flash. I doubt very much that we will ever see File I/O in the Flash Player for security reasons.

BitmapData.getPixels()

No, longer do you have to loop through every pixel in a bitmap, one at a time with getPixel to send a bitmap to the server. This method returns a ByteArray containing the hexadecimal color value of each of the pixels in the specified rectangular region of a bitmap. Use this method in conjunction with the new ZLib compression method; ByteArray.compress() to compress and send a bitmap over the wire to a server so it can be converted into a file ready for downloading.

Loader.close()

You can now actually stop the player from continuing to load external media. In the past if you were to for example, load an image into the player there was no way to stop the process until it had completed. Now you can!

MovieClip.currentLabel

Simple one, that has been missing for along time. This one simply returns the label of the current frame as a String.

flash.util.Proxy

This is Object.__resolve on steroids. It allows you to control what happens when a property of a class is set, accessed, deleted or when a method is called and much more….

These are exciting times to be a Flash Developer, enjoy it! Im having so much fun right now even though im not at MAX, you should be too. “Now where is that spare GIG of RAM i had lieing around ;)



7 Comments

You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

clshrock
Aug 9, 2007 1:55

Any news on the common network library code release?

Michael
Aug 11, 2007 12:51

Action script 3 can communicate with database directly ?

Austin Feith
Aug 28, 2007 9:40

You have an outstanding good and well structured site. I enjoyed browsing through it.

Puneet
Sep 21, 2007 23:17

Are the 3D capabilities of AS3 and Flash CS3 Pro better than the last versions? I am making a 3D engine in Flash MX 2004 but I am experiencing a few problems with lighting and rendering and surface distinction

Bardur
Dec 1, 2007 14:36

Is it possilbe to create multi threaded email applications with Actionscript 3? If not, isn’t a problem that the application freezes while emails are beeing fetched?

janosch
Dec 19, 2007 13:20

>> Using the new Binary Sockets in Actionscript 3 i have successfully implemented four common internet protocols (SMTP, Pop3, IMAP and NNTP) which i will release the source-code for in the very near future

Will you?
What means “very near future”? :)

gondo
Jan 10, 2008 1:32

hi
have u any example using flash.net.Socket ?
or any example how to code connection directly to SMTP server ?
ty

Note: This is an old article!

Please be aware that the content of this article may no longer be accurate and the links contained within could be broken.

Update Notifications

You can add our RSS feed to your favorite feed reader or recieve an email when a new article is posted by entering your email address below.

    Shu Player allows you to distribute your AIR Applications to users that dont have the AIR Runtime by converting them to standalone applications. Shu Player also adds more commands to do things like open external applications etc…


    If you hate the Adobe Updater like most of us, then just get rid of it.


    Want to quickly find out what version of the Flash Player a client has installed? Send them to www.playerversion.com


    Yet more pv3d goodness. Im loving this funky 3D Flash Lab, the work of Mathieu Badimon. [Update: Apparently this uses Five3D not PaperVision]


    There is an old interview with me on The FWA, its fairly long at 8 pages.


    If you do alot of travelling then it makes sense to get yourself a Priority Pass, which will get you access to over 500 airport lounges worldwide, regardless of whether your flying enconomy, business or first.


    Freelance Switch is a freelancer community with forums, jobs, daily tips and a complete 212 page e-book titled “How to be a rockstar freelancer” for sale.


    Lots of new media jobs at Creative Pool.


    BBC IPlayer is awesome, but its ashame that BBC News is still using Windows Media Player and Real video. Real player is officially badware.


More In Actionscript


More In Adobe Flash


More In Freelancing