rafhelp's Recent Forum Activity

  • for the external js file i have placed a function in it but i cant call it, what is the structure required for the externl js file and how do you call function sin that file after importing using jquery get script

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • you got to talk to me like a newbie to javascript. I have tried alot oan decided it may be too time consuming to learn this.

    I creat a new file called myfunction.js and placed it in the same folder as runtime.js.

    no how do i reference to it and actually call function to it in the Addaction section of the templates.

    Also i tried XMLHTTPREQUEST i can never get it to work when i have to pass multiple form data.

  • I am trying to use an API to retreive some xml data from a server, i need to post three pieces of data to the url. it tried the code below but it ALWAYS gives the error (i.e unsuccesfull), any ideas where im going wrong. im quite new to javascript

    ?function getinfo()

    {

       var httpc = new XMLHttpRequest(); // simplified for clarity

       

       var pdata = 'api_key=b9d57f3fbf2faa8d607ad2f46178ab153cc08b45&game_id=k4scvKUW5&response=XML';//i have used wrong values for security

        

       httpc.onreadystatechange = function ()

       {

        if (httpc.readyState === 4)

         {

         if (httpc.status === 200)

          {

          alert(httpc.responseText);

          }

         else

          {

          alert('There was a problem with the request!!.');

          }

         }

       };

       

           ?httpc.open("POST", "http://www.apisite.com/api/getInfo", true); // sending as POST

        httpc.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

        httpc.setRequestHeader("Content-Length", pdata.length); // POST request MUST have a Content-Length header (as per HTTP/1.1)

        httpc.send(pdata);

    };edited><editID>rafhelp</editID><editDate>2012-03-20 04:10:37</editDate></edited>

  • i know.

    the request.send(); needs to be moved out one level of brackets..

    you had it in the function which is only called when you get successful response but you wont get a response as you never send in the first place.

    try moving it down a few lines

  • i make changes to the plugin javascript files but in order to test if they work i have close and rerun construct 2. its a pain!! why cant construct just reload the updated/modifed .js files before previewing the game??

    Anyway i somehow got this to work.. i deleted some of those VAR declarations...maybe?

    Well one last thing on this thread, can someone help me with this function, itts placed in the common.js file and called from one of the actions, it works but the post function doesnt work:

    function getGame()
    {
     $.post("http://www.apisite.com/api/getInfo", {api_key:"b9d57f3fbf2faa8d607ad2fc6178ab153cc08b48",game_id:"k4scvKUW3",response:"xml"},
       function(data){alert("Data Loaded: "+data);},"xml");
    };
    
  • Hi, i am creating first time plugin that will simply show a message alert with a string.

    I created the plugin using the SDK template, i just changed the name and icon thats all, and also the settings like web, object etc..

    I ran the project, when i make no reference to the lolo actions it works fine.

    then i add a button and in its click event i add an action to use the alert action of lolo plugin, then i run the project and all i get is a blank grey screen and nothing works.

    here is the zipped project file. I have placed the plugin folder "lolo" here as well, you can copy it to your construct 2 plugin folder.

    http://uploading.com/files/9e5mfdfc/lolo.zip/

    help appreciated.

rafhelp's avatar

rafhelp

Member since 19 Mar, 2012

None one is following rafhelp yet!

Connect with rafhelp

Trophy Case

  • 12-Year Club
  • Email Verified

Progress

13/44
How to earn trophies