Tuesday, May 11, 2021

Flash Tutorial: How to Import MovieClips into a Flash Builder ActionScript Project

With the
release of the new Flash Builder Beta 2from 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

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

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

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

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

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 seeing as this is the whole point of
the tutorial.

Using Movieclips in Flash Builder - Step 6

your new project a name, and then click the “Next”

Using Movieclips in Flash Builder - Step 7

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

Using Movieclips in Flash Builder - Step 8

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

that you’ve located your .SWC file, you should be able to view its
contents via the Package Explorer window.


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 be 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 are
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 fill
some of it for you automatically. 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
realize 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.

Popular Articles