2 Replies Latest reply on Oct 28, 2010 1:07 PM by mlavie

    How to Add an Asset to a Library

    mlavie Level 1

      I am trying to add an asset to a library in CS5, using the Library.store() method.


      I tried the following:



          var assetItemsArray:Array = new Array();
          var asset:Asset = library.store(assetItemsArray);



      but got this error message:

      Error: Invalid value for parameter 'using' of method 'store'. Expected Array of PageItems, Movies, Sounds, Graphics or XMLElements, but received ((TextFrame)).


      What am I doing wrong?




        • 1. Re: How to Add an Asset to a Library
          Harbs. Level 6

          You are feeding it an array of arrays...





          However that will give you nested items. You probably want this instead:





          • 2. Re: How to Add an Asset to a Library
            mlavie Level 1

            I see it's "Harbs to the rescue" again... 


            Indeed, I had tried




            but it wouldn't compile in ActionScript, so I assumed that was not the way to go. Once you confirmed that that IS the solution, I tried


            library.store(page.allPageItems as Array);


            and that worked like a charm! And I DO need the nested items, thank you!