JMKit's Recent Forum Activity

  • [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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi, - I have created an app on facebook, and have the ID and Secret etc, so I wanted to try out the facebook features in construct and I can get the login box to pop up,

    however when I try any of the "prompt" share options, I don't see anything.

    So in a really simple setup -

      one sprite, the faecbook object (with ID and Secret) the mouse object.

    I say: on left button clicked on sprite - prompt to share link... and nothing pops up at all

    Am I missing something?

  • I was trying to figure it out via X and Y but wasn't sure how to do it relatively to the sprites current position.

    I'll try making it a bullet and see if that is any better than the way MPPLant suggested, thanks

  • That's a pretty nifty way of going about it, I'll play around with that in my project thanks!

JMKit's avatar

JMKit

Early Adopter

Member since 21 Mar, 2015

None one is following JMKit yet!

Connect with JMKit

Trophy Case

  • 9-Year Club
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

12/44
How to earn trophies