Launch Configuration Tutorial

From FDT Documentation

(Difference between revisions)
Jump to: navigation, search
(Working With Launchers)
Line 3: Line 3:
Follow along by importing the project created in the [[Basic AS3 Tutorial]]. Download it [http://dl.dropbox.com/u/154189/fdt_wiki_files/as3_project.zip here]. If your not sure how to import projects, check out the [[Sharing and Archiving Projects]] tutorial.
Follow along by importing the project created in the [[Basic AS3 Tutorial]]. Download it [http://dl.dropbox.com/u/154189/fdt_wiki_files/as3_project.zip here]. If your not sure how to import projects, check out the [[Sharing and Archiving Projects]] tutorial.
-
== Why Launch Configurations ==
+
=== Why Launch Configurations ===
Customizable Launch Configurations gives developers a great deal of power and flexibility. While it would be much easier for beginners to have FDT force a particular file structure and naming conventions, as they become more and more familiar with FDT ( or any IDE ) they are eventually going to want to have things work their way. Here are some important concepts to understand when working with Launch Configurations:
Customizable Launch Configurations gives developers a great deal of power and flexibility. While it would be much easier for beginners to have FDT force a particular file structure and naming conventions, as they become more and more familiar with FDT ( or any IDE ) they are eventually going to want to have things work their way. Here are some important concepts to understand when working with Launch Configurations:
Line 31: Line 31:
Finally, press the '''Run''' button to compile our .SWF [http://188.40.67.133/wiki/File:07_017.gif].
Finally, press the '''Run''' button to compile our .SWF [http://188.40.67.133/wiki/File:07_017.gif].
-
= Working With Launchers =
+
== Working With Launchers ==
After hitting '''Run''', FDT will compile your .SWF. What you'll notice is, you can see the compilation output in the [[Console]] View and see the '''launch_1.swf''' in the '''bin''' folder [http://188.40.67.133/wiki/File:07_018.gif].  What you also probably notice is:
After hitting '''Run''', FDT will compile your .SWF. What you'll notice is, you can see the compilation output in the [[Console]] View and see the '''launch_1.swf''' in the '''bin''' folder [http://188.40.67.133/wiki/File:07_018.gif].  What you also probably notice is:
Line 40: Line 40:
Get back to the '''Run Configurations''' window and click on the '''Start''' tab [http://188.40.67.133/wiki/File:07_019.gif]. Check the box next to '''Open URI after compilation''' and click '''Browse''' [http://188.40.67.133/wiki/File:07_020.gif] to choose which .swf to launch after compilation [http://188.40.67.133/wiki/File:07_021.gif]. Next choose what you want FDT to use to view the .swf, lets use the '''External SWF Viewer''', and make sure that the viewer's width and height match your .SWF [http://188.40.67.133/wiki/File:07_022.gif]. When ready, click '''Run''' to launch your .swf [http://188.40.67.133/wiki/File:07_023.gif].
Get back to the '''Run Configurations''' window and click on the '''Start''' tab [http://188.40.67.133/wiki/File:07_019.gif]. Check the box next to '''Open URI after compilation''' and click '''Browse''' [http://188.40.67.133/wiki/File:07_020.gif] to choose which .swf to launch after compilation [http://188.40.67.133/wiki/File:07_021.gif]. Next choose what you want FDT to use to view the .swf, lets use the '''External SWF Viewer''', and make sure that the viewer's width and height match your .SWF [http://188.40.67.133/wiki/File:07_022.gif]. When ready, click '''Run''' to launch your .swf [http://188.40.67.133/wiki/File:07_023.gif].
 +
 +
== Saving Launch Configurations ==
 +
 +
One last thing we need to cover before getting into more advanced topics with launchers, is to learn about saving our configurations.  Saving configurations is important when we want to share or archive our projects to use later.  If we were to delete our project right now, we wouldn't have our launch configuration to use at a later time or if we hand off the project to someone else.
 +
 +
Saving configurations is straightforward and simple. Begin by once again opening the '''Run Configurations''' window and then choosing the '''Common''' tab [http://188.40.67.133/wiki/File:07_024.gif]. Check the '''Shared file:''' radio button and then select '''Browse...''' [http://188.40.67.133/wiki/File:07_025.gif]. Choose the '''launch''' folder ( you can choose any folder you like ) [http://188.40.67.133/wiki/File:07_026.gif], and run the configuration once again [http://188.40.67.133/wiki/File:07_027.gif]. After the configuration runs, your .swf will render and FDT will have created a launch configuration within the '''launch''' folder.
 +
 +
== Changing Compiler Options ==
 +
 +
There's no doubt that at some point you're going to want to adjust some compiler settings.  You may want to change:
 +
 +
* Background color
 +
* Frame rate
 +
* Size
 +
 +
We'll do this via the '''Compiler Arguments''' tab [http://188.40.67.133/wiki/File:07_029.gif]. Then select the '''Use launcher specific compiler arguments''' radio button [http://188.40.67.133/wiki/File:07_030.gif]. Then add an argument to change the .SWF's default size to 800x600 [http://188.40.67.133/wiki/File:07_031.gif]:
 +
 +
<syntaxhighlight lang="actionscript">
 +
-default size 800 600
 +
</syntaxhighlight>
 +
 +
If you ever need to find out what compiler arguments to use, click on the '''Show compiler documentation''' link on the bottom [http://188.40.67.133/wiki/File:07_032.gif].  FDT will then open up your browser and navigate to the documentation home page [http://188.40.67.133/wiki/File:07_033.gif].
 +
 +
Run your launcher again and see the External SWF View pop up [http://188.40.67.133/wiki/File:07_034.gif].
 +
 +
A quick note here, notice how the External SWF Viewer's size is still 550x400.  Our .SWF is launching at 800x600 and this will cause some odd scaling issues. To correct this, return to the '''Start''' tab of the '''Run Configurations''' window and adjust the width and height of the External SWF View to match your .SWF's default size [http://188.40.67.133/wiki/File:07_035.gif].

Revision as of 20:09, 19 September 2010

An essential aspect of FDT is the Launch Configurations. If you don't understand how FDT builds your projects, you may find yourself not understanding why certain things are and are not happening. Also, not having a clear understanding of Launch Configurations will mean that you will be missing out on incredible features that other IDEs can't even touch.

Follow along by importing the project created in the Basic AS3 Tutorial. Download it here. If your not sure how to import projects, check out the Sharing and Archiving Projects tutorial.

Contents

Why Launch Configurations

Customizable Launch Configurations gives developers a great deal of power and flexibility. While it would be much easier for beginners to have FDT force a particular file structure and naming conventions, as they become more and more familiar with FDT ( or any IDE ) they are eventually going to want to have things work their way. Here are some important concepts to understand when working with Launch Configurations:

  • Developers can set ANY class to act the 'Main' or 'Document' class of a project. As long as the Class exists within any source folder, it can be used to build your application.
  • You can easily change the name of the output .SWF to anything you want without having to alter any compiler arguments yourself.
  • A project does not itself contain launch or compile settings; instead, a project has one or more launch configurations (saved as files in your .settings folder) which contain the settings FDT uses to compile your .SWFs.

That last point is probably the most different when coming from other IDEs. The best way to explain this is to demonstrate it.

Getting Started

After importing the project created in the Basic AS3 Tutorial ( or creating your own ), expend the launch folder located within the .settings folder [1]. Here you can see the Main.launch file that contains launch settings for this project. Now, delete that file ( don't worry well make plenty more ) [2]. Make sure no file is open in the Editor ( if the Main.as class is open in the Editor close it ) then click on the Run button within the menu bar Run button.gif.

What should happen next is FDT will show an Unable To Launch dialogue box [3].

What's going on is, neither FDT nor our project themselves know how to compile a .SWF or .SWC. They rely on a Launch Configuration to tell them what settings to use in order to compile anything. FDT or a particular project are just like a plane and all your code are the passengers. In this scenario, think of the Launch Configurations as the pilots who know where to fly and how to get there. Just like a plane can have multiple pilots, FDT can have multiple launch configurations.

Creating Configurations

In both the Basic AS3 Tutorial and the Flex / Air Tutorial, it was demonstrated how FDT can create a Launch Configuration automatically by running the from the Flash Explorer [4] or by running from the Editor [5]. Instead we'll create a configuration completely from scratch. Begin by choosing Run Configurations... [6]. What will appear is FDT's Launch Configuration Window. Select FDT SWF Application [7] and click on the New launch configuration icon at the top [8].

For this example, I didn't have the project selected in the Flash Explorer and FDT didn't automatically fill in the Project field and gave the configuration a generic name of 'New_configuration' [9].

Fill in a name for the configuration, I'll name this one 'launch_1', and click the browse button to choose a project [10]. FDT will ask you to choose a project for this configuration, we only have one project open so only one appears, and click OK [11]. FDT will now warn you to You must choose a Main Class! - choose one by clicking on the Browse... button [12]. Just like with choosing a Project before, chose your Main Class -only one file appears because our project only has one Class in it [13]. Now FDT tells us You must choose a swf output file! [14]. If you were to click Browse... this time, FDT will ask you to choose an already existing file. Let's not do this and instead create a new one. Fill in bin/launch_1.swf in the Output field, bin is the name and path of the folder I want to use and launch_1.swf is the name I want to give the .SWF [15].

Finally, press the Run button to compile our .SWF [16].

Working With Launchers

After hitting Run, FDT will compile your .SWF. What you'll notice is, you can see the compilation output in the Console View and see the launch_1.swf in the bin folder [17]. What you also probably notice is:

  • FDT didn't show the .SWF.
  • FDT didn't save a launch configuration in the .settings/launch folder.

While this may seem like an error or a hassle to deal with, this is actually a gem of a situation. We need to tell FDT what to do, if anything, after compiling our .SWF. As we'll soon see, we can start to do some really cool stuff. For now, lets get to viewing our .SWF.

Get back to the Run Configurations window and click on the Start tab [18]. Check the box next to Open URI after compilation and click Browse [19] to choose which .swf to launch after compilation [20]. Next choose what you want FDT to use to view the .swf, lets use the External SWF Viewer, and make sure that the viewer's width and height match your .SWF [21]. When ready, click Run to launch your .swf [22].

Saving Launch Configurations

One last thing we need to cover before getting into more advanced topics with launchers, is to learn about saving our configurations. Saving configurations is important when we want to share or archive our projects to use later. If we were to delete our project right now, we wouldn't have our launch configuration to use at a later time or if we hand off the project to someone else.

Saving configurations is straightforward and simple. Begin by once again opening the Run Configurations window and then choosing the Common tab [23]. Check the Shared file: radio button and then select Browse... [24]. Choose the launch folder ( you can choose any folder you like ) [25], and run the configuration once again [26]. After the configuration runs, your .swf will render and FDT will have created a launch configuration within the launch folder.

Changing Compiler Options

There's no doubt that at some point you're going to want to adjust some compiler settings. You may want to change:

  • Background color
  • Frame rate
  • Size

We'll do this via the Compiler Arguments tab [27]. Then select the Use launcher specific compiler arguments radio button [28]. Then add an argument to change the .SWF's default size to 800x600 [29]:

-default size 800 600

If you ever need to find out what compiler arguments to use, click on the Show compiler documentation link on the bottom [30]. FDT will then open up your browser and navigate to the documentation home page [31].

Run your launcher again and see the External SWF View pop up [32].

A quick note here, notice how the External SWF Viewer's size is still 550x400. Our .SWF is launching at 800x600 and this will cause some odd scaling issues. To correct this, return to the Start tab of the Run Configurations window and adjust the width and height of the External SWF View to match your .SWF's default size [33].

Get FDT5