Archive for the ‘Actionscript3’ Category

Minimal component set

Thursday, January 17th, 2008

I've been doing a lot of forms lately and that, as you most likely know, it's hard boring work. Always fighting your way through components and the woes of skins.

So I set out to find and easier of doing things and found it over at Keith Peters blog bit-101, it's best two features that will save you the hassle of always having to create component, addChild, set x position, set y position, you can do it all in one line. Components that fire events such as click or change, also take a fourth parameter of defaultHandler and that also saves the addEventListener.

So be sure to check them out at: bit-101 blog or download source here.

As3Crypto

Tuesday, January 15th, 2008

This is a bit of old news as the latest version of AS3Crypto came out in November, but I've only had the time to post about it now.

So what is As3Crypto? Well it's the Swiss Knife of AS3 Cryptography, I've been using it for a while now to manage secure communications for highscores and other sensitive data.

And guess what, a new version just (in November) came out, with support for TLS! Yes TLS in AS3, also version 1.3 has a lot of new improvements ( check the list ).

So to wrap things up, I prefer to use AS3Crypto over Adobe's crypto library because it has more features, a nice wrapper class and from my experience it's usually faster. Be sure to check out this great tool to check if your encryption is working well.

Expect a tutorial on how to use it with PHP soon ;)

FITC Amsterdam 2008

Monday, January 14th, 2008

Via the Papervision3D blog I heard about FITC Amsterdam 2008. Here are some of the talks that caught my eye:

- Papervision3D Workshop (by the Pv3D core team)
- Building Red5 Applications
- Chop the Hydra!
- Kaboom!!! Flash Pyrotechnics (and other particle effects)
- AIR Conditioning
- Adaptable Interfaces
- Flex Solutions For Your Daily Development
- etc..

Seems a nice event to attend ;)

AS3 Tweener engines, GOASAP and Adobe.

Thursday, January 10th, 2008

Recently Moses Gunesh has introduced Go:  "a generic set of base classes that should support many kinds of animation systems".

This strucks me as great news as in the past I used FUSE2 and when I moved to AS3 I found myself looking for a similar alternative but not really finding one as good or widely accepted as FUSE2.
The I came across Tweener, and that's what i currently use to power all my projects, it's simple, lightweight and most important easy to use.

Normally this would be the end of the story for me, but somehow Tweener is lacking some funcionalities that would like so i moved to Boostworthy's engine and again I found myself lacking some of the things i had in Tweener. So I kept searching and found Go, that altough it's not an Engine per se allows me to have all the functionality I want by extending it.

Also i found a great tool to ease my decision, and yours, Moses's TweenBencher. It's a great tool to test out all the different Tweener and see their advantages and disavantages. Be sure to check it out.

But most importantly I came across Moses's proposal to Adobe for a Core Animation Library and after reading it I must say that I agree with it to it's full extent. So be sure to check it out, and to make your voice heard if you agree, or not, with it.

Memory Leak Unit Test

Monday, January 7th, 2008

(or Programmatically Detecting Memory Leaks in AS3 via Unit Tests)

I've been writing unit tests for a class that deals with the loading/unloading of different types of media files. One of the tests I would like to have is a check for memory leaks. This is especially important now that we have automated our builds, so we can known instantly if a new change in the code doesn't break the behavior we're expecting.

(more...)

Auto-Generate Getters and Setters in Flex Builder

Friday, December 21st, 2007

I've been writing a lot of getters and setters lately (and spending way too much time doing that...), so I googled for some sort of plug-in for Eclipse/Flex Builder and found a great resource called Project Dash Here's a nice script to use with Dash to generate getters and setters for your variables ;)

  1. Inside FlexBuilder goto Help->Software Updates->Find and Install (if you ran into an error about retrieving "feature.xml" delete the site.xml file in your Flex Builder directory)
  2. add the remote update url ; update and restart
  3. when you restart you should see a Scripts menu and a Project in your workplace called Eclipse Monkey Examples
  4. Create a new file (with a .js extension) in the scripts folder inside the Eclipse Monkey Examples
  5. Write you monkey script in there (copy and paste the script to generate the getters and setters into the new file)

References:
Post with script to generate Getters and Setters

Actionscript Class Comments

Thursday, December 20th, 2007

I've been gathering some guidelines to writing proper class documentation in Actionscript. This is so basic stuff but anyway it helps to have it written down somewhere. Here's what I have so far as general guidelines:

  • Use ASDoc block comments (Ctrl+Shift+D in Flex Builder).
  • Write in English.
  • Use a $Id$ svn/cvs keyword so everyone knows directly who did the last change on the file.
  • If importing to COM, write an example of usage.
  • Favor the use of getters and setters instead of public vars/const.
  • In the source code use the following order to keep things organized:

Another Way to Force the Garbage Collection

Thursday, December 20th, 2007

The flash.system.System class in Flex 3 SDK beta 3 has a new gc() static method that forces the garbage collection process (it works for Flash Player debugger version only). Previous to this method the only known way to force the garbage collection was the localConnection hack so this is good news.

Papervision 2.0 PhongCube Demo

Wednesday, December 5th, 2007

Today a milestone in the internet world was achieved, Papervision 2.0 Alpha codename GreatWhite is out :)

So here's a little demo on the new Phong shader :) As soon as i have the time tonight i'll put on a much nicer one. This is just to show that altough PV3d just got a new whole set of features it's still easy to use :)

PhongCube

Taking a snapshot of an flv

Monday, December 3rd, 2007

Following my last post on 9-Slice items, here comes another nice one on Bitmap.draw() and the security sandbox.
Many people know the solution to this one, but i just found myself looking for it for too long, so here it goes :)

If you want to take a snapshot of a running Video object, you can't, you'll be alerted by the flash player that you are violating
the sandbox security. So how do we do it?
Easy as pie :)

video.attachNetStream( null );
bitmapData.draw( video );
video.attachNetStream ( myNetStreamObject );

Three very simple lines of code but that are hard to come by.