25 Replies Latest reply on May 13, 2013 2:01 PM by Dam4222

    Need some help with API's getJSON

    Dam4222 Level 1

      Hi,

       

      I am trying to build a personal portfolio and I am attempting to use the Behance API. I am VERY new to all of this so any help would be greatly appreciated. So far I have figured out how to pull my projects in, but I want to be able to click on each of them and dive deeper to see more screenshots. Essentially it would function just like Behance does when you click on a users project.

       

      Here is a link to my files https://dl.dropboxusercontent.com/u/9159616/adamperlis.zip

       

      Check out the code in compositionReady. Maybe you guys can help me figure out what I am doing wrong.


      Thanks so much for your help!

       

      Adam

        • 1. Re: Need some help with API's getJSON
          shadowfax007

          Adam-

           

          I'm not familiar with teh Behance API so don't really have a clue.

           

          I did, however, just finish an Edge tutorial on how to import MySQL database information into an Edge animation using a .json file to import from.  It sounds like you may have already gotten that far but if it helps, here the link the to discussion:

           

          http://forums.adobe.com/thread/1201828?tstart=0

           

          James

          • 2. Re: Need some help with API's getJSON
            Dam4222 Level 1

            Hey Shadowfax,

             

            Thanks so much for your response. I checked out the tutorial and looks pretty cool. I am not using MySQL (though I would love to learn it because I suspect I am going to need it if I want to do Authentication). I didnt see anything in the tutorial that would help for my current issue.

             

            Thanks again and keep the tutorials coming.

             

            Adam

            • 3. Re: Need some help with API's getJSON
              shadowfax007 Level 1

              Adam-

               

              thanks!

              The only thing I thought *might* be usefull is if you weren't sure what code to use to pull a .son file into an animation to use.

               

              Can you explain a bit further what you mean by:

              " I want to be able to click on each of them and dive deeper to see more screenshots"

               

              Are you talking about linking one symbol to another ssymbol and so forth?

               

               

              James

              • 4. Re: Need some help with API's getJSON
                Dam4222 Level 1

                Hi Shadowfax,

                 

                Thanks again for your help.

                 

                If you take a look at my code in CompositionReady, you will see that I am pulling 2 JSON streams from Behance.  One called USER PROJECTS the other called PROJECT. I have successfully pulled the USER PROJECTS based on my specific username adamperlis9036. If you click on adamperlistv.html you can see that once you click on the Enter button a bunch of projects appear as thumbnails. I am trying to link those thumbnails to another DIV called "projectbox" which would contain the data being pulled from the PROJECT data stream.

                 

                I have tried to comment out what I could in compositionReady. Have a look and let me know what you think.

                 

                Adam

                • 5. Re: Need some help with API's getJSON
                  shadowfax007 Level 1

                  Adam-

                   

                  Haven't forgotten you!

                  Got caught up at work and am still stumped as you are - I'm still thinking about it thought...

                   

                  James

                  • 6. Re: Need some help with API's getJSON
                    Dam4222 Level 1

                    Hey James,

                     

                    Thanks so much. It looks like the community is having trouble with this one too. Have not found much yet on advance API stuff. Let me know if you make any progress on it. I am going to keep trying things out.

                     

                    Adam

                    • 7. Re: Need some help with API's getJSON
                      elainecc Adobe Employee

                      Hi, Adam-

                       

                      Okay, so this is going to take a long time to tease out, but the best thing I can suggest to you is to consider what data structures you use.  I took a quick peek at your project (don't have much bandwidth, but who knows, I might look into Behance in the next couple of weeks), and there were a couple of things I noticed:

                      • I have no idea where your data is going
                      • I have no idea how to get your data out

                       

                      So, this being the case, one thing you can do is to store your XML data from the detailed view into an associative array (okay, parameters within an object) that has all of the project IDs.  Then, just by querying your object on that object ID, you can get the information you need from that.

                       

                      I know it's vague, but using an associative array/hash is really useful in dynamic data projects like this.

                       

                      Hope this points you in the right direction.

                       

                      -Elaine

                      • 8. Re: Need some help with API's getJSON
                        Zaxist Level 4

                        hi Adam

                        i looked your project and i think you are in the wrong way...

                        as i know with JSON, it's not possible to create Click event for each of them at the time they are created and that is because of function() that we have to use for click event...

                         

                        Dynamic is very diffrent than Static and as i know ( may be i'm wrong) we can't do what ever we do in Static doing it in Dynamic

                         

                        and the solution : i think you have to create projectbox for every item that you create with JSON in that time Dynamically with the picture that you want they have in their background, means you have to set image address at that time too...

                         

                        then you write a click event like you have right now to toggle theme with Z-index that everytime you clicked on any of them that would be at top of all

                         

                        note : in this way is better not to use toggle and use show() instead..

                         

                        i would try to make Click event for you on Dynamic items that create with JSON but i'm not sure that i can done this...

                         

                        please try the solution and let me know if you could get it to work..

                         

                        Zaxist

                        • 9. Re: Need some help with API's getJSON
                          Zaxist Level 4

                          if i undrestand correctly, i found a way that can make click function in the way you wanted

                           

                          just cuz i'm new to edge and also JSON type files, i couldn't udrestand your code, cuz i use diffrent way code to use JSON data

                           

                          here is a sample, i made this sample for you and put a movement slider with mouse that i think if you can use this on your project it would be nice to move the beautiful timeline ( that you designed ) by mouse...

                           

                          Here is The link to Project : http://www.mediafire.com/?7qsqfneigzjava4

                           

                          Here is the Code :

                           

                          $.getJSON('slides.json', function(data){

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

                                              var s = sym.getSymbol("Base").createChildSymbol("Frame", "Slider");

                                              s.$("Frame").css({

                               "background-image":"url('"+data[i].image+"')",

                               "background-size":"contain",

                               "background-repeat":"no-repeat",

                               "background-position":"center"

                                                                       });

                               s.getSymbolElement().css({"position":"absolute","right": i*81+5+"px"});

                               sym.getSymbol("Base").$("Slider").css({"width":i*81+5+"px"});

                          // here is the code that make click action possible

                               s.$("Frame").data('title', data[i].image);

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

                               sym.$("PicFrame").css({

                               "background-image":"url("+$(this).data('title')+")",

                               "background-size":"contain",

                               "background-repeat":"no-repeat",

                               "background-position":"center"

                                                                  })

                                                        });

                                         }

                          });

                          • 10. Re: Need some help with API's getJSON
                            Dam4222 Level 1

                            Hi Zaxist,

                             

                            Thanks so much for your help with all of this. I am definetly a newbie when it comes to this stuff so I am sure my code is VERY messy.

                             

                            I attempted to download your file but I am getting an error. I did look at your code though and I understand the basic idea of what you are doing. If you wouldnt mind re-uploading your Project file so I can take a closer look I would greatly appreciate it.

                             

                            Thanks again.

                             

                            Adam

                            • 11. Re: Need some help with API's getJSON
                              Dam4222 Level 1

                              Thanks Elaine. When you have some more time, I would love your input! Try to take a look at the project in CompositionReady I have labelled what everything is doing. In addition, once you click on my .html file and click Enter and then click 2011. You should be seeing some images getting pulled in Dynamically from Behance.

                               

                              Thanks again for all your help.

                               

                              Adam

                              • 12. Re: Need some help with API's getJSON
                                Zaxist Level 4

                                Dear Adam

                                i made my link correct after i posted my text, so the link that you received within email is not correct but the link in the forum is correct now, try the link from Forum

                                • 13. Re: Need some help with API's getJSON
                                  Dam4222 Level 1

                                  Hey Zaxist,

                                   

                                  For some reason you link is still saying the file is invalid or deleted. Not sure why, maybe my company is blocking mediafire. Any chance you can use Dropbox instead?

                                   

                                  Adam

                                  • 14. Re: Need some help with API's getJSON
                                    Zaxist Level 4

                                    i'm Sorry, Some part of link was removed and i don't know how ?

                                     

                                    here is the correct Link : http://www.mediafire.com/download.php?7qsqfneigzjava4

                                    • 15. Re: Need some help with API's getJSON
                                      Dam4222 Level 1

                                      Hi Zaxist,

                                       

                                      Thanks so much for your help with this! One thing... I notice your project does not work in Chrome for some reason?

                                       

                                      Here is what I have tried to do...I took your code and tried to retrofit it to work with my API request. However, I am running into some issues and cant get the data to even print to console.log. If you wouldnt mind taking a look thanks for your help.

                                       

                                      Adam

                                       

                                      https://dl.dropboxusercontent.com/u/9159616/Dynamic%20Slide%20Mover%20JSON_AP.zip

                                      • 16. Re: Need some help with API's getJSON
                                        Zaxist Level 4

                                        Dear Adam

                                         

                                        My project works fine in all browser, but you need to know that browsers like Chrome and Maxthon woun't work with dynamic web content in local mode, if you want to test it to other browsers you just have to run the edge file and hit Ctrk+Enter then copy the preview link to any other browser that time so you can see the project works fine in all other and there is second way and thats you upload the project and try to load it by url in browser so you can see that way too

                                         

                                        i look your file now and come back to you..

                                        • 17. Re: Need some help with API's getJSON
                                          Dam4222 Level 1

                                          Thanks Zaxist. That is good to know thanks for you help!

                                          • 18. Re: Need some help with API's getJSON
                                            Zaxist Level 4

                                            Dear Adam

                                            i did too much research for undrestanding how each() function work and finaly i figured it out and made a sample with slide mover and i think it will load one of your page projects and after you click on your project it will show one of the pictures of your project and i'm still working on it to find out how can i make it like slide show

                                             

                                            here is the link of project and i hope you like it :  http://www.mediafire.com/download.php?g5da3axbcbwikz2

                                             

                                            Zaxist

                                            • 19. Re: Need some help with API's getJSON
                                              Dam4222 Level 1

                                              Hey Zaxist,

                                               

                                              This is a great start! I am going to play around with it and see what I can do. I think this a good basis to work off of, though at times a little confusing . Thanks for your help. I will post as soon as I get something in working order.

                                               

                                              Adam

                                              • 20. Re: Need some help with API's getJSON
                                                Zaxist Level 4

                                                you're welcome Adam

                                                 

                                                i will play with code to make the slide show, and if i could do anything i will post here, and i hope you can find a way too ! ,  because your idea is very intresting for me and i want to help you make it work

                                                 

                                                Zaxist

                                                • 21. Re: Need some help with API's getJSON
                                                  Dam4222 Level 1

                                                  Thanks Zaxist, once its done I will share with the community.

                                                   

                                                  Adam

                                                  • 22. Re: Need some help with API's getJSON
                                                    Zaxist Level 4

                                                    Dear Adam

                                                     

                                                    i have Good News for you, Finally i managed how to slide show your projects pictures,

                                                     

                                                    here is the link to the project : http://www.mediafire.com/download.php?a7usmibu90i97ah

                                                     

                                                    i hope that i could help you with your project...

                                                     

                                                     

                                                    if you had any problems, let me know, i will try my best to help you...

                                                     

                                                    with best reguards

                                                     

                                                    Zaxist

                                                    1 person found this helpful
                                                    • 23. Re: Need some help with API's getJSON
                                                      Dam4222 Level 1

                                                      Thank you so much for your help Zaxist. I will play around with this more and see what I can come up with.

                                                      • 24. Re: Need some help with API's getJSON
                                                        Zaxist Level 4

                                                        you are welcome Adam

                                                        • 25. Re: Need some help with API's getJSON
                                                          Dam4222 Level 1

                                                          Hi Zaxist,

                                                           

                                                          So I have attempted to implement your code into mind but I am running into two problems. 1) I want my projects to flow in a grid like fashion. I have seen this effect done using display:inline-block but no matter what I do I cant seem to figure it out. 2) When I click on a project nothing happens.

                                                           

                                                          I have put 2 project files to take a look at. 1) called AdamPerlis.zip is my original and how I would like the slides to look. 2) AdamPerlis-Zaxist.zip is my attempt to implement the code you wrote into my project.

                                                           

                                                          https://dl.dropboxusercontent.com/u/9159616/AdamPerlis.zip

                                                           

                                                          https://dl.dropboxusercontent.com/u/9159616/AdamPerlis-Zaxist.zip

                                                           

                                                          Thanks so much for your help figuring this out!

                                                           

                                                          Adam