JSON content - can't display image after click


hi all,

 

i trying to load json file , load images text information.

 

i have problem when click thumbnail, large image can't displayed, receiving following error:

 

failed load resource: server responded status of 404 (not found)

 

my code in compositionready:

 

$.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").click("click", function(e){

                                                            sym.getcomposition().getstage().$("finte").css({"background -image":"url("+$(this).data('largeimage')+")"});

                                                            });

                    }

});

 

and json file:

[

          {

                    "title": "titlos 1",

                    "description":"descrpt 1",

                    "seira": "number 1",

                    "image": "images/wheel.png",

                    "largeimage": "images/1.png"

          },

          {

                    "title": "titlos 2",

                    "description":"inter description 2",

                    "seira": "test",

                    "image": "images/wheel_cool.png",

                    "largeimage": "images/wheel_cool.png"

          }

]

 

 

i tried code:

 

$.getjson("content.json")

   .success(

          function(data){

                    console.log("incoming data: ", data);

 

 

 

 

$.each(data, function(index, item){

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

          s.$("title").html(item.title);

          s.$("description").html(item.description);

          s.$("seira").html(item.seira);

          s.$("imageholder").attr("src",(item.image));

                    s.play();

          s.setvariable( "largeimage", item.largeimage)

          });

}

);

 

and @ element hold's thumbnail image, added on click event :

 

sym.$("finte").css({"background-image":"url("+$(this).data('largeimage')+")"});

 

 

 

 

 

 

i believe somewhere on +$(this).data('largeimage')+") is mistake. can't find it.

 

your needed.

 

moreover, how, thumbnails, can displayed table of 4x5?

 

 

 

thanks in advanced.

hi zoze

 

you missed lines, try this, think should work

 

$.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().$("fint e").css({"background-image":"url("+$(this).data('large')+")"});

                                                            });

                    }

});

 

if had problem again, let me know

 

zaxist



More discussions in Edge Animate CC


adobe

Comments

Popular posts from this blog

Thread: Can not create raid array: mdadm: no raid-devices specified.

Thread: HOW TO: Package and theme GTK+ / Gtkmm apps in Linux for Windows

Thread: Twinview issues