PDA

View Full Version : OK, this is a really stupid question... how to include a .as file


Boerboel649
07-02-2006, 05:39 PM
How do I load a .as file into my main Flash movie??? I'm thinking about maybe using Krilnon's entry for the AS Gallery Batte, for something... The source is a .as file... How in the world do I get it to work??? Total newb like question... I've seen it somewhere I think... but don't remember where!
Thanks!

logikal2
07-02-2006, 05:49 PM
#include "yourfile.as"

woad
07-02-2006, 06:32 PM
:lol:

ieatcotten
07-02-2006, 06:40 PM
#include “blah.as” (in actionscript 2) will basically paste the code from the .as file into the place where #include was called. In actionscript 3 they have dropped the # sign so it is just
include “blah.as”

This however is not what you want for Krilnons gallery.
Krilnons gallery is contained in a document class called KrilGallery.

If you are using the flash 9 alpha IDE, you can specify KrilGallery as the document class in the property box labeled “Document class:”
Make sure KrilGallery.as is in the same directory as your fla.

or, you can also complie .as files directly with mxmlc.exe from the Flex SDK.
More on that: http://www.senocular.com/flash/tutorials/as3withmxmlc/

Boerboel649
07-02-2006, 08:47 PM
Hehehe..... I figured out that that's in AS3, and that I'm using Flash MX 2004...:D Hehehe... thanks a lot guys for the help. :P

Krilnon
07-02-2006, 10:20 PM
It wouldn't be entirely impossible to rewrite the gallery for Flash Player 7, though the performance might suffer. :sure:

Boerboel649
07-03-2006, 03:19 PM
LOL! Hehehe.... That'd be about like telling me to rewrite the Chinese language... well maybe not quite... but pretty close... :P I can do simple AS, but not that complicated:D

Krilnon
07-03-2006, 03:21 PM
The author of the Chinese language certainly wouldn't have a hard time with it. ;)

abraxas
02-03-2007, 09:53 AM
uhm i have a problem with this, i have a button with #include "test.as", but i get this error:

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Malformed #include directive
#include "test.as";

i have the .as file in the same directory as my .fla file, anyone know what the problem might be?

heres my .as file:
on(press){
if(_root.hej == "no"){
_root.textruta = "heeeeeej!";
_root.hej = "yes";
} else if (_root.hej == "yes"){
_root.textruta = "bai";
_root.hej = "no";
}
}

Krilnon
02-03-2007, 03:32 PM
Remove the semicolon.

abraxas
02-04-2007, 06:18 AM
hehe, thanks :D