Languages‎ > ‎Flash‎ > ‎PushButton Engine‎ > ‎

Setup using Adobe Flex Builder

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.

01.package
02.{
03.      // Flash Imports
04.      import flash.display.Sprite;
05.       
06.      // PushButton Engine Imports
07.      import com.pblabs.engine.PBE;
08.      import com.pblabs.engine.debug.Logger;
09.        
10.      public class Lesson1FlexBuilder extends Sprite
11.      {
12.              public function Lesson1FlexBuilder()
13.              {
14.                  PBE.startup(this);
15.                  Logger.print(this, "Hello, World!");
16.              }  
17.      }  
18. }

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.

Comments