7 Replies Latest reply on Jan 17, 2015 3:31 PM by NEW EXPORT ACCOUNT

    How to refresh dynamic Flickr or similar API content? (added a click function, yet....)

    NEW EXPORT ACCOUNT

      Hi,

       

      I am working on a page that requests photos from Flickr and displays them in divs.

      There is a text field, called "name" and a text element called "output" and a button called "ClickToUpdateFlickrPhotos". Basically I type text in the text field on the page and hit the button to update the "output" text and to call new photos from Flickr based on the new tag word. So......the "output" text changes...yet the photos don't.

      How to make this function properly? Also, is there an "editEnded() function for text fields or similar that can automatically cause the update to happen? (Basically hoping there is an updateEveryFrame() function somewhere that I can throw stuff to do into. (Like in Unity or similar)

      Thanks in advance!

       

      var wow=sym.$("output").html(sym.$("#name").val());

      var tagname=sym.$("#name").val();

      sym.$("Stage").css("margin", "auto");

      sym.$("container").css("text-align", "center").hide();

       

       

      var Flickr = "http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?";

       

       

      $.getJSON( Flickr,

        { tags: sym.$("#name").val(), tagmode: "any", format: "json" },

        function(data) {

        $.each(data.items, function(i,item){

        var cell = sym.createChildSymbol("slide", "container");

        cell.getSymbolElement().css("display", "inline-block");

        cell.$("photo").css("background-image", "url("+item.media.m+")");

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

        if ( i == 11 ) return false;//only 12 items on Stage.

        });//each

      }).done(function(){

        sym.$("loading").hide();

        var cellOnStage = sym.getChildSymbols();

        $.each(cellOnStage, function(i){

        cellOnStage[i].$("symbolName").html("symbolName: cellOnStage["+i+"]");

        });

        sym.$("container").fadeIn(1000);

      });