Flash MX 2004
July 8, 2004 7:52 PM   Subscribe

I have a love/hate relationship with Flash MX 2004. I am trying to learn it, specifically actionscript, but there are a couple things about it that drive me nuts. [Guess where the rest of the question is!]

1) It has good help, but I absolutely hate the docking model of the help window. It works for most everything else, but I would rather view the documentation in a separate app, like a web browser (how they used to do it). Is there a separate package where I could get this (i dont have net access at home, so it has to be offline, and easily gettable).

2) On the same token, the actionscript editor is awful. It works for simple things, but is really ineffective at larger projects. In actionscript 2.0, it lets you define external class files for your objects, which is all well and good, but for work in the main document, there doesnt seem to be anyway around this. I have an IDE I like, but to have to copy and paste each time I want to test something is way too clunky. Is there anyway around this?

3) I am an experienced programmer, not a designer, and there are a few little inconsistencies that get me every single time, specifically the event trapping, which seems to work totally differently between the root, buttons and movie clips. What works for one doesnt work in the other, and I cant suss out the difference, is there any good reference on the differences in the event models? I can do many other languages, but little things that should be obvious here seem to take the most time to work around.

Again, I am a programmer, not a designer, and I dont have internet access at home, so full downloadable packages are better for me.
posted by lkc to Computers & Internet (3 answers total)
 
Regarding #2 --you're on the right track, definitely give up on the internal .as editor, and just use your favorite text editor/IDE on external .as files.

I'm not sure I get the rest of #2 though, in general, a good .as 2.0 project has nothing in the fla more than event capturing and something like this:
import com.foo.Bar
Bar.init()

Or whatever other general initialization code. After that, everything can be handled in the external files.

You could even use an old-style Flash include for your initilization code (#include "foo.as").

I can't help much on #1 and #3, don't know of any comprehensive downloadable references. There are some decent books out there though.
posted by malphigian at 11:02 PM on July 8, 2004


1) Buy the (print) books "Actionscript for Flash MX, the Definitive Guide" and "Essential Actionscript 2.0", both by Colin Moock. Every Actionscript programmer that I know owns these books and they replace (and surpass) any online help.

2) Use #include statements to refer to external code.

3) Actually, the event trapping works the same for _root, buttons and movieclips -- as long as you use the same version of Actionscript for all of these objects.

In the newer (preferred) form of as, event trapping looks like this:

objectInstanceName.onEventName = function()
{
//whatever you want to happen
}

or

function doSomething()
{
//whatever you want to happen
}

objectInstanceName.onEventName = doSomething;

for instance, you could program a button and a movieClip like this:

movieCliporButton.onPress = function()
{
trace("you pressed me.");
}

this code would work for _root or a movieClip:

_rootOrMovieClip.onEnterFrame = function()
{
trace("blah");
}

Note that such code need to be attacted to a FRAME, not to a button or movieclip. In modern as, ALL code should be attached to a frame. In the bad old days, we used attach code directly to movieclips and buttons, but this lead to sloppy, decentralized code. So Macromedia updated as to make it possible to put all code into frames, where it can easily be found. But the old way is still supported, for backward compatability.

Try to avoid code that looks like this -- it's old code and should NEVER go in a frame. It only works directly on buttons and movieclips:

button:

on (event)
{

}

movieclip:

onClipEvent (event)
{

}
posted by grumblebee at 5:30 AM on July 9, 2004


After digging around a little in the Flash directory on my hard drive, I confirmed something that I had already suspected: the help files are just HTML files. They open in a "browser" that is built into Flash, but you can still open them in IE or Firefox or whatever.

On my system, the Actionscript Dictionary files are located here:

C:\Program Files\Macromedia\Flash MX 2004\en\First Run\HelpPanel\Help\ActionScriptDictionary

The problem with just opening these in the browser is that you don't get the table of contents. But that's in an XML file called "help toc" which is in the same folder (there's another file in that folder that contains the index).

Using Actionscript, you can pretty easily write a swf application that reads in XML and displays it as a clickable menu. You could then embed that SWF in an HTML file and load it into the browser of your choice. If I get some time, I might try to whip something up, but as you're learning Actionscript, it might be a good assignment for you to try.
posted by grumblebee at 6:49 AM on July 9, 2004


« Older Newlyweds and InLaws   |   Name that sample Newer »
This thread is closed to new comments.