“Be inspired, enjoy your work, keep learning and never forget to play.” — gskinner

Auto-Generate Getters and Setters in Flex Builder

Posted: December 21st, 2007 | Author: Tiago Bilou | Filed under: Actionscript3, Tutorial | 4 Comments »

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

Posted: December 20th, 2007 | Author: nuno | Filed under: Actionscript3, Best Practices | 2 Comments »

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

Posted: December 20th, 2007 | Author: nuno | Filed under: Actionscript3 | 1 Comment »

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.


Adobe Flex Builder 3 Public Beta 3 is out!

Posted: December 13th, 2007 | Author: nuno | Filed under: Adobe Flex | 2 Comments »

Just saw the news about the new Flex Builder public Beta 3 and I must say I'm anxious to get my hands on it. I've been working with the previous beta 2 and suffering from the slow compile/refresh times that others have also observed. But since it was a Beta we couldn't really complain, could we?

This will be the last beta prior to the launch of Flex Builder 3 and Adobe promises an overall quality and performance improvement. The Matt Chotin's beta feature overview article is the place to go to read about what's new and I'm not saying anything else until I get my hands on this baby.

If you've been out of the loop or simply too busy to check it out, Flex Builder is basically a commercial programming environment for Actionscript programming that has been growing in both popularity and features.


Extend Flex 3 trial period

Posted: December 11th, 2007 | Author: Idoru | Filed under: Adobe Flex | 3 Comments »

Ted Patrick published on his blog two serials to give you an extension on the trial period of Flex 3. Word has it that it should be enough until the final version comes out.

Here they are:

MAC extension serial #: 1307-0059-4523-4261-9974-9828

WIN extension serial #: 1307-1052-9498-6822-0041-4602

Enjoy


Papervision 2.0 PhongCube Demo

Posted: December 5th, 2007 | Author: Idoru | Filed under: 3D, Actionscript3, Demo, Papervision3d | No Comments »

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

Posted: December 3rd, 2007 | Author: Idoru | Filed under: Actionscript3, Bitmap, Tutorial, Video, WorkAround | 2 Comments »

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.


9-Slice and Bitmap

Posted: December 3rd, 2007 | Author: Idoru | Filed under: Actionscript3, Bitmap, Papervision3d, WorkAround | 2 Comments »

Have you ever tried to take a snapshot using bitmap.draw() of a movieclip that has 9-slice enabled?

//my9SliceEnabledMc is a 40 by 40 9-slice enabled movieclip on stage
my9SliceEnabledMc.width = 200;
my9SliceEnabledMc.height = 300;
var myBitmapData = new BitmapData(200,300);
myBitmapData.draw(my9SliceEnabledMc);
addChild(new Bitmap(myBitmapData));

So what you'd expect to happen above is to have a new bitmap that looks the same as my9SliceEnabledMc,
but what you get instead is the original 40x40 movieclip.
This doesn't make sense at all, i have no idea what Adobe was thinking when they let this one through.
This was driving me crazy for a while now, and today i finally found the answer, as simple as it seems,
putting the my9SliceEnabledMc inside another sprite corrects the issue!!

//my9SliceEnabledMc is a 40 by 40 9-slice enabled movieclip on the library
var myContainer = new Sprite();
var my9SliceEnabledMc = new my9SliceEnabledMc();
myContainer.addChild(my9SliceEnabledMc);
my9SliceEnabledMc.width = 200;
my9SliceEnabledMc.height = 300;
var myBitmapData = new BitmapData(200,300);
myBitmapData.draw(myContainer);
addChild(new Bitmap(myBitmapData))

Also i should add that this is a major issue with PV3D since you cannot directly use a 9-slice item as a texture.