JMKit's Forum Posts

  • I don't have any experience with that.

    Just a shot in the dark, haven't tried this, but you might be able to use window.location.href in an Browser.ExecJS expression.

    Hey, perfect that does let me use presumably all the other expressions, I just needed to tweak it to say window.parent.location.href and it displays just as I wanted. Thanks for the advice!

  • You could try the javascript addon.

    hmm is that the plugin SDK or something else?

  • Use the Browser object's URL expression. (Browser.URL)

    https://www.scirra.com/manual/110/browser

    Hey thanks for pointing me in the right direction, so I have it showing the path of the original html file, but if I have the game embedded on another page, how would I get it to show the parent URL. there doesn't seem to be an expression for that?

  • So I found out they are still using c2_callFunction (for legacy reasons)

    but even trying c2 I see

    [quote:2itvq2ce]c2_callFunction is not defined

    I checked and double checked the function object is in my project, and I made a function with the same name trigger a scene change but still seeing that error

  • Hi, is there any way to detect the url the game is being played / embedded on

    so as an example page1.html would trigger a function telling the game to show 1 - page2.html would trigger a function telling the game to show 2

    any help appreciated!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah great thanks for clarifying there.

    Just one other thing then, if I don't have access to write inside the advert launching javascript .js file, would I still be able to add that just in the index.html file as a script and it know what to do?

    as in this section

    adsCompleted = function() { 
            c2_callFunction("myAdsCompleted");
    }[/code:15rz3lyb]
    
    or do i need to also reference the source .js file in there somewhere too?
  • [quote:2rbl6g2z]Check out these links:

    https://www.scirra.com/tutorials/1078/b ... -js-and-c2

    site-calls-an-action-within-the-game_t115902

    Hey thanks for that, I had a look and it seemed to be referring to C2 in a lot of cases and calling out.

    I read about making the function inside construct by the same name as the javascript call, so I did that checked when it should have triggered it - but seemingly nothing happened

    I'd like to know if that's the basics of what I need to do though, just name a function inside construct thats the same as 'adsCompleted()' - or do I need to ad something else to the parameters of the function inside construct 3. Thanks again.

  • Hi,

    I'm working on a project for a client and I have implemented google video ads to run at a certain point with the browser object executing a javascript.

    I know that when the ad is over or skipped, the script calls a function 'adsCompleted()' - so my question is how would I get construct to 'hear' that and I can then un pause the game etc..

    any help would be appreciated. Thank you!

  • Ok so with some assistance from Toby R, we got this script together, and it feels like it's almost there with wrapping the canvas with the div tags I need, can someone who knows about how C3 exports it's HTML files and can adjust this code:

    <script>
    setTimeout(function(){
        var originalCanvas = document.querySelector("canvas");
        var newCanvas = '<div id="mygame" style="position:absolute;height:100%;width:100%;top:0;left:0">' + originalCanvas.innerHTML + "</div>";
        originalCanvas.innerHTML = newCanvas;
    }, 3000);
    </script>[/code:3kcw5at7]
    
    so that it fully wraps the games 'canvas' I would be eternally grateful
  • Ok thank you for the advice, I appreciate it's not your responsibility to support other libraries, I just wanted some guidance on moving on since things changed in the new version.

    Hopefully your recommendation will help us find a new alternative solution.

  • Construct 3 adds the canvas element from JavaScript. It should work identically to as if the HTML tag were used instead.

    Thanks for responding,

    not sure I entirely follow you, I'm being told I need to:

    "surround your <canvas> with

    <div id="mygame" style="position:absolute;height:100%;width:100%;top:0;left:0"></div>"

    but without the canvas tag in the exported html, and just using the 'div' id's it shows the ad, but above the game rather than overlaying the top of it

  • Hi I'm loving CS3 but just ran into an issue because of some differences in the HTML5 export..

    In CS2 HTML5 export would include this kind of code:

    	<!-- The canvas must be inside a div called c2canvasdiv -->
    	<div id="c2canvasdiv">
    	
    		<!-- The canvas the project will render to.  If you change its ID, don't forget to change the
    		ID the runtime looks for in the jQuery events above (ready() and cr_sizeCanvas()). -->
    		<canvas id="c2canvas" width="1010" height="570">
    			<!-- This text is displayed if the visitor's browser does not support HTML5.
    			You can change it, but it is a good idea to link to a description of a browser
    			and provide some links to download some popular HTML5-compatible browsers. -->
    			<h1>Your browser does not appear to support HTML5.  Try upgrading your browser to the latest version.  <a href="http://www.whatbrowser.org">What is a browser?</a>
    			<br/><br/><a href="http://www.microsoft.com/windows/internet-explorer/default.aspx">Microsoft Internet Explorer</a><br/>
    			<a href="http://www.mozilla.com/firefox/">Mozilla Firefox</a><br/>
    			<a href="http://www.google.com/chrome/">Google Chrome</a><br/>
    			<a href="http://www.apple.com/safari/download/">Apple Safari</a></h1>
    		</canvas>
    		
    	</div>[/code:1zt2ovmc]
    
    But in CS3 HTML5 exports there's no <canvas> tags at all, and for a clients advertising purposes they use the Canvas tag to overlay an advert, so can anyone explain the differences (sorry if it's a silly question) and maybe offer a soloutin..
    
    Thanks in advance!
  • Hey,

    thanks for taking the time to share the links, it's appreciated

  • That sucks if that's the case, any way to invoke the share to wall options via the AJAX/HTTP call 'old school' way?

  • Thanks for the reply.

    Interesting, I may be naive about AJAX but it never came up when reading the documentation about the Facebook object:

    https://www.scirra.com/manual/112/facebook

    Is there anywhere else that explains AJAX in conjunction with it?