I see a couple of weird things in your code. First, I think your code, as is, should give you a compile error. At least, I get an error, with this code (which looks equivalent):
var mathClass:Class = Math; //mathClass.random(); --> compile error It works if I workaround the compiler check, though: var mathClass:Class = Math; mathClass["random"](); So, it's weird that you don't get an error. Which leads me to believe that perhaps, you have a valid reference to the AssetLibrary class in your project. Have you double checked that? Anyway, I'd change the name of the variable since it could be ambiguous (if you happen to have a reference to the class). I mean something like this: var AssetLibraryDef:Class; AssetLibraryDef= pEvent.target.applicationDomain.getDefinition("AssetLibrary") as Class; try { AssetLibraryDef.initAssets(); //<--the error is here } Also, could it be possible that the compiled class in the loaded swf defines the method initAssets as taking one parameter? Maybe there's some versioning problem going on... At any rate, you could use describeType on the Class object to inspect it. This will list static methods and will tell you how many parameters they define (and also the types). In my example, it's simply: trace(describeType(mathClass)); So, you could probably see this info doing: trace(describeType(AssetLibraryDef)); Not sure where the problem could be, really, but perhaps this gives you some idea. Cheers Juan Pablo Califano 2010/11/10 Kerry Thompson <al...@cyberiantiger.biz> > Deepanjan Das wrote: > > Hi Kerry, > > The problem is in these lines: > > var AssetLibrary:Class; > > > > > AssetLibrary=pEvent.target.applicationDomain.getDefinition("AssetLibrary") > > as Class; > > You are calling a stattic function; so this is correct > > AssetLibrary.initAssets(); > > But why are you defining the same class variable ahead, thats wrong. > > Static methods mean you can directly call those APIs without creating an > > instance. > > > > So just call AssetLibrary.initAssets() provided you have a > AssetLibrary.as > > imported. > > > > That makes sense, except I may not have the .as file. I need to be able to > download an asset swf written by another developer. That's why I'm getting > the class from the downloaded swf. > > I tried adding an import statement, pointing to the location of the swf, > and > got an error that it couldn't be found. > > Maybe I need to have the other developer make it an RSL, because I need to > share it among different swf's. I don't understand why I can't call the > function, though. There are a number of public static vars in the > downloaded > swf, and I can see them in the debugger. I can't see the public static > function, though, and the assets are not being initialized. > > Cordially, > > Kerry Thompson > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders