Groups | Blog | Home
all groups > flash actionscript > february 2006 >

flash actionscript : Load .as file at runtime and not at publish (compile) time.



asidfree
2/6/2006 11:35:45 PM
Hello,

I just started learning about the possibility of linking to external .as
files, and creating classes for buttons. I was able to make some buttons that
were dependent on classes in external .as files. This works, but it seems that
every time that I change the .as file, I have to go back into flash and publish
the .swf file that is dependent on the .as file.

Is there an avenue that I could venture down, to import an .as file when
the .swf is running, saving the need to publish the .fla each time I make a
change to the .as file?

I've attached some excerpts of code so that you can see how I set things up

As always, I greatly appreciate your advice,

~asidfree

// ------------------ this is part of the external .as file named Buildings.as
------------------
class Buildings extends MovieClip {
public function Buildings() {
this.onRelease = this.release;
}
public function release() {
trace('release ' + this._name); //print the name
}
}
// under each button's properties, I have the linkage set to 'AS 2.0 Class:
Buildings.as'
Peter Blumenthal
2/7/2006 12:00:00 AM
[quoted text, click to view]

No, that's not how it works. the .as files are included at compile time. You
could import an swf containing classes / methods at runtime, but you would
still have to re-publish *that* swf whenever you change you .as files.

--
-------------------------------
Remove '_spamkiller_' to mail
-------------------------------

AddThis Social Bookmark Button