Quantcast
Channel: Adobe Community : All Content - Edge Animate
Viewing all articles
Browse latest Browse all 9897

How to display backend data in compositionReady

$
0
0

Hi,

 

I am new to the edge animate, i am facing a issue in the edgeActions to display the status of the user. I am also doing some show/hide animate according to the user status. Below is the code for reference

 

(function($, Edge, compId){

var Composition = Edge.Composition, Symbol = Edge.Symbol; // aliases for commonly used Edge classes

 

   //Edge symbol: 'stage'

   (function(symbolName) {

 

Symbol.bindElementAction(compId, symbolName, "document", "compositionReady", function(sym, e) {

 

          if (window.addEventListener){

              addEventListener("message", updateHome, false);

              addEventListener("touchmove",window.parent.preventBehavior, false);

          }

 

          function updateHome(event){

              var user= jQuery.parseJSON(event.data);

              if ((user)&&(user.status)){

                  switch(user.status){

                     case 'none':

                         sym.getSymbol('user').$('Status').html('');

                         break;

                     default:

                         sym.getSymbol('user').$('Status').html(user.status);           

                }

            }else{

                sym.getSymbol('user').$('Status').hide();

                sym.getComposition().getStage().$('userStatus').hide();

            }

     }           

}); 

})("stage");

})(jQuery, AdobeEdge, "HomeScreen");

The above compositionReady part is not working and also it is not entering to the updateHome function also, if i use the same approach with creationCOmplete its coming inside my updateHome and fetching the data, but not hiding the elements properly. Below is the code with creation complete.

 

(function($, Edge, compId){

var Composition = Edge.Composition, Symbol = Edge.Symbol; // aliases for commonly used Edge classes

 

   //Edge symbol: 'stage'

   (function(symbolName) {

 

Symbol.bindSymbolAction(compId, symbolName, "creationComplete", function(sym, e) {

          if (window.addEventListener){

              addEventListener("message", updateHome, false);

              addEventListener("touchmove",window.parent.preventBehavior, false);

          }

         

        

          function updateHome(event){

              var user= jQuery.parseJSON(event.data);

              if ((user)&&(user.status)){

                  switch(user.status){

                     case 'none':

                         sym.getSymbol('user').$('Status').html('');

                         break;

                     default:

                         sym.getSymbol('user').$('Status').html(user.status);           

                }

            }else{

                sym.getSymbol('user').$('Status').hide();

                sym.getComposition().getStage().$('userStatus').hide();

            }

     }

 

 

})("stage");

})(jQuery, AdobeEdge, "HomeScreen");

I am able to get the data if i use the above creationcomplete event. Now i want to fetch data also and show/hide the symbols according to the data availabality. Please help


Viewing all articles
Browse latest Browse all 9897

Trending Articles