Design Patterns in ActionScript

July 3rd, 2008 Chris Griffith

During our discussion at last night’s meeting, I mentioned that there were two books specifically written on using Design Patterns in ActionScript. The first was Advanced ActionScript 3 with Design Patterns by Joey Lott and Danny Patterson. This is a great starter book for anyone interested in applying design patterns to their development. The other is ActionScript 3.0 Design Patterns, by William B. Sanders and Chandima Cumaranatunge. This one is a much deeper look into design patterns. So, if you have actually finished reading EAS3.0 by Moock, then you are ready to tackle either one of these.

A third book that I also recommend is in the Head First series, Head First: Design Patterns. Although the examples are written JAVA, it is fairly easy to translate the examples to ActionScript. If you have not had a chance to read one of the Head First series of books, be warned they are unlike any book you have read. 

Both Head First: Design Patterns and ActionScript 3.0 Design Patterns are O’Reilly books, so you can use the User Group discount. 


Embedding Flash with SWFObject 2.0

June 26th, 2008 Chris Griffith

Lee Brimelow, Adobe’s Flash Platform evangelist, has just posted a video on how to use SWFObject to embed Flash content into HTML pages. Since this is the solution that will be used in CS4, you can get a leg up on it.


To use getters/setters or not to user getters/setters, oh what a question…

April 9th, 2008 Kyle

I recently read a nice little article by Darron Schall (http://www.darronschall.com/weblog/archives/000149.cfm ) discussing the uselessness of getters and setters, and, after giving it some thought, I have to agree with him. The basic premise of a getter/setter is to you give access to a private property within your class, thus allowing a user of that class to alter the state of that property without knowing about or interfering with any other piece of the class. So Darron’s point is this: why not just use public properties? His point is a valid one. I think that the use of getters and setters is a bit of an old-school method that has become somewhat useless in its’ most basic form. This is not to say that getter/setters are completely useless however. They are still very useful if you want to perform some action on the data the user is setting/getting prior to updating the class or returning a value; however, for simply setting the input value to a private method of the class, there is really no point, and overall it just adds weight (in file size) to your code.


Integrating Flex and Server-Side Scripts

March 23rd, 2008 cbowden

Hi Everyone :]

I thought I would throw up some code I am working on, as I had a slight struggle with it, and I have a feeling that many of you would like to leverage uploading abilities within Flex applications.

I’m currently working on a web based mp3 player which uses Adobe AIR to communicate with iTunes self generated XML file. The flex application then loads the artists and allows users to select music which is then uploaded to the server simultaneously at the click of a button. This allows the users to “add” to their playlist without ever having to leave the application.

Although we have the fileReference class built in to the Actionscript API — It doesn’t technically handle the file uploading itself. I personally work with ColdFusion over other server technologies — so naturally that is the language my script was written in. I am working on a simple PHP script that does the exact same thing, but offers a free solution :]

Before writing the ColdFusion script all that is needed is a basic Flex form which in my case has a “browse button” that calls fileReference.browse() when clicked. Refer to the class reference for more information on the event handlers and such. Once a file(s) are selected, the user then clicks the “upload button” which calls the fileReference.upload(). This method requires one parameter, a URLRequest which should call your server side script file. You can also pass a second parameter to rename the file to that of you own naming conventions. This is very helpful if you want to archive uploaded files in a database, or an xml file. Finally, the upload() method has a third parameter which double checks that the file was uploaded by returning “true/false.”

As for the ColdFusion, only one tag is necessary:

<cffile action=”upload” filefield=”file” destination=”[Insert server destination here]” nameconflict=”overwrite>

That’s it! This method can be very helpful as you can allow users to upload their own videos , images, music, etc. The major benefit is it all happens within the same application so you can maintain the “feel.”

I personally have included an “upload” button in the mp3Player’s main state, which launches a popup window with the upload form :]. Have fun guys– See you all in April.

–Chris Bowden


Syntax coloring in Flex Builder 2

February 5th, 2008 Kyle

For those of you that may have been a bit dissatisfied with the plain old color scheme of the flex builder 2 idea, or just don’t want to burn your retinas out staring at black code on a white screen all day, there is hope! There’s a great article (very short and to the point) on how to accomplish this here: CLICK ME


Join SDFUG for this “can’t miss” meeting!

January 17th, 2008 Kyle

March 5, 2008
7:00 pmto9:00 pm

As you may have heard, Adobe has announced the release of Adobe Flex 3 and Adobe AIR 1.0. Now that the cat is out of the bag, this will be the focus of our March 5th special meeting! Adobe is sponsoring this meeting with food, giveaways and a raffle copy of Adobe Flex Professional.

Flex 3 is a feature-packed release, adding new UI components like the advanced datagrid and improved CSS capabilities; powerful tooling additions like refactoring; and extensive testing tools including memory and performance profiling, plus the addition of the automated testing framework to Flex Builder.

Adobe AIR is game-changing in so many ways, delivering rich applications on the desktop, enabling access to the local file system, system tray, notifications and much more. Now you can write RIAs on the desktop using the same skills that you’ve been already using to create great web apps including both Flex and AJAX.

Don’t miss out on this opportunity to see and hear about this highly anticipated release of Flex 3 and AIR at this meeting.

Who: You and everyone else you know! If we get over 50 Attendees we will be raffling off a copy of Adobe CS3 Web Premium, so bring some friends!

What: See above!

When: Monday, February 25, 2008 from 7-9PM

Where: Veoh Networks

7220 Trade St. Suite 115

San Diego, CA 92121

MAP

Why? The better question is why not! Exciting info. from Adobe, food, drinks, giveaways, what else could you ask for!

RSVP: kyle@sdfug.org with subject “Secret Meeting Atendee.”


Runtime Enforcement of Abstract Classes in AS3

January 11th, 2008 Kyle

Josh Tynjala over at ZeuseLabs wrote a great article on creating Abstract Classes in AS3.

Check it out here: Astract Classes in AS3


New Release on Adobe Labs!

December 17th, 2007 Kyle

Flex 3 public beta 3 available on Labs

http://labs.adobe.com/technologies/flex/

Adobe AIR beta 3
http://labs.adobe.com/technologies/air/

BlazeDS beta
http://labs.adobe.com/technologies/blazeds/

Adobe AIR update for Flash CS3 Professional beta 3
http://labs.adobe.com/wiki/index.php/AIR:Flash_CS3_Professional_Update

Adobe AIR Extension for Adobe Dreamweaver beta 3
http://labs.adobe.com/wiki/index.php/AIR:Dreamweaver_CS3_Extension


Animating static text in Actionscript 3

October 29th, 2007 Kyle

So I ran into a little problem today and I thought I’d share it with you guys. I created a button that had a static text field inside of it, then I tried to simply fade the button in and out. This worked fine in my test files; however when I tried to put the same code into my actual application, the fades all failed to work. After beating my head against a wall for a few hours (note to self, get foam padding for walls at office), I finally came upon the source of my problem: a font that I had embedded into my library. I have been forced to embed fonts in my library at publish time (go to your library, then click on the options drop-down in the upper-right and select New Font) due to an error with Flash CS3 / Actionscript 3 not actually allowing you to embed fonts via actionscript (as is stated in all current documentation). So what is happening is this: by embedding the font in my library, it is somehow not allowing any static text fields that use that same font-family to be animated in any way (including fades). My only options were to either delete the embedded font from my library (which resulted in all of my dynamically created text fields that use that font breaking), or to simply use a different font-family for the static text fields. I chose the latter (Tahoma is pretty close to verdana, and at a 10 point font size, you barely notice) as it worked well in my situation. Hopefully this will be fixed with future release/updates to flash, but for now those are the only options I’ve found.. Off to find some advil …


FlashDevelop Syntax Coloring

October 17th, 2007 Kyle

If you haven’t heard of FlashDevelop, you may want to check your pulse, then head on over to flashdevelop.org and download the latest Release. FlashDevelop has become the editor of choice for many Actionscript programmers, offering many great features including code hinting, sytanx high-lighting, firefox style search functionality just to name a few. And to make things even better, it’s FREE!

One issue that many users have run into with this application is changing the color and formatting of their code. Well if you’re one of the people who’ve been banging your head against the wall trying to figure out how to change the color settings to something other than the default white background, then it’s your lucky day! The first thing you need to do is fire up FlashDevelop. Next go to Tools -> Application Files, and look for a directory called “settings” inside the FlashDevelop directory. The two files that you are going to be concerned with are ScintillaNET.xml languages/as3.xml (or as2.xml if you are working in AS2 still). Inside these files you will find all of the properties you will need in order to customize the appearance of your code. I’m including a .zip file which contains the color scheme that I am using, along with some comments explaining which properties do what. Enjoy!

Example Files