First time here? First time here? Newsletter Signup Newsletter
Search tutorials
Author: James McNess | Website: http://www.codeandvisual.com
With the release of the new Flash Builder Beta from Adobe labs, more Actionscript developers will be tempted to leave the Flash IDE and head to what is now the rebranded Flex Builder. Previously there has been a bit of confusion over what Flex and Flex Builder were for, not everybody realised that you could write non-Flex applications (i.e. plain actionscript ones) in Flex Builder. And then even without this confusion those of us used to the Flash IDE still had to get to grips with not having any sort of timeline or way to edit library assets. Long story short, you still need to use the Flash IDE to create and edit your library assets, though once this is done you can export them to a .SWC file in order to use them in Flash Builder. Here's a quick tutorial to show you how.

Using Movieclips in Flash Builder - Step 1

Firstly, in the Flash IDE, create your asset and save it as a MovieClip. I'm using a character from an upcoming game called "Tooth'n'Claw" that I'm going to release soon through Actionsprite.

Using Movieclips in Flash Builder - Step 1_b

Next you need to open up the properties window for your MovieClip where we will give it a Linkage ID that will allow Flash Builder to identify the Movieclip.

Using Movieclips in Flash Builder - Step 2

In the properties window, check both "Export for ActionScript" and "Export in frame 1" - you should see that the Class value is automatically filled out by Flash - it's the same name as you've given the MovieClip. You can change this to whatever you want, but remember it because it will be the name you use to refer to the MovieClip in Flash Builder.

Using Movieclips in Flash Builder - Step 3

Now that your MovieClip is prepared, go to "File>Publish Settings" and click on the "Flash" Tab. On this screen you want to make sure "Export SWC" is selected.

Using Movieclips in Flash Builder - Step 4

Now publish your file (I've named mine "Assets.Fla") and you'll notice that a .SWC file of the same name has been created. This file contains all of the assets that you have selected for export and is the file that you will use in Flash Builder to gain access to them.

Using Movieclips in Flash Builder - Step 5

Now you can load up Flash Builder and create a new project. You'll see there are various types of projects you can create, but the one we are going to deal with is an ActionScript project seeming as this is the whole point of the tutorial.

Using Movieclips in Flash Builder - Step 6

Give your new project a name, and then click the "Next" button.

Using Movieclips in Flash Builder - Step 7

Now this is where you tell Flash Builder about the .SWC file you created. Choose the "Library Path" tab and click on the "Add SWC" button.

Using Movieclips in Flash Builder - Step 8

A dialog will appear with a "Browse" button. Click this and point Flash Builder to the Assets.SWC file you made previously.

Using Movieclips in Flash Builder - Step 9

Now that you've located your .SWC file, you should be able to view it's contents via the Package Explorer window.

step_10 Once opened, you should see the Package Explorer window open to the side of your layout. Open up the "Referenced Libraries" section. Drilling down you should ba able to see the MovieClip you named in the properties window back in Flash. In this Case its called "ninja_cat" and has a little "c" icon next to it (for "class").

Using Movieclips in Flash Builder - Step 11

Finally in the code window you can write your ActionScript as you normally would. This is where you'll start to see some of the benefits of working in Flash Builder. As a coding environment there are a lot of little touches that make your life easier - some of which is incorporated into the Flash IDE, but for some reason, not all. Firstly you'll notice that when you create a new Actionscript project Flash Builder will automatically create a Document Class for you and prefill some of it out. Create a new instance of your library item as you usually would and attach it to the stage. Flash Builder should be smart enough to realise that it needs to import the MovieClip Class as well, which it will do for you automatically - see, I told you it was good.

Using Movieclips in Flash Builder - Step 12

Finally "Run" your movie and you'll see the MovieClip has been successfully imported and added to your stage. From here on in you should be able to import and use items as you need to. If you need to add more assets, or update existing assets, simply republish a new .SWC from Flash.

So that's all there is to it. I will try and cover some more aspects of Flash Builder in future articles.
» Level Basic

Added: 2009-07-28
Rating: 7.67 Votes: 3
» Author
James McNess is owner of Code and Visual, a Sydney based company specialising in developing Flash games, HTML and Flash websites and also Flash applications for a variety of clients both large and small. They also develop Rainbow - a free online XML editor that can be used as a very simple Flash CMS for small to medium based websites.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.