Reputation: 1637
Which is preferred and why: keeping the AS in the Flash file itself, or linking to the .as with the Flash file.
I've seen both done. Is it just a matter of preference?
Thanks
Upvotes: 0
Views: 1976
Reputation: 13151
It's more of way of collaborating work than merely a preference.
For example, Consider the development of a game,
A graphic designer's job is to create images. He does not need to be bound by the flash IDE he can create images (as sprite sheets or individual bitmaps or vectors) & keep them separate. All one requires is graphic editors (2d or 3d).
A level designer can store the level design using excel like data sheets. Conveniently fire up only text editors when needed to edit the design. Again not bound by flash IDE.
The programmer can keep all the logic in AS3 files & integrate the whole system together. Again, should he be bound by the flash IDE? That's the question.Can he just not use flashdevelop?
When a developer may take all or some of the roles above, it comes down to the complexity of the project. If manageable in the flash IDE itself ( a small project, usually) can be done with the IDE only.
Also every AS3 programmer does not own a flash IDE. Flash IDE is a product with rich features & to enable a quick development. But all of it is not always needed by a programmer.
Upvotes: 3
Reputation: 5577
Having code in the .fla makes it considerably harder to even find the code. AS3 is considerably better than AS2 in this regard (AS2 could be placed on individual buttons, but AS3 can only be placed on frames) but the code still gets scattered all over the project and sometimes you have to search deep in nested objects in order to find bits of the code.
That is just a nightmare to work with. I once had to fix code someone else wrote all over the project and it was a nightmare, the worst spaghetti code imaginable. Every change took an hour of searching just to find the spot where the relevant code was.
Upvotes: 1
Reputation: 10154
Personally, having done development on both sides at the same time. It is ALOT easier to organize your code. As one of the most missed feature advantage (in FLEX), is that the code in the .as file has its references checked for in the .mxml file.
Hence it can be provided to facilitate distinction in 2 different means of project development (Especially if you have both on 2 different screens at the same time).
flash / mxml files : Manipulating of items mainly graphically, and as a means of item ID assignment.
.as files : Creation of code, that manipulates items in flash / mxml files.
With the flash / mxml having only 1 line to include the .as file, it saves alot of hassle in searching for specific parts to adjust / fix in either the code, or graphical items.
Hopes that's a few cents worth XD
Upvotes: 0
Reputation: 1139
I think the major reason to have your ActionScript in external files is: being able to use a good code editor such as FDT, FlashBuilder, or TextMate instead of the wretched AS editor within Flash. That said, it does add a bit of extra complexity to a project (making sure the AS files are kept with the FLA), but it's well worth it if you're doing anything but the very simplest AS programming.
Upvotes: 2