Victor Gaudioso is a Sr. Application developer for an advertising firm in Hollywood, CA. He specializes in Flash / ActionScirpt but also programs in other languages including but not limited to C#, XAML, WPF and ASP .NET. He has engineered Flash sites for the major entertainment studios including Disney, Universal, TouchStone, Mattel and Warner Bros. among others. Victor is known as dvlnblk in the http://actionscript.org forums and has recently been appointed a site moderator. AIM: dvlnblk2004 Yahoo: victoratdeadline
The first thing we need to do is open Flash CS3 and create a new Flash File (ActionScript 3.0) as I did in Figure 1-1.
Figure 1-1: Create a new Flash AS3 file.
Next we have to save the file. When you save place the file in a directory called c:\Projects\GettingStartedWithAS3\Dev_Develop and call our file Main like I have done in Figure 1-2.
Figure 1-2: Save our new file in a directory called c:\Projects\Dev_Develop\Main.fla
Next go into c:\Projects\ and create a directory called Dev_Deploy. Once you have done that go into the publish settings of you new Main.fla and change the publish path for the swf and the html to Dev_Deploy. See Figure 1-3.
Figure 1-3: Set the publish settings in Main.fla to have the swf and html export to the Dev_Deploy directory.
This is not really essential and not specific to AS3 but I find that it is much easier when uploading the finished project to your server because all of you development files are seperate from you deployable files.
Lets now move onto the next step and create our DocumentClass.
Comment #1
(Posted by Jason Cook - djjasoncook at yahoo.com) Rating
Simple, direct and elegantly written, plus a video tutorial as well! You spoil us, Victor!
Comment #2
(Posted by Ben - ben.kramer at mac.com) Rating
I can tell you did a lot of work and know what you're talking about, but as a beginner I can't get passed the "trace statement" on page 2, is it missing? When I run my program it has a compile error 5007. Anyone else have this problem?
Comment #3
(Posted by zalah - rhonda.parsons at gmail.com) Rating
Note: a Contructor must never have a return type such as "void"
Now, lets add a trace statement into our Constructor so we can tell when it is instantiated:
Now let's move onto the next phase and hook our DocumentClass up to our Main.fla
You skipped the part showing how to add a Trace Statement.
I'm totally confused now. Is this really for beginners? If this is for beginners I think I should quit right now!
Comment #4
(Posted by alok - alok.agarwal at clearpointlearning.com) Rating
Thanks victor for this short and nice totrial. The things are well explained and defined in it. I'd like to more tutorials on flsh AS3.0. Please suggest the site. Thanks|| Alok
Comment #5
(Posted by Victor Gaudioso - vic at victorswebsite.com) Rating
I am sorry all I had assumed that everyone would know what a trace statement was (trace("This will show up in my Output window when it runs");
Comment #6
(Posted by Priyabrata - priyabrata4all at yahoo.co.in) Rating
Im the beginer of AS3,this tutorial really encourage me to learn it.
Its really healpful for me.
Thank you for it.
And I want more of AS3.
Comment #7
(Posted by ollywhizz - opurcell at gmx.net) Rating
Thanks Victor. You explained it very well. Maybe a little more on why we use addChild? It is a tutorial for beginners afterall. AS3 is looking quite like Java!
Comment #8
(Posted by an unknown user) Rating
Great tute! Also I received a compile error as well and that's because in the first line of the class i.e. "package com.identityMine.documentClass" the last part i.e. "documentClass" needs to be omitted. This can be seen in the video tutorial at the end of the tute...
Comment #9
(Posted by andrew - ajmcnutt at hotmail.com) Rating
great tutorial Victor! im just starting to use AS3 and this was very helpful.
Comment #10
(Posted by Rob Moss - rob.moss at marktwo.co.uk) Rating
Unfortunately one of the key parts of this tutorial involves "deleting the navigation button from the scene" and it's not detailed how you do this. When you select it and press the delete key (as someone not familiar with Flash might reasonably assume) the button no longer appears when you instantiate the NavBtn class and set its x and y parameters.
Great apart from that though :-)
Comment #11
(Posted by Manoj - uniyal.manoj at gmail.com) Rating
That was great Victor ! I am a Junior flash developer working with AS 2.0,Please I want more of AS 3.0,Thanks once again !
Comment #12
(Posted by Leandro - leandro.miranda.rios at gmail.com) Rating
THANK YOU SO SO SO MUCH!!! I just got started with actionscript 3.0 and you tutorial was exactlly what I needed to cover my first step. Great Job!!!
Comment #13
(Posted by Victor Gaudioso - vic at victorswebsite.com) Rating
"Unfortunately one of the key parts of this tutorial involves "deleting the navigation button from the scene" and it's not detailed how you do this. When you select it and press the delete key (as someone not familiar with Flash might reasonably assume) the button no longer appears when you instantiate the NavBtn class and set its x and y parameters.
Great apart from that though :-)"
When you say that someone not familiar with Flash might assume to select it and hit the delete key, you are right because that is exactly what I intended for them to do. Later in the tutorial we add the button to the stage with the .Add method. Hope this helps, Victor
Comment #14
(Posted by Arran - amaclean01 at hotmail.com) Rating
Daft question, but how to I change the cursor so it has the hand instead of the default arrow when I track over the _navButton?
What if you want to create multi buttons, would I have to keep doing xxx = new navButton(); for each?
Excellent tutorial.
Comment #15
(Posted by ac3NB) Rating
many tnx! just what i'v been looking for, for a week.
Greate gettingstarted!
Comment #16
(Posted by James) Rating
Hi. Not to spoil all the lovely comments, but I found that most of the time in the video tutorial, nothing was explained. Instead you just told us what you were doing, which didn't really help me to learn what any of it actually did. You said things like "I'm just going to...", you then did it, but I have no idea what it was you did!
Comment #17
(Posted by YKD - david6746 at yahoo.com) Rating
Wow Victor, what a well dcumented example and very cearly defined for us newbes.
Thanks,
YKD
Comment #18
(Posted by Roberto - roberto.cinetto at tele2.it) Rating
you may have to correct this tutorial... there's a missing passage
Comment #19
(Posted by jay - jaehackroh at gmail.com) Rating
***1017: The definition of base class NavBtn was not found.
I followed instruction line by line and having error above while debugging.. I am literally a beginner. I would appreciate for help from anybody. thx in advance..
Comment #20
(Posted by Silvano - silvano.de.gennaro at cern.ch) Rating
This is all good for one button, but what happens when you have a remote control with 16 buttons? do you have to do all that for all of them (i.e. 16 classes/files/packages etc.), and how do you pack things so that you can drag the remote around the stage with all the buttons in it?
Comment #21
(Posted by Scott - scottb2k60 at hotmail.com) Rating
Excellent, gives a good outline of the features of AS3 and helped me see some of the differences from AS2.
Comment #22
(Posted by Ayrat - ayratgr at yahoo.com) Rating
Great article, although omissions at some places can complicate life when you're a beginner (s.a. "Now, lets add a trace statement... when it is instantiated:", p.2)
Tip: if the app runs without complaining but doesn't show the dynamically generated button when it should (p.5), try "File->Save all"
Comment #23
(Posted by Miiiriam - mrieckmann at gmx.net) Rating
good tutorial, except there were some inconsistencies with your description as to where to add code. One time you mean by "under the constructor" INSIDE the block statement, another time you want the code to be added AFTER the constructor block.
Comment #24
(Posted by Vlx - vlxwm at nadlanu.com) Rating
You really put big effort on this tutorial, and it is really nice.
Unfortunately, when you start Flash SC3 for the first time in your life (like myself) it becomes a 2 hour work, and I must admit, comments below the tut helped me ALOT. ;)
Comment #25
(Posted by Chris) Rating
I followed step by step precisely, but when I run the movie, I get an error, "5007: An ActionScript file must have at least one externally visible definition.
Comment #26
(Posted by camero - cmurchie at sympatico.ca) Rating
Excellent, excellent, excellent ( and 3 thumbs up ) Victor!
I'm finally at the 'Stage' where I can find what 'I' don't understand right away without having to whine. ie. I can finally appreciate such a superb tutorial as this, which you share so graciously.
Many thanks !
Comment #27
(Posted by Andrew - andrewvelan at hotmail.com) Rating
Hi,
I am new to this stuff and I am having a little trouble. I cant seem to get the "DocumentClass Initialized" printed to the output. I followed all the steps, but all the files in the correct directories and everything and then click test movie (with the output window opened) and the trace that I put in the documentClass.as file isnt being printed to the output window. I think there is a problem connecting the documentClass.as file with the Main.fla???!?!?! please help me.
Comment #28
(Posted by Andrew - andrewvelan at hotmail.com) Rating
wheres the video tutorial?
Comment #29
(Posted by SomeGuy - none at nowhere.com) Rating
In your first step you refer to the package declaration as a namespace but they are seperate things according to the CS3 manual. Could you clarify please? thanks