0 Replies Latest reply on Aug 30, 2011 5:45 PM by kid electric

    Clearing (de-initialize?) elements/states or embedding / passing vars to another Flex/AIR?

    kid electric Level 1

      Okay, I have a problem and I'm not even sure what is the correct question to be asking here.


      Basically, I have developed an AIR app which is mostly functional and pretty great, if I do say so myself. It incorporates Miti Pricope's LargeBook, which is a modification of Ruben Swieringa's FlexBook component.


      I have developed a way to dynamically generate a book based on the content I want, and then switch states and display the book on the screen.  The problem is this: I would like to have a list in which you could select multiple books and the book state will dynamically create a new book with the new content.  The problem is that the Book is not a dynamic component (I can't just change content or pages on the fly) -- it involves some complex render and viewstack stuff, so I have to "create" the book on initilialize of it.


      The problem is that the book can't be "uninitialized" -- once it appears the first time, that's it. It's unchangeable.


      How can I get around this?  Some ideas I've considered are:


      1. On selection of a new book, completely remove the old one and create a new one in AS, and add it into viewable container. This doesn't appear to work, and not sure why -- it may be that the viewstate is switching before the book has time to be constructed and added to the viewstate.
      2. Could it be possible to simply send a variable to a separate Flex/AIR file and load that separately for each book, then close the Flex/AIR app when the book is finished or closed?  In other words, I would have one Flex/AIR library, and based on the list item selected, it would send the name/address of the appropriate content XML file to another app and trigger that to open.  This isn't ideal, but is it possible to do this? ie. use variables from one Flex app as an input parameter/var for another Flex file? Is it possible to "embed" a Flex into another?


      This is maddening... I thought I did all of the "hard stuff", only to find that something I thought would be easy (allowing multiple different choices instead of one) has me banging my head against a wall. My app is perfectly functional if I use a single "book", just not if I want that book to change (or not even change, but simply to be deconstructed and re-constructed, without having to do it at compile or initialize. This seems like something that shouldn't be so impossible...)


      -- Matt