PDA

View Full Version : Connecting a flash movie to a .as file



adaykin
July 17th, 2008, 12:54 PM
Hey, I got a really noob question, I'm a php developer coming to flash, I got drawn here by amfphp. In an fla file how would I connect the .fla file to an external .as file.

One more question. If I have a .fla file that has actionscript embedded in it, if I take the actionscript out of the file, and put in in an external .as file, will the program still work?

senocular
July 17th, 2008, 01:01 PM
That depends on what you mean by "connect". There's different ways to use an AS file. It can include including the file or if a class file, creating an instance of it in your code or associating it your document or a library item.

FLA code can be extracted into AS files. The simplest way is to make it an included file with the include directive. Note, however, that AS files are compiled into your SWF and not referenced at runtime.

adaykin
July 17th, 2008, 01:34 PM
ok so to rephrase my second question here is the code from the .fla,



onClipEvent (load) {
loadMovie("img/pic.jpg", _root.mainPIC.TEMPlgTARGET);
}

on (rollOver) {
loadMovie("img/pic.jpg", "_root.mainPIC.lgTARGET");
with (_root.mainPIC) {
gotoAndPlay("fadeup");
}
}


how would I do this in actionscript 3, while moving it to a .as file?

I think the program was built with mx 2004.

Right now I am just using the Document class to load the file.