javascript noob question

    Jul 12 2011 | 6:25 pm
    I have start today playing with javascript. I have go to the google earth api and playing with the code. It's possible to change the coordinates of a location example (85 n, 74 w) and so on. Is it possible to change the script from max. For example if I trigger a bang it changes the coordinates or you cannot change the script ?????

    • Jul 13 2011 | 10:25 am
      Hi benoit-1842,
      without knowing the google-earth api there might be something to consider: to understand what JavaScript does inside Max you can think about it as a very sophisticated remote-control of Max/MSP. So in you use JavaScript inside Max basically your script will control/interact with Max. Your code wont do much outside Max.
      Browsers also use JavaScript. And it it's the same there: JavaScript used on a website will act much as a control-tool for your browser: For things such like changing the appearance of a DOM-element on your web page or triggering the sending of request to a server and than receiving data in return.
      So for services like google earth/maps/analytics, facebook, youtube etc that offer a JavaScript API this API is only working if you use it inside a webpage/browser. This is because the API basically organizes the data exchange between the browser and a server.
      In short - just because both applications (Max/Google Earth) can can understand JavaScript that doesn't mean they can directly talk to each other.
      If you want to interact with an application that is running via http-protocol on a server (such as the mention web services) you usually need to go a detour: First you have to setup a web-server of your own. Your max patch can communicate with this server (via udp/tcp - there are several objects around for that and man threads here in the forum) and triggering a script on this server that can interact with other web applications.
      Best j.
    • Jul 13 2011 | 7:17 pm
      So if I understand it's possible but I have to organize a web-server type of relation. So it will work changing web pages in real time using javascript... Thank you Jan BTW. Can you give me an example of a thread who will help me. Because if I understand I need more than just javascript and the API of Google earth, I need the interaction with the browser..... I know it's an ambitious project but I like that !!!! You already told me in a previous thread to learn javascript and I did so, so now what is the next steps for my project ?
      Thanx for answering that thread Jan !!!!
    • Jul 13 2011 | 10:11 pm
      Hi Ben,
      now i remember it was the "internet-jitter" thread! Can you tell some more details about what you are working on? That would help me to give more helpful advise (if I can).
    • Jul 14 2011 | 1:58 am
      Hi Jan thanx a lot for your interest. My project is fairly new. What I am trying to achieve is to *change* internet in real-time like taking Youtube or any other site and change the image or the sound in real-time. Right I'm working with downloaded videos and it's great. But artistically I think it will be cool to work with a site that use real-time and change it.... I don't know if it's possible but I think there's an opening there and I will be interest to *play* with that... Now that I know how javascript works, I think it's gonna help me... So if you have some pointers to give me I am all in for that !!!!!
      Thanx again for your help Jan !!!
    • Jul 14 2011 | 3:27 pm
      Hi Ben,
      to point efficiently into a direction some more technical details would help (or just see if understand you right ;) ) :
      It's clear until this point: You want an audience to load a website into their browser. The appearance of the site shall change in relation to something that happens inside your Max patch. And I assume that the modified website shall be accessible from anywhere in the web (not only a certain computer).
      From here on I have some questions:
      1. Would you like the audience to go to a existing website of someone else - lets say - and while they watch the site things are changing? - If so: does the site need to appear under the original URL in the Browser (i.e. ->to be frank this would be very close to cracking and I'd rather not go there to deep...... OR can the content of the site appear under another URL (one that belongs to you)?
      - If it's not an existing site, but one that you built on your own: * can you tell a bit more what you are using/showing on the site: You spoke about video and audio: what format/which technology to play them (flash/quicktime-player/ HTML5-player etc.). - What do you want to change exactly * do you want i.e. replace a video/audio at a certain place or do you need to make changes inside the video/audio itself (such as color filters, distortions etc). * do you want to change the HTML-Part of a website (such things as the location of certain elements on the site, colors and sizes, fonts etc)?
      And how responsive the whole thing shall be - The web basically offers theses options: * A site is changing after it is loaded in a browser (This is i.e. the case with chats) * A site only changes on reloads (Such as a news-site where every minute a different headline would be shown if you reload the page).
      All these possibility would need need a slightly different constructions, that's why I ask.
      Best Jan
    • Jul 27 2011 | 5:46 am
      thanks for the information.. ==============web design