How to use external *.as files instead of including them...

  • holtsch
  • Born
  • Born
  • holtsch
  • Posts: 2
  • Loc: Munich, Germany

Post 3+ Months Ago

Hi there,

I know this may be a rather basic "newbie" question, but I could not find an answer in the manuals or on google, so I'm asking here:

I'd like to keep my ActionScript code in *.as files instead of the *.fla so I can source control them as text files and have a better overview of my code (and use alternative editors, like SEPY).

Now I know, Flash does support *.as files, I can add them in a project and edit them, but how do I reference these files from the flash movie? E.g. I have code in Scene 1/Foreground : Frame 1 which I'd like to move to an external file. How is this done?

kind regards,
david
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

I know this works for MX, not sure about 2004.

Place the files you wish to use as includes in,
where you installed\Configuration\Include

Then when you want to use them use the syntax, #include "fileName.as"

The classes/prototypes (functions even) in this file are now available to use :)
  • holtsch
  • Born
  • Born
  • holtsch
  • Posts: 2
  • Loc: Munich, Germany

Post 3+ Months Ago

Cool - thank you very very much!!! Sometime it would be good to be c/c++ programmer ;-) just enter #include into the search in the help of Flash MX 2004, and you're there: ActionScript Language Reference / #include. It's easy when you know that keywords to look for...

#include works both with files in the same directory as the FLA-file (which is what I need), and in the configuration directories you mentioned. And it's a real "include", so you can simply replace the inline code with "#include"s and do nice code source-control and editing from there on...

kind regards,
david

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 5 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.