I’ve decided to do a quick case study on how to use Flash on the website in the modern world now we all know that the biggest problem with using Flash is that in this new world of responsive website is it just is incompatible with smart phones and also some tablet computers.

Now because of this a lot of people have stopped using Flash altogether which is a shame because you get an incredible benefits from using Flash on your main website and if you’re clever about the way you design your website having Flash on a should not be a big problem.

Here is a great example of how to use Flash on your website as you can see this website http://www.mintlocksmithscroydon.co.uk/  use flash to create a slideshow on the homepage now I must say that for a locksmiths site this is quite attractive using the two different elements with the image sliding in one way and the text sliding in another.

mint locksmiths croydon

Now I know you’re thinking this website may look great now but when you try and use a smart phone to view it it will have a blank space where the Flash player used to be and that is where you would be wrong.

Because the clever design of this website used a separate responsive site for mobile phones and tablet so you don’t have to worry about not having Flash player on a smart phone because they will be taken to a completely different website if they arrive using a smart phone or tablet computer.

This way the locksmiths customers get the best possible user experience on multiple devices they get a custom-built website for mobile phone users and a custom-built website for PC users.

I rethink this is the way that most websites will move forward in the coming years having a standalone website for PC users and a standalone website for mobile users and if the website is designed clever enough use will not notice that it is being redirected to one that fits its device perfectly.

So here’s a great example how Flash will live on into the modern world of responsible website.

I have been working with a company called Meanpod they provide a large range of mobile accessories online. The reason I have been working with them is because they wanted to develop a product zoom so that when a customer hovers the mouse over a product image it zooms into that image.

He is an example of the product image before zooming in

meanpod zoom
And here is an example of the image once you hover over it with your mouse to zoom into the product.

meanpod zoom in

As you can see it allows you to have a closer look at the products and helps you see the detailed parts of product without having to make it full screen which makes the website more user-friendly.

Now because this website is not developed on any particular platform it was a lot harder to develop the zoom function to work correctly on all product pages so that new products could be added easily without any additional code being required.

Example if this was an e-commerce site that was developed on WordPress there are a number of different plug-ins you can use to do product zoom very easily for example Zoom magnifier.

This is a very simple plug-in you can use that will give you the same product zoom feature without having to learn any elaborate coding skills.

But with this website because it was created as a standalone website and not developed on any particular platform it took a lot more work to develop this because we had to make sure that the function did not interrupt with the mobile friendly aspect of the site. Because a large proportion of their customer base used smart phones because let’s face it there they smart phone accessories website.
We also help them develop an element so they could add short product descriptions into the product category page this helps them be a little bit more search engine friendly, because it thickens out the page and doesn’t leave you with lots of pages with very thin content and lots of images which we all know can have a negative effect on your search engine ranking.

We basically enable them to write 100 word descriptions for each one of their products and this will appear in their category page for each product helping to bulk out the website and provide more quality content.

If you’d like to see the changes that we’ve made to this website then you can check out the MeanPod website.

I’ve been recently working with a small building company in Croydon. I had them do some work on one of my properties and got talking to the owner of the business and he was telling me how he needed a new website for his business.

So after a little bit of a chat I decided that I could help him develop a new website for his business. Now it is a small family run building company so he wanted the website to reflect that and make his customers aware of the history of the family business.

Because he felt that the current website was to corporate looking and didn’t represent them as a company very well as they are a small local business and wanted their customers to realise this.

So after a few different design chats we finally came up with some think that not only provides a good look and feel for the business but also has good elements for the search engines to help provide more business in the future.

Something that you will realise if you ever make a business website is that it is very important to make sure that your website fits the business. But also that the website is search engine friendly and also mobile friendly because a large proportion of any businesses traffic comes from the search engines and a lot of that is now done on smart phones.

So you need to make sure that it fits all three of these criteria well so that you have a good function local business website.

After developing the new website I showed it to Graham the owner of Minters Builders and he was delighted. It represents the fact that they are small local business and doesn’t look too corporate or flashy but still looks modern.

Click the link to check out Minters builders new website http://www.mintersbuilders.co.uk/

A good tip for developing local business website is to develop them on WordPress as this is a very flexible platform and great for developing and creating small website.

The only thing you need to bear in mind about using WordPress is to make sure that you have adequate security measures in place to make sure that you do not get the site hack or redirected. You can do this using particular security plug-ins I’ve written an article about this which you can see if you click here

A friend of mine was running this WordPress site postcard cash review and kept on having the problem of people hacking it.

So he came to me and asked me what he could do about this problem and how we can prevent this from happening in the future.

So after a little bit of research I found a few plug-ins that would really help prevent this from happening the first one is itheme security

As this great little plug-in will help you change your log in URL so you are not vulnerable to brute force attacks on your login page

You also add a lot of other security features to your WordPress site to help prevent you from getting hacked other ways and the best bit about this plug-in is it is absolutely free.

After we installed the plug-in to postcard cash we haven’t had another attack which goes to show just how powerful this little plug-in is.

So if you are having problems with your WordPress site and keep on getting hacked then I would highly recommend you try the itheme security plug-in at it really make a dramatic difference to this site.

Another tip would be to make sure that you update your WordPress theme every time a new version is released and also make sure you keep your plug-ins updated as this can prevent people being enacted to your site through plug-ins or problems with the WordPress theme.

Adobe has dropped the Flash player on mobile devices have a look at the article here and we can already see a lot of ridiculous and fantaisist articles more based on wishful thinking than on facts flourishing around the web. Some articles are doing the easy jump and are saying that “Flash is dead” without understanding that Flash is not just about banners. For those who are still unsure of what HTML5 is, I will remind you that HTML5 is mainly a language to create application running in the browser nothing else, Flash is used from the web up to desktop development. The Flash haters are really excited by that news but I am afraid they are going to have to wait a long time before they can burry their long time enemy. Flash is alive and kicking!


There is a hot debate at the moment regarding Flash “vs” HTML5. As a Flash developer I thought I would join in to share some of my points of view. Since I am an Actionscript developer you might think that I am going to fall in the easy and logical attitude of defending Flash and Flex (since Flex is also concerned here) at any cost. That’s not the case. I am also not going to say that HTML5 is the long awaited Messiah that is going to bring a whole new dimension to your web browsing experience. I think that the situation needs to be seen from a more rational and holistic point of view.


Many arguments are thrown in the air around the debate and tend to go from one extreme to the other one:

  • You have the “Flash-haters” that generally have never used Flash and hardly know what it does or could do (nor do they with HTML5 ). They keep coming up with the same old arguments “I hate Flash intros”, “I hate Flash banners”, “I hate Adobe”, “The Flash player crashes my browser”…etc
  • You have the “enlightened” HTML5 disciples who think that their new god is going to bring a new web order and that Flash and his minions are doomed.
  • You have the Flash addicts that cannot be bothered to look at the big picture and will reject anything that could threaten their Flash way of life.

Obviously none of the arguments summoned by the categories above are wise since they are based on an emotional approach and not on a pragmatic set of arguments.

Simplifying web development

I think there is a higher good, and for the web it is called “open standard”. The Flash player is a fantastic platform but let’s not forget it is controlled by a single vendor, Adobe, very much like Windows is controlled by Microsoft. The Flash player is a wonderful step in the history of the web but it is a plugin and a plugin is something you plug in, it is not native. The big dream is that the internet should be relying on one solid open standard API supported throughout all browsers and from a philosophical approach HTML5 seems to me like a good step in that direction.

A wrong debate

There is no HTML5 versus Flash, I think they are not really competing to be honest. I cannot remember when the last time was that I created a full Flash web site, most of my latest big projects are running outside a browser as desktop applications. We all hate Flash intros anyway and I never advocated that Flash was the best choice to create a web site. After the Flash fever that took over the web at the end of the nineties many big corporations, especially in the car industry, moved away from the “pure flash” website and are now using a mix of Flash and HTML instead.

Some facts on a good use of the Flash player

It’s been used many times as an argument that “Flash is a CPU hog”. Let’s not forget here that a lot of Flash developers are not coming from an academic programming background and are self-trained, for the best and also for the worse. The nature of Flash (that is both graphic and code oriented) generated the new breed of designer-developer, the “devigner”, a generally well balanced individual with a good graphic and code approach but with great variations. Creating and running some impressive Flash content is not so difficult if you understand how Flash works and how to copy and paste the code of others and where to paste it and if you are a bit clever that is not too difficult. Now having that same content run smoothly without leaving a huge memory footprint and overheating your CPU is something else that should be left to the professional and that is another story. The problem with Flash is that the market has been quickly plagued with wannabe Flash developers who have no clue about memory and CPU management. So yes a lot of Flash content currently running on the web will clog your CPU and memory but only when it’s been created by beginners with no insight in OOP and no good coding practises at all.

If you are a “dirty coder” you can easily get away with murder with Flash because the SWF is a compiled format and your code cannot easily be seen, very lucky for some; With Javascript, CSS and HTML, it is very easy to view the source and also very quick to see the differences between a professional approach and a random approach. So no wonder why the Flash player has been stamped as a “CPU and memory hog”. Don’t blame it on Flash, blame it on the lack of professionalism of many Flash “coders”.

From a development point of view

A strong point in favour of Flash is that everything can be created in the Flash environment using the design tools and Actionscript. You don’t normally need to use any other programming languages except when you need to interact with server side scripting. HTML5 will require interaction between javascript, CSS and Ajax in order to create what can currently be created in Flash with a simple Tweening API or even directly using the time line (although not recommended anymore with AS3).
A strong point for HTML 5 is that although HTML5 will require interaction between Javascript, CSS and Ajax in order to create what can currently be created in Flash with a simple Tweening API, it will be running directly inside the browser without the need of a plugin and will therefore be more “natural”.

It is easy to see that with HTML5 we are going to go through a show-off period, very much like what happened with Flash at the end of the nineties. There is already some fantastic demos out there demonstrating the power of the Canvas element and it is interesting and exciting at the same time.

The right tools for the job

Let’s not forget that Flash and Flex are now perfectly suited to create desktop applications using either the AIR framework or 3rd parties application like MDM Zinc and, HTML5 is totally useless here. Flash initially considered as a web tool only has slowly been used to develop applications running on the desktop, widgets and cdrom.

Should Flash developers be worrying?

Yes and No.

Yes because the IT job market is quick to sniff what seems to be the “new thing” and will quickly react by offering new positions for HTML5 developers with javascript, CSS and Ajax and there might be less Actionscript development positions on the market. To be honest if you are a good Actionscript programmer the move is very quick and easy since Actionscript and Javascript share a syntactical core based on ECMAScript edition 2. If you are already a good Actionscript developer you will probably find HTML5 quite easy.

No because Flash cannot be replaced in many areas like games, desktop widgets, e-learning interactivities and many applications that require advanced animation API or techniques. Although Flash has its flaws and requires occasional hacks, it became a solid platform and it will probably take about 10 years before HTML5 offers the same level of maturity.

Final words

At the end of the day the most important factors to consider are:

  • FOR THE USER, we want a technology that works, which doesn’t require any technological knowledge to use and that runs smoothly on any platform. Nothing to install for HTML5 since it will be native and supported (hopefully) by all the major browsers which is great. For Flash the user needs to install the Flash player but honestly Adobe did a great job here and it is quick and painless.
  • FOR THE DEVELOPER, we want him to have an easy life and not spend hours trying to find out what is the correct hack to have a piece of code working in all the major browsers and here Flash still has the lead since everything developed in Flash will work in the Flash player provided it is programmed by coders who know that a variable or a listener is not an evanescent spirit floating in the universe but that it actually resides somewhere in the local machine memory and that it needs to be taken care of properly before the user machine freezes.

We will see where it’s all going, very exciting anyway, the web history is being built now.


If you have been working with actionscript for a while you should know that the main goal should not just be to “make it work” but to make sure that your code is implemented following the rules of simplicity, clarity and elegance. This is not always easy to achieve especially when you have to work under strict deadlines.


Personally I don’t have time to reinvent the wheel every time I start working on a new project and I try to reuse as much as possible classes and utilities I have already developed (when I had the time to do so). But since our days just have 24 hours we don’t always have the time to create a particular class utility or API for a particular project therefore it is always precious to know that there is an existing gold mine of existing utilities which are freely available over the internet.

I though it would be very informative to give you a list of class, APIs and utilities that I have been and am still using in order to simplify my life as a developer, the list below will be updated regularly, also don’t hesitate to drop a comment at the bottom if you found something useful that would deserve to be added to the list.

Actionscript editors

If you have been coding in the default Flash actionscript panel until now it might be time to review the situation because there is better solutions out there.

  • Flashdevelop is my prefered actionscript editor for the main reason that it enhances my productivy massively, the only downside for now is that it does not has a refactoring and autoformat utility. When I need to do that I will use Flex in parallel. In any case I will favor Flashdevelop over any other actionscript editor.
  • FDT3 is a dedicated actionscript editor built on Eclipse, it is a powerful editor and it has many features that Flashdevelop does not have but I am not a big fan of Eclipse and therefore this wasn’t my first choice. Also FDT is fairly expensive while Flashdevelop is free (donations warmly accepted if you like it) I recommend you have a look at it and install the 30 days demo.

Although I am not a big fan of Eclipse I would still recommend that you learn to use Flex and FDT since those two applications are used extensively in the Flash industry and you will need to know how to use them if you want to raise your chances to get a job in the Flash and Flex industry :)

I am not going to write much about Flex here because it is more than a coding environment and I have already wrote and article on Flash and Flex.

There are other actionscript editors out there that you might want to have a look at, there are not in my favourite list because they either lack support for AS3 or are don’t fit my needs but since we all have different tastes and needs you can also have a look at: SepyPrimalScriptASDT.

APIs and Libraries

Tweening engines

If you are not satisfied with the default built in Tween class here are other potential choices you might want to have a look at:

  • TweenMax (AS3 and AS2) if you are looking for an easy way to tween with code look no further, I am using it regularly.
  • Tweensy (AS3) is another popular choice which is (not verified personally) apparently faster than TweenMax, contained within Tweensy is an expansion package called Tweensy FX which allows for motion effects to be applied onto DisplayObjects. Tweensy is more dedicated to bitmap and particle rendering.
  • Tweener(AS2, AS3) is another solid contender that I used in the past and is still regularly updated
  • AS3 animation system 2.0, I haven’t tried that one personally but if it does what’s written on the tin it sounds very promising.
  • GOASAP, here is an interesting generic base library for building animation tools in ActionScript 3.0, if you are looking for something simple this is probably not for you but if you are serious about advanced development and flexible approaches to animation it might be worth a look.
  • GTween (AS3) is another interesting tweening engine, still in beta but promising.
  • Twease is another lighweight tweening engine for AS2 and AS3

Flash and 3D

  • Papervision3D is an Open Source realtime 3D engine for Flash, it is probably the oldest one and you will find plaenty of tutorials around to get you started.
  • Sandy Sandy is a Flash 3D engine, available for and AS2, AS3.
  • Away3D is another popular 3D engine for Flash.
  • Alternativa3D is an impressive 3d engine for Flash, the 2 demos on their homepage are really worth checking.
  • Coppercube is a commercial application still in beta stage that let you create 3d scenes and animations for Flash using a WYSIWYG editor and “without programming”,you can import your 3D models into the CopperCube editor and publish them directly as Flash .swf file for websites or as standalone windows .exe file.

Flash will never try to compete with the big 3d softwares like Lightwave, Maya or 3DSmax and it is not recommended to develop highly complex 3d worlds in Flash because you will never achieve what can be done with those dedicated 3d applications, nevertheless those engines are very useful when you want to add an extra touch of 3D to you projects.

Other APIs

  • corelib
    The corelib project consists of several basic utilities for MD5 hashing, JSON serialization, advanced string and date parsing, and more.
  • FlexUnit
    FlexUnit is a unit testing framework for Flex and ActionScript 3.0 applications. It mimics the functionality of JUnit, a Java unit testing framework, and comes with a graphical test runner.
  • Flickr
    The Flickr library is an ActionScript 3.0 API for the online photo sharing application, Flickr. It provides access to the entire Flickr API.
  • Mappr
    Mappr is a service and application that combines images from Flickr with geolocational information. The Mappr ActionScript 3.0 API gives you access to Mappr’s geo-tagged image data.
  • RSS and Atom libraries
    Use the RSS and Atom libraries to parse Atom and all versions of RSS easily. These libraries hide the differences between the formats so you can parse any type of feed without having to know what kind of feed it is.
  • YouTube
    The YouTube API provides an ActionScript 3.0 interface to search videos from YouTube.
  • Google map
    This ActionScript API provides a number of utilities for manipulating and adding content to maps through a variety of services, enabling you to embed robust, interactive maps applications on your website or in desktop applications.
  • Yahoo maps
    SWC for Flash and Flex 3 enables you to add a map to a wide range of web and desktop applications. Included in the API is support for other Yahoo! APIs including geocoding, local search and traffic APIs along with an advanced marker and overlay system to allow you to easily render geo-data on the map.
  • Ebay
    The eBay ActionScript 3.0 library provides an interface between the eBay XML API and ActionScript 3.0. This open-source library will allow developers to create novel and innovative applications leveraging both eBay’s marketplace services and Adobe’s Flash Player 9 runtime! It is written in ActionScript 3.0, so any environment using ActionScript 3.0 can use this library, including Adobe Flex 2 and Adobe Flash Pro 9.

This article will be regularly updated.


I have been working with Flash for about 10 years now, I have seen it growing and improving over the years and I became very familiar with that piece of software. Flash is a familiar working environment and when I start developing I know where I need to go and I know how to get there. It took a lot of time and patience, actionscript has changed over the years and I have also felt frustration at times but I have always managed to do what I wanted to do with Flash and I could not see a reason to change the way things were.

A discrete newcomer

When I first heard about Flex I must say that I did not pay too much attention to it, especially that it came as a SDK without user interface and since I have never been a big fan of command lines it didn’t help to attract me. Also Flash CS3 wasn’t released at that time and therefore my AS3.0 experience was pretty poor.

Then came Flex builder, a product with a user friendly interface built on top of the Flex SDK. I decided to give it a go and installed a demo version and I have to say it wasn’t love at first sight, no timeline, no design tools, a strange way of mixing MXML tags and Actionscript. All that seemed a bit confusing to me and I could not see the point of learning a software to develop applications that I could already develop entirely in Flash therefore at that point I did not spent too much time with Flex and went back to my first love.

Developing RIAs with Flash

At that time I was working in an e-learning company and was working on a couple of applications involving live data, those applications would probably fall today in the RIA (Rich Internet Application) category. I had decided to use Flash since I was very familiar with the software and actionscript 2.0 at that time. As I was moving along in the development I quickly realised that, although Flash had a fair amount of useful components, it was still necessary to write a lot of code to deal with simple data operations and to adjust the display to the data changes. After a fair amount of trials and errors I finally reached a satisfying result, but I was left with a feeling that if I had to do it again I might have a second look at Flex that was apparently perfectly adapted to the development of RIAs. I was especially looking for a way to simplify my workflow and enhance my productivity.

After that experience of developing my first RIAs in Flash, Flash CS3 was released and, as I was starting to fiddle with AS3.0, I thought it would be a good time to have a second look at Flex. This time I wasn’t just driven by a simple curiosity but I was really looking for some precise answers. I had met precise problems with Flash and I wanted to see if Flex would help me to solve them more easily. At the end of the day I am a developer and what I worry about is scalability, reusability, maintenance and productivity and I wasn’t so sure that Flash was the best way to solve those issues when it comes to develop RIAs.

Why Flex Builder is more suited to application developement

I have now been using Flex for a while and I love it :) I suddenly realised that if it is for me the perfect tool to develop RIAs. Don’t worry you can develop RIAs in Flash, there is nodiscussion about that but Flex will vastly enhance your productivity.

I have highlighted below a couple of points that I think are worth considering before you choose to use Flash over Flex to develop an RIA.

Interface creation

Assembling an interface in Flash with the built in components can be a bit of a chore, you have to create containers yourself and assemble the interface hierarchy by hand. In Flex I have to say that it is a lot easier. Flex has a lot of Layout components that will let you assemble and build an interface in no time at all. the main reason of MXML in Flex is to simplify the interface creation and it does its job wonderfully. Since MXML is tag based, very much like HTML and XML, you can also assign events, properties value and id (instance name) directly in the tag as attributes. When you compile your application MXML is then converted into Actionscript code. In Flash you would have to write it all in Actionscript 3.0 directly there would be no way around.

Skinning and CSS

If you are not happy with the default look and feel of the flex components you can define their style in a CSS document and you don’t even have to do it manually it is all done through the Flex Builder Interface, just with one click you can assign a style to a set of components. If you have ever work with CSS in Flash I am sure you understand the beauty in this.
Along with being able to create styles you can also skin your components with graphics and again it can all be done through the Flex Builder interface, in a couple of clicks you can see the boring default look and feel turn into a colorful personalized component.

Data Binding

If you were looking for only one good reason to move to Flex to develop RIAs it would be data binding. Data binding means that you can associate a piece of data with a component and whenever the data is updated from wherever in your application the view on that component will refresh to display the modification. Basically this means that you can concentrate in the code in the background without worrying on the view and trust me this is a feature that you will miss when you go back to Flash.
Since RIAs are nearly always fed with live data this feature really is a must have to enhance your productivity and take away a lot of worries.


I see the states in Flex as a replacement from the frame based timeline of Flash. Basically in Flash you would move to another frame of a graphic element to display another visual state. In Flex this is done through states and it is very quick to understand how it works. Instead of using a gotoAndStop(“myFrameName”) in Flex you would use currentState = “myStateName”, the concept stays the same.

A rich set of components

In Flash I have to say that I tried to avoid as much as possible to use the default components, the main reason being that they were adding quite a lot to the file size and most of the time I did not need all of the features that they were offering. I prefer instead to develop my own lightweight components that are doing just what they need. When it comes to develop RIAs it is another story, you need a powerful set of component that needs to be very functional and work well together and Flex Builderprovides just that. Flex Builder also has some nice components like the charting set that are a great addition to the original set.

Flex and Flash are not competing products

Flex and Flash are two different tools and the task you have to accomplish will determine which one is the best for the job. If you are planning to create a lot of graphics and animation Flex is not the best tool to choose but Flash is a best choice. If you need to develop a web application with a lot of control and involving display of dynamic data then you’ll have less worry if you use Flex. At the end of the day I use them both equally, I create the core interface and engine in Flex and then use Flash to add design and animations if necessary.

If you are a Flash developer wondering if you should start checking what Flex is all about then I would suggest you have a look at it, you might never need it but you want to make sure that you understand exactly what it does and how it does it, you never know. Even if you are just a Flash designer you might have to work with Flex developers and it won’t hurt to have a look at it. Personally I am glad I had that second look at it, I am not using it because it is the “new thing” but because It simplifies what I have to do and it’s all I care about.


Things have changed a little bit in AS3.0 when it comes to load XML but I am going to show you it is very easy to do once you done it a couple of times.

In AS3.0 It is a bit different because as you know you need to write a bit more code to accomplish simple tasks. Let’s have a look at the tutorial.

First let’s create a little XML document that describe a list of fruits.

Save your XML list as fruits.xml and open a new AS3.0 document in Flash, on the first frame enter the code below:

import flash.net.*;
import flash.events.*

var myFruitsData:URLRequest = new URLRequest(“fruits.xml”);

var myFruitsLoader:URLLoader = new URLLoader();

function completeListener(evt:Event){
var myFruits:XML = new XML(evt.target.data);

1. The first two lines import the URLRequestURLloader and Event classes. Note that if you are writing the code in a class you also need to import additional classes.

2. The first thing we are doing is to create a URLRequest object that will contain the path to the xml file. In AS2.0 this wasn’t needed.

3. The next step is to create an URLloader object that will serve as a container for our XML document. myFruitsLoader will also serve as a loader that will inform us when it has loaded the entire document. TheEvent.COMPLETE is the AS3.0 version of our old onLoad AS2.0 event and it behaves the same way: When the data is loaded it will call the completeListener function where we will process the loaded data.

4. Once the data (loaded by default as TEXT) has completed loading the completeListener function is called, what we immediately do is to convert the loaded data into an XML object by creating an XML object from the evt.target.data data.

It is important to note here that it is the URLLoader object that contains the loaded data and that it can be access using myFruitsLoader.data or evt.target.data like in my example.

That’s it basically, in the next tutorial I will show you how to access the loaded XML data.


You might have been wondering where attachMovie has gone in Actionscript 3.0, well no need to look for it because it’s gone. In Actionscript 3.0 you will have to use another way to attachMovie clips on the stage at runtime, I am going to tell you all about it in that little tutorial.

The default way

When you create a movie clip in an AS3 Flash file and select “export for actionscript you will notice that the Class and Base class are automatically filled up (see picture below), what does that mean in the AS3 world?

pic1 (1)

Flash automatically fills the Class name field with the name you gave to your movie clip, square in our case. Also since it is a movie clip that we are creating it automatically fills the Base class field with flash.display.MovieClip.

You don’t need to worry about the Base class, that means that your movie clip is going to inherit of all the properties and methods assigned to the MovieClip class. In AS2.0 this was happening in the background but you just did not know about it.

More importantly you can also see that the class square has automatically been assigned to the movie clip, this is an important bit, it means that the compiler will be automatically looking for square.as (a physical class that you actually created) in the directory where your Flash file resides, if it can’t find it it will create a default one for you. You don’t need to create a square class if you have nothing to put in it.

Ok, our movie clip is now sitting in the library, we now need to create the code that will attach it on the stage, this is what we are doing below:

var mySquare:Square = new Square();

As simple as that, we create an instance of the square class (that will automatically be created by Flash or that you created yourself) using the new keyword and then we use the magic word addChild with the name of the square instance we just created. Notice that we are not using any linkage id anymore when we use addChild but instead we are using the name of the instance of the class.

That’s it if you run your file you will now see that your movie clip is attached to the the top left corner of the stage.

Create your own class

If you want to create a little class for your square, it is easy, got in FILE > NEW and in the window select ACTIONSCRIPT FILE

Now you can create your class, a very simple square class could be like the one below:

package {

import flash.display.MovieClip;

public class square extends MovieClip{

public function square(){
trace(“hello I am an instance of the square class”);

Save the actionscript file as square.as in the directory where your FLA resides and here you go, Flash will now use that class instead of a default one.

Hopefully this little tutorial will be helpful for you :)