2 Replies Latest reply on Nov 16, 2009 4:01 AM by invisibleBlade

    Shared library items

    invisibleBlade

      Hi all, I am playing about with using shared libraries and have a question.

      I have lib.fla with a clip in the library called 'square' I have this all set up as a shared library and am using 'square' in two other files. It all seems fine and any changes made to the instance in lib.fla are reflected through the other files when its published so I assume I have set everything up properly.

       

      Now I make 'square' an instance of a custom class 'MySquare' that simply traces "Hello World" in it's constructor and in one of my other files I attach an instance to the stage using:

      var s:MySquare = new MySquare();

      addChild(s);

       

      The constructor runs and the trace happens but the clip does not appear on the stage. I can call methods of MySquare and it recognises its 'parent' so why can't I see it? Am I missing something obvious here or doing something wrong along the way?

       

      Cheers for any help

        • 1. Re: Shared library items
          invisibleBlade Level 1

          I have found that if I drop an instance of 'square' on the stage then my subsequent addChild() call works and the dynamically created instance appears as you would expect. I could use this to solve my problems but it seems a little hacky to me.

          • 2. Re: Shared library items
            invisibleBlade Level 1

            I have modifieid my approach to this again. I have done away with the runtime sharing stuff and now simply have a lib.fla which has items in the library that are linked to custom classes. I publish this swf and load it in to another. This enables me to dynamically create instances of the custom classes from the parent swf document class that use the graphics defined in the lib.fla.

            This is an ok solution but I need to now load many instances of parent swf in to another container and so ideally I would like to pre load lib.swf just once in to the top most container but I can't get this to work.

             

            I will post again if I fis this but would really like any thoughts on this at all as I don't fully understand the process that are going on here

             

            Cheers