Archive for the 'Adobe' Category

Free ActionScript 3.0 and FDT Courses! Limited Offer!

Rich Media Institute

The Rich Media Institute rocked my February by providing these excellent online training for *FREE*! Response fast though; this is a limited time offer!

Introduction to ActionScript Development with FDT

Free through February!
http://www.richmediainstitute.com/catalog.php?item=70

Comprehensive ActionScript 3

Free till February 15th!
http://www.richmediainstitute.com/catalog.php?item=72

Share and enjoy!

AddThis Social Bookmark Button

1 More Great Reason To Learn ActionScript 3

Adobe Flash CS5 Professional: Applications for iPhone

If you’ve missed out the announcements at Adobe MAX, I’m going to fill you in on this great reason to learn ActionScript 3!

In Flash CS5, you will be able to use ActionScript 3 to write your application, and publish that content straight as a native application for iPhone! With the increased possibilities and wider distribution networks, if now is still not the season to convince one to migrate to ActionScript 3, I have no idea when will. :) Read more about Flash CS5 Beta. and Flash CS5: Applications for iPhone.

Some entertainment. *loL~!*

[UPDATE: Just saw Peter Elst's article about this, check out "Using Flash to compile to iPhone applications"]

For a write-up on the rest of the announcements, check out Flash Magazine’s article, “New Flash Player info and Beta releases on Adobe Labs.”

The Adobe MAX Day 2 keynote will begin on Wednesday, 0120hrs for those who are at GMT+8 zone, so don’t miss that! You can follow this direct link to register now. I would expect even more exciting announcements to come. ;)

AddThis Social Bookmark Button

FDT Tip: Shortcut In Writing A Class’s Name

I have tried my best to make the title as self-explanatory as possible, but pardon me if you still have no idea what I’m referring to. However, more importantly is that this tip saved me a great deal of time, so I would suggest any FDT user to read this. ;)

When you have a constant declared in a class, it is always considered good practice to refer to it with the class name. Meaning,

1
2
3
4
5
6
7
8
9
10
11
12
13
package
{
    public class Test 
    {
        public static const APP_NAME:String = "fdt-tip";
 
        public function Test () 
        {
            // Best practice to include class's name
            trace(Test.APP_NAME);
        }
    }
}

As you can see from the above example, I referred to the constant using the class’s name. In our above example though, there is no issue since we’re only referring to the constant once.

Things start to worsen if the constant is referred to A LOT OF TIMES. Now it gets even worse if we had named our classes based on the display objects’ hierarchy, with class names looking like WrapperPageContentViewGenericSprite. *loL~* What if you actually have several classes with similar class names, e.g. WrapperPageContentViewUniqueSprite, WrapperPageGenericView, WrapperPage? At this point, even code-hinting will take you some time to filter through to the right class.

Solution

Head right on to Preferences > FDT > Editor > Templates and click on the “New…” button.

Here’s what I recommend to enter in the fields:
Name: tt (your own preference)
Context: AS2/AS3
Automatically Insert: Checked
Description: Fills in the current class (your own preference)
Pattern: ${enclosing_type}

FDT Tip Shortcut In Writing A Class's Name

After you are done creating this template, click the “OK” button. Try it out now! Simply type “tt” (or whatever is your shortcut), and press enter: the class’s name will now be automatically inserted for you. No fuss anymore, and no more excuses for not coding with best practices. :P

AddThis Social Bookmark Button

How Pixel Perfectness Drove Me Mad

I’m always overly obsessed when it comes to placement of text in Flash IDE. If the font is a pixel font, and it does not lie exactly on whole numbers in the x and y axis, then the font will appear blurred. From this habit that I had in handling pixel fonts, it soon spread to all objects that I had on the stage; I would want *everything* to be lying perfectly on whole numbers in both axis.

As you might have guessed, this pixel perfect habit of mine drove me rather mad whenever the rest of the team did not bother about it. I could easily spend hours just perfecting the coordinates. Yes, it’s highly possible more of a disease than a habit. *loL~*

Anyway, as I was playing around Flash IDE today, I found the cure! Snap to Pixels! Why haven’t I explored this in all my years with Flash?! :(

So if you are suffering from pixelperfectitis as well, here’s your medication.

View -> Snapping -> Snap to Pixels
Snap to Pixels

Ahh… How nice to find a cure… :D

AddThis Social Bookmark Button

Tutorial: Disabling Enter Key in TextArea

Objective

  • Learn how to disable the Enter key from working in a TextArea component.
  • View Demo

Files Required

Let’s Get Started!

Now I know what you are probably thinking; why would I want to disable the Enter key in a TextArea? Well I found one use case: The information that you want your user to enter can be quite lengthy and you want to display everything that the user had typed, but TextArea allows the Enter key to work. You wish it would operate like a TextInput component.

Let’s start by examining the init() function.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
/**
 * Initialise
 */
private function init ():void 
{
    // create the text area
    ta = new TextArea();
    ta.move(Main.PADDING, Main.PADDING);
    ta.setSize(stage.stageWidth - (Main.PADDING * 2), stage.stageHeight - (Main.PADDING * 2));
    addChild(ta);
    //
    // Add the event listeners
    ta.textField.addEventListener(TextEvent.TEXT_INPUT, ta_textInputHandler, false, 0, true);
}

After creating the TextArea, we have to listen to the TextEvent.TEXT_INPUT event to track whatever the user had just typed.

IMPORTANT NOTE: We listen to the event from the textField property of the TextArea instance, and not the TextArea instance itself. If you do otherwise, it will not work.

1
2
3
4
5
6
7
8
private function ta_textInputHandler (event:TextEvent):void
{
    // The char code for Enter is 10
    if (event.text.charCodeAt() == 10) 
    {
        event.preventDefault();
    }
}

In the event handler, we will track the text that is trying to get itself added to the textField. When the conditional is true, we simply prevent it from happening by using the preventDefault() method of event argument.

Final Note

For more information regarding preventDefault(), you can read the documentation. :)

AddThis Social Bookmark Button