Welcome, please login or register

PushButton Engine: Table of Contents » PushButton Engine Lesson #1 - Setup using Adobe Flex Builder

PushButton Engine Lesson #1 - Setup using Adobe Flex Builder

Welcome, in this lesson you will learn how to use the PushButton Engine with the Adobe Flex Builder IDE.

Lesson Requirements

To complete this lesson you will need to download and install a few pieces of software.

  • Adobe Flex Builder 3 Download
  • PushButton Engine Download - To install just extract to your development folder.

Creating a new project

Now we need to setup a new project for this lesson. Right click in the Flex navigator window and click New->ActionScript Project.
For this lesson we are using an ActionScript project but a Flex project will work just as well.

Let's give the project a name by typing Lesson1FlexBuilder in the project name text box and click next.

We now have a question to ask ourselves. "Will we be using the PushButton Engine as is or do we plan on making modifications to the source?"
If you plan to use the PushButton Engine as is, skip to the library section.
If you plan on making modifications to the PushButton Engine skip to the source section and skip the library section.

Source

To setup the source path click the source path tab and then add folder.
Navigate to the folder you extracted the PushButton Engine to and add the src folder.

When using the PushButton Engine source we need to add some additional compiler arguments for embeding data.
Right click Lesson1FlexBuilder in the project list and click properties.
Click ActionScript compiler and paste --keep-as3-metadata+=TypeHint,EditorData,Embed into the additional compiler options text box.

Library

To setup the library path click the library path tab and then add swc.
Navigate to the folder you extracted the PushButton Engine and inside the bin folder you will have PBEngine.swc.

Hello, World!

That's right, it's time for some code!
In the src folder we should have a file, Lesson1FlexBuilder.as.
Open Lesson1FlexBuilder.as.

Copy the code below and paste it into Lesson1FlexBuilder.as.

      package
      {
            // Flash Imports
            import flash.display.Sprite;
            
            // PushButton Engine Imports
            import com.pblabs.engine.PBE;
            import com.pblabs.engine.debug.Logger;
             
            public class Lesson1FlexBuilder extends Sprite 
            {
                    public function Lesson1FlexBuilder()
                    {
                        PBE.startup(this);
                        Logger.print(this, "Hello, World!");
                    }	
            }	
       }
   

Save the file and click Project->Build Project in the menubar.

To view our master piece click Run->Debug in the menubar.
You can see in the output window "INFO: Lesson1FlexBuilder - Hello, World!" being printed by the
PushButton Engine Logger.

Review

To summarize the steps of using the PushButton Engine with the Adobe Flex Builder IDE.

  • Create a new ActionScript project.
  • Name the project and setup the source path or library path.
And those are all the steps needed to create a fresh new project using the PushButton Engine.

Conclusion

Congratulations! You just completed lesson #1, creating a project and linking to the PushButton Engine.

This can be the base for lesson #2 or any future projects of your own.

You can download the completed project source files for this project below.

Lesson1FlexBuilder.zip