2 Replies Latest reply on Feb 2, 2011 1:48 PM by Ladislav Navrátil

    Access to Library data

    Ladislav Navrátil

      Hi all,


      i have got a problem, and i hope, that you can help me.


      First, i have to tell, that i have an air application, which includes some Flex Library Projects. I would like to read XML file, wich is in library project folder, is it possible? I haven't got a problem with reading of files, wich are situated in application folder, but i can't find solution for access to file in library's folder. (each library project is merged into code, no RSL are used).


      Thank you very much and sorry for my english

        • 1. Re: Access to Library data
          Pablo Souza Level 3



          You can do that by embedding the XML in the library project.



          Library project code:

          package com.example.library
               public class MyClass
                    public static const MyXml:Class;



          Project code:

          var obj:Object = new MyClass.MyXml();
          var xml:XML = new XML(obj);


          You can now use the xml instance variable inside your project code as you wanted.



          I don't recommend you to use this approach to load XML data. You can do that loading the external XML file using URLLoader class instead of having it embedded in your library project.




          Hope it helps!



          Best regards,

          Pablo Souza

          • 2. Re: Access to Library data
            Ladislav Navrátil Level 1

            Thank you very mutch, i absolutely forgot for the embedding of course, it works! Thx!