How to Import MovieClips into a Flash Builder ActionScript Project


Share:

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.

How to Import MovieClips into a Flash Builder ActionScript Project

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.

 

 

How to Import MovieClips into a Flash Builder ActionScript Project

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.

 

 

How to Import MovieClips into a Flash Builder ActionScript Project

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.

 

 

How to Import MovieClips into a Flash Builder ActionScript Project

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.

 

 

How to Import MovieClips into a Flash Builder ActionScript Project

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.

 

 

How to Import MovieClips into a Flash Builder ActionScript Project

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.

 

 

How to Import MovieClips into a Flash Builder ActionScript Project

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

 

 

How to Import MovieClips into a Flash Builder ActionScript Project

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.

 

 

How to Import MovieClips into a Flash Builder ActionScript Project

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

 

 

How to Import MovieClips into a Flash Builder ActionScript Project

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

 

 

How to Import MovieClips into a Flash Builder ActionScript Project

 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”).

 

 

How to Import MovieClips into a Flash Builder ActionScript Project

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.

 

 

How to Import MovieClips into a Flash Builder ActionScript Project

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 posts.

Share:


Creative Digital Agency

Code and Visual works with clients around Australia to create and build outstanding and accessible digital services. If you want to discus a project contact us now for an initial consultation.


Categories

Recent Posts