2 Replies Latest reply on Mar 26, 2007 6:38 PM by andrew76rocks

    Adding Flash Library items to a Flex App

    andrew76rocks
      Ok, this should be simple but like all things critical to my flash projects they end up being hacks or major work-arounds. Essentially, I need to add a Flash Library item (set to export as a default class in Flash 9 Preview) - to my Flex application. I won't go into why but just consider the need for Flash interface for graphics creation a requirement for now. Seeing as this was no big deal (attachMovieClip in as2) before how would i go about this in as3/Flex? Please provide example - not just theory, if you can as I've almost read every theory/method out there but no up to date examples and nothing my designer brain can grasp.

      Here's what im doing so far.
      - Created a flash movie with a graphic movieclip set to export on first frame / class name as default of name of movieclip - this object doesn not live on stage but in the library (unless the workflow needs to change but i'd rather it not as there will be other objects to load in as well)
      - Using the Image class to load in swf. All is good so far.
      - So how do actualy add a child of this swf (one of the classes compiled in this swf) to a member of my Application?

      Heres what i was thinking i could do -

      var myLibObject:Image = new Image();
      myLibObject.source = "packages/MyLibrary.swf";
      myCanvas.addChild(myLibObject.Circle); // Circle is a library item/class in the flash library / Obviously this doesn't work but not sure how classes within the flash document class are referenced