Skip navigation
Adam Smith
Currently Being Moderated

Add/Remove tile from panel at runtime

Aug 29, 2011 1:53 PM

I have 3 tiles


     MenuTile - Flex Menu

     Tile1 - Flex module

     Tile2 - HTML


In my catalog I have a PanelClass that has the MenuTile and Tile1 as TileReferences, where by including the PanelClass as view:PanelReference in my composite application.


Simply I want to be able to select a button on the menu button and either show or remove one of the tiles.




public var mosaicApp:IApplication;


mosaicApp.addMessageListener(CatalogLoadEvent.NAMESPACE, CatalogLoadEvent.SUCCESS, onCatLoadEvent);

mosaicApp.addMessageListener(CatalogLoadEvent.NAMESPACE, CatalogLoadEvent.FAILURE, onCatLoadEvent);


mosaicApp.loadCatalog(new CatalogSpecifier("CustomerServicePOCCatalog"), onLoadSuccess, onLoadFailure);


private function onCatLoadEvent(message:Message):void {

  var  catalogLoadEvent:CatalogLoadEvent = message.payload as CatalogLoadEvent;

  var catalog:ICatalog = catalogLoadEvent.catalog;

  //var a:Array = catalog.tiles;

  //"Catalog has " + a.length + " tiles", "Tile Count", Alert.OK, parentDocument as Sprite);

  //custom processing

  var panel:IPanel = catalog.getPanel("SamplePanel");

  var numberOfTiles:Array = panel.tiles;"Panel has " + numberOfTiles.length + " tiles", "Panel Tile Count", Alert.OK, parentDocument as Sprite);


  var tile:ITile = catalog.getTile("adobePage");

  panel.addTile(tile, onLoadSuccess, onLoadFailure);




When uncommented I get a correct count of all tiles in the catalog.  Additionally I get the correct count of tiles in the panel before I add the 3rd.  I don't get and error but I also don't see the 3rd tile added to the panel.


Some help with this would be appreciated.




  • Currently Being Moderated
    Aug 29, 2011 4:03 PM   in reply to Adam Smith

    I see that you get the panel labelled "SamplePanel" from a catalog, then you attempt to add a tile to that panel.  However I do not see a step where you add the panel to the application.  I would expect the code to follow these steps:


    1. Load a panel from a catalog

    2. Add the panel to the application either under the shell or a view

    3. Load a tile from a catalog

    4. Add the tile to the panel


    However, if you already have the panel in your application, you need to access its object and add the tile to that instead of adding the tile to a panel object that was fetched from the catalog:


    1. Get the panel's parent object, for example if it is the shell: var shellPanelParent:IShell =;

    2. Get the array of panels under that parent object: var arrayPanels:Array = shellPanelParent.panels;

    3. Parse the array to get the specific panel you are want to add a tile to

    4. Add the tile to the panel

    Mark as:
  • Currently Being Moderated
    Aug 30, 2011 9:00 AM   in reply to Adam Smith

    Hi Adam,

    I think this should work, and if it's not then there is a bug somewhere. But I'm not able to tell from this thread exactly where - it could be in mosaic or it could be in the application. We'll try to reproduce it internally.


    Mark as:
  • Currently Being Moderated
    Aug 30, 2011 9:25 AM   in reply to Adam Smith

    Hi Adam,

    We have a working theory that there is a problem inside of mosaic when an asset that is a reference, e.g. a PanelReference, is then modified from the mosaic-om APIs. Can you include your .axml file in this thread so that we can take a look. Also, as a workaround, is there any way that you can either:


    a) structure your application to have the panel fully defined in the catalog so that you don't need to add tiles to it at runtime, or


    b) structure the application so that the panel and all of its children are dynamically created at runtime (with the mosaic-om APIs)




    Mark as:
  • Currently Being Moderated
    Aug 30, 2011 1:06 PM   in reply to Adam Smith

    I am adding a tile to a visible panel at runtime and haven't come across an issue so far.  The code I am using is:


                private function onMenuClick(event:MenuEvent):void{
                    //var a:Array = mosaicApp.catalogs;
                    tilenameToAdd = event.item.@data;
                    //mosaicApp.loadCatalog(new CatalogSpecifier("POCCatalog"), onLoadSuccess, onLoadFailure);               
                    var = catalog.getTile(tilenameToAdd);
                    for each (var view:IView in mosaicApp.findViewManagers()[0].views) {
                        if (view.displayed) {
                            for each (var panel:IPanel in view.panels){
                                if (panel.displayed) {


    Which is basically derived from the ADEP example "SlateDashboard"


    However it would be really nice if ADEP had the same robust dynamic tile placement like say in WebSphere Portal.  I am sure it is planed for the next version somewhere along the line.


    Lee Burch

    Mark as:
  • Currently Being Moderated
    Sep 26, 2011 1:42 PM   in reply to lburch@PRFT

    Hi Lee,


    Could you please clarify what you are expecting exactly to see when you write "robust dynamic tile placement like say in WebSphere Portal"? A UI or additional APIs?

    We are considering suggestions in the forums when it comes to release planning and prioritization.





    Juergen Hauser  |  Senior Product Manager – Adobe Digital Enterprise Platform

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points