I have a lot of sounds in my library each is a class
the name of sound classes snd1,snd2,snd3.....snd100
i use play each of them:
var snd:sound;
var audioclass:class;
function playsound(ltr:int):void
{
audioclass = getdefinitionbyname("snd" + ltr) class;
snd = new audioclass();
snd.play();
}
and works fine.
my question is:
can make swf has in library sound classes
and load swf create , play them container swf
i know how load external swf , how control timeline
but not how use classes.
here's how use classes in loaded swf. following creates instance of class c in test.swf
var s:string = "c";
load1("test.swf",s);
function load1(urls:string, classs:string) {
l.contentloaderinfo.addeventlistener(event.complete, f);
l.load(new urlrequest(urls), new loadercontext(false, applicationdomain.currentdomain));
}
function f(event:event):void{
var c:class = class(getdefinitionbyname(s));
var instance:* = new c();
}
More discussions in ActionScript 3
adobe
Comments
Post a Comment