-
accessing class with loadmovienum...
HI,
I need to build a project that will have a main.swf calling many other swf. I don't want to have to rebuild my main swf every time I change a line of code so that's why I want to have one swf that will contain all my classes(objects). So lets say I have in class.swf:
Test=function()
{
this.x=5;
this.y=7;
}
If I use loadMovieNum("class.swf",1)in call.swf, can I instantiate this?????
inst=new Test(); //doesn't work
inst=new _level1.Test();//doesn't work
Anyone have a clue?????
Thanks
-
Poof! Whaddya need?
#include?
Have you thought about creating a text file containing all of the ActionScript for your main swf? You can actually "import" the ActionScript into your movie at runtime.
the script that "loads" the script is
Code:
#include ("myScript.as")
Macromedia suggest giving the text file the extension ".as" -- which seems to be a good way of keeping things organized. Just make sure the text file containing your external script is in the same folder as your main swf, or change the filename to include the correct path.
Nice, huh?
True genius consists of the ability to work around one's shortcomings.
-
Thanks!
System.useCodepage=true;
#include "class2.as"
works like a charm
-
Poof! Whaddya need?
glad
Yay! I got one right!
Feels like Alex Trebek ought to be giving me a check or something.
True genius consists of the ability to work around one's shortcomings.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|