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

JSON content - click to show another symbol on the stage

$
0
0

Hi,

 

Thanks to Zaxist I have a working code like the one below:

 

$.getJSON("content.json",

          function(data){

                    for(var i=0; i<data.length; i++){

                    var s = sym.createChildSymbol("template","content");

                    s.$("title").html(data[i].title);

 

 

 

 

                    s.$("description").html(data[i].description);

                    s.$("seira").html(data[i].seira);

                    s.$("imageholder").css({"background-image":"url('"+data[i]. image+"')"});

                    s.$("imageholder").data('Large', data[i].largeimage);

                    s.$("imageholder").click("click", function(e){

                                                            sym.getComposition().getStage().$("finte").css({"background-image":"u rl("+$(this).data('Large')+")"});

       

                                                            });

                    }

});

 

 

Now, I am trying on the click function to show specific symbol on the stage, for example when click on the first item the symbol red will appear, if cliked the second item the (previous symbols that was appeared will be hided) and the new symbol blue will appear. An so on with all the other ellements that JSON files has.

 

 

I tried this on the code, but nothing:

 

 

 

 

$.getJSON("content.json",

          function(data){

                    for(var i=0; i<data.length; i++){

                    var s = sym.createChildSymbol("template","content");

                    s.$("title").html(data[i].title);

 

 

 

 

                    s.$("description").html(data[i].description);

                    s.$("seira").html(data[i].seira);

                    s.$("imageholder").css({"background-image":"url('"+data[i]. image+"')"});

                    s.$("imageholder").data('Large', data[i].largeimage);

                    s.$("imageholder").click("click", function(e){

                                                            sym.getComposition().getStage().$("finte").css({"background-image":"u rl("+$(this).data('Large')+")"});

                                                            if (data[i]=3) {

                                                                                                                                                                                                                                                            sym.getComposi tion().getStage().$("red").show();

 

 

                                                            }

                                                            else {

                                                            sym.getComposition().getStage().$("red").hide();

                                                            }

                                                            if (data[i]=5) {

                                                                                                                                                                                                                                                                                                                         sym.getComposi tion().getStage().$("blue").show();

 

 

                                                            }

                                                            else {

                                                            sym.getComposition().getStage().$("blue").hide();

                                                            }

                                                            });

                    }

});

 

 

 

 

Could you help me?

 

 

 

Thanks in advanced!


Viewing all articles
Browse latest Browse all 9897

Trending Articles