Link to home
Start Free TrialLog in
Avatar of CyanBlue
CyanBlueFlag for United States of America

asked on

Shared Library question in AS3/CS3...

Hm...  I don't seem to be able to get this Shared Library in AS3/CS3...  :(

I have SharedLibrary.fla file where I have a movieClip linked as Square for the class, flash.display.MovieClip, and Export for ActionScript and Export in first frame are checked...

I have SharedLibraryMain.fla file where I have the following script...

var loader:Loader = new Loader();
var request:URLRequest = new URLRequest("SharedLibrary.swf");
loader.contentLoaderInfo.addEventListener('complete', completeHandler);
loader.load(request);

function completeHandler(e):void
{
      var square:Class = getDefinitionByName("Square") as Class;
      addChild(square);
}

But that gives me this '1067: Implicit coercion of a value of type Class to an unrelated type flash.display:DisplayObject.' error message...  I can use that method to use the image or font just fine, but I am not able to use a movieClip...  What am I missing here???

Thanks...  :)
ASKER CERTIFIED SOLUTION
Avatar of blue-genie
blue-genie
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CyanBlue

ASKER

What's up...  :)

Well...  There's gotta be multiple movieClips, Square and Circle for example, in the library of the SharedLibrary.swf file, and I'd like to specify them as needed...  Maybe this sample file will make it simple for you to understand the problem...  (Don't forget to remove the TXT extensions...)

Thanks...  ;)

CyanBlue
SharedLibrary.fla.txt
SharedLibraryMain.fla.txt
I have solved the problem and posted the solution here if anybody is interested...  ;)
http://www.actionscript.org/forums/showthread.php3?t=188687
good to know, thanks
Love to hear more if you'd like to chime in...  ;)

CyanBlue
i'm clueless about shared libraries. never tried it never had a need to, should learn to.
i actually pointed some other people to your post thinking that might resolve the problem. but i'm joining the I hate AS3 club.
That's cool...  Thanks for that...  ;)

Hm...  How about I-Hate-ActionScript club???  :p
Yeah...  I've been learninging alot on AS3 for some months now and I also have mixed feelings...

CyanBlue