Viewing Code

Hey all , ive been working with alot of code lately and i like to have variations of code, but to view different code to compare, i would have to save the document as movie2 , and movie3 , so on…

Is there any app or method that i could view Actionscript with all the colour reference, in a totally different window, almost like a duplicate of the actions palette.

:: so i could have 2-3 or more code reference at one time?

thanks
::soulty::smirk::

bump;)

using external .as files, include them in the fla with #include and use a editor to edit that code seperately (allowing you to have multiple windows open at once, of the same code and of different code chunks)

could you give me a example?
thanks sen :slight_smile:

how would you get external action script files? . Sorry dude don’t really understand what you mean. :-\

::are you saying just copy and past your code into text editor and editing it there?

yeah. You can “replace” script in your fla with something like

[color=blue]#include[/color] “myScriptFile.txt”

where all the script that would normally be there in Flash is in that text file (located in the same directory as the fla). Then, when you publish your swf, Flash will read that line of code (the #include) open up the specified file and replace that #include line with the contents of that file and include it in the final swf. You can either do this by cutting and pasting the fla script into a new file or start that way to begin with - with the intention of having the script in a seperate file and begin your code in a seperate script file.

This lets you easily edit actionscript outside of Flash and have other windows open etc like you explained. Its also an easy way to share code, not only with other people but between your different projects.

Now, I mentioned before that the script file (they’re commonly named .as or .mx instead of .txt btw) should be located in the directory of the fla. This is really one of two places Flash looks for .as or any other include files though. If you have script specific to that one movie, then you might want to keep it in with that fla whereever it is. However, in terms of sharing as I mentioned before, youd want it easily accessible to any fla that you make. For that you would make a folder in
Macromedia\Flash MX\Configuration
called Include so you have
Macromedia\Flash MX\Configuration\Include
^this is the other place Flash looks for #include files. Throw any .as files you make which you want available to all movies in there so you can easily include them in any movie with

[color=blue]#include[/color] “filename.as”

Just like common libraries only this is common actionscripts.
Note is that there is NO semicolon (;**) after a #include. Doing so will result in an error. However, be sure to have an ending semicolon (or extra line break) in your .as file as when Flash reads #include statements like so:

#include "myFile1.as"
#include "myFile2.as"
#include "myFile3.as"

it ignores that newline character and appends the code in those files directly on the backend of the previous; as if you have written them like:

#include "myFile1.as"#include "myFile2.as"#include "myFile3.as"

Having an ending semicolon or line break in your as files will prevent an error resulting from that.

For a good actionscript editor I suggest SciTE|Flash. You can download it here:
http://www.bomberstudios.com/sciteflash/dl.php

kool , thanks mate. How about the colour reference that actionscipt gives out? is there a way to have that in your external .as?

Never mind i installed that Sciteflash app , its awesome , exactly what i was looking for :slight_smile: thanks for the link.

*Originally posted by Soulty *
**kool , thanks mate. How about the colour reference that actionscipt gives out? is there a way to have that in your external .as? **

see the as editor I suggested :wink:

Just thought I’d mention this since it caused me a bit of head-scratching. On my PC the folders Macromedia\Flash MX\Configuration can be found in two places:

*C:\WINDOWS\Application Data*
and
*C:\Program Files*

For me the Include folder needed to be here:
C:\Program Files\Macromedia\Flash MX\Configuration\Include

The C:\WINDOWS\Application Data\Macromedia\Flash MX\Configuration folder is used for things like installed components but didn’t seem to work for custom #include files.

Hope it helps,

-PiXELWiT
http://www.pixelwit.com

yeah, in components a $flash token is used to specify the Flash configuration folder. For most all things (components and panels etc) this refers to the Application Data directory. #include files, however, are always in the actual Macromedia program files directory.

Application Data, for multi-user systems, will be in each users profile and unique for each. Other settings such as panel layouts are also kept there.

ex:

Win2K:
C:\WINNT\Profiles[User]\Application Data\Macromedia\Flash MX\Configuration

WinXP:
C:\Documents and Settings[User]\Application Data\Macromedia\Flash MX\Configuration

OSX:
[User]/Library/Application Support/Macromedia/FlashMX/Configuration/

However, note that those files placed in the FirstRun (config) directory of the Flash program directory will be copied into the user application data directory on … well first run of Flash :wink: