Grimmy's Recent Forum Activity

  • I have a html file within my project files folder which I get at runtime and uses it as the url for an iframe.

    This works great when I export to the web and run in the browser. However, when I do the exact same thing in an Android debug APK the iframe never seems to get populated with the html. Why could this be?

    I get my html file like this:

    var mainHtml = await runtime.assets.getProjectFileUrl("c3interfacetest.html");
    var response = await fetch(mainHtml);
    runtime.callFunction("OnGotHtmlFile",[mainHtml]);
    

    then the OnGotHtmlFile function runs in the event sheet with the project file as the argument..

    -> myIframe: Navigate to mainHtml

    Like I said, this seems to run fine on the server in a web page but not on device. There are no errors given in the Chrome console.

    Tagged:

  • It seems that I can only import files and not folders. Is there any way I can drag a complete folder with its subdirectories and files into my project?

    Or some other trick to do this? My tree structure is too big to recreate it by hand everytime I need to update the files.

    Tagged:

  • Does this plugin even work? The only demo; Tiny Tank doesn't run (errors with : context.listener.setVelocity is not a function)

    And I dont see anything from the developer.

    If I could see a working demo of it running with Construct 3 I'd be more than happy to buy it.

    Or is it dead?

    Thanks

  • I want construct animations/sprites etc to sit on top of a video iframe.

    I read this was possible using css styles in another thread but the thread is kind of unclear (and quite old).

    I tried this but it doesnt seem to do anything:

    var myiframe = runtime.getInstanceByUid(3);
    myiframe.setCssStyle.zIndex=-20;
    

    So, Is there any way at all to have content sit in front of an iframe? This would be super useful!!

    If not, could there be some way of having 2 iframes? One iframe of my construct project on top (with a transparent background) with the other (video iframe) content below it? Would that even work?

    Tagged:

  • SOLUTION

    In order to send messages and bypass CORS issues during testing rather than use the c3_callfunction event I instead am using Window.onMesssage to send dat from the iFrame back to C3. This is how its done:

    In Child Iframe:

    //send simple message without data
    		parent.postMessage("MsgFromIframeToC3", "*");
    		
    		//send to c3 with some data
    		parent.postMessage(
    			{
    				event_id: 'MsgFromIframeToC3WithData',
    				data: {
    					v1: 'value1', 
    					v2: 'value2'
    					}
    			}, 
    			"*" 
    		); 
    

    IN C3:

    window.onmessage = function(event) {
    
    	//A single message
    	if (event.data == 'MsgFromIframeToC3') {
     console.log('Message from iFrame Received');
    		
     }
    	
    	//a message with data
     if(event.data.event_id === 'MsgFromIframeToC3WithData'){
     console.log( "c3D 3d Says: "+ JSON.stringify(event.data.data));
    		console.log(event.data.data);
    		
     }
    }
    

    ..and of course its completely possible to send message the other way (from C3 to iframe) using the same system in reverse (use window) for example (in C3):

    var myIframe = document.getElementById('myIframe');
    
    myIframe.contentWindow.postMessage('MessageToIframe', '*');
    
  • That works great. Thanks for the example! parent.c3_callFunction("myFunction")

    The problem I have now though is that my iframe isnt allowed to communicate with C3 during preview because of COrs policy.eg:

    C3_InterfaceTest.js:213 Uncaught DOMException: Blocked a frame with origin "http://localhost:8668" from accessing a cross-origin frame.

    In your example the html was part of the iframe inside C3 itself (so everything works fine) but in my case it uses an external.html file to embed.

    Although my iframe will eventually be on the same server and directory when online I have no idea how to make this work locally when testing in C3. I got a chrome extension which was supposed to block COrs but that doesnt seem to have any effect.

    Any ideas how I can test locally without having to do an upload to my website each time I need to test something?

    Cheers

  • Dead link apparently. :(

  • Primary I guess I need to somehow be able to first locate the C3 element and then somehow call a function.

    In my case the application that calls the function is actually an iframe contained within a C3 window so I thought I might use something like this...

    window.parent.c2_callFunction("FunctionFromIframe");

    But that just doesn't do anything at all.

  • I added a html page as one of the files to my project and I want to view it from the running project as an iframe.

    in the URL field of the iframe object I tried putting "/myHtmlFile.html" but nothing happens.

    if I try file://myHtmlFile.html I get an error: "Not allowed to load local resource:"

    also local/myHtmlFile.html fails with a 404 error..

    Is there a way to do this?

    ALso, I just tried uploading everything to the same folder on a server but I still get permission errors:

    Uncaught DOMException: Blocked a frame with origin "https://www.pigobo.com" from accessing a cross-origin frame.

    I cant understand because both the c3 index.html and the myHtmlFile.html are sitting in the same folder..?!?? How can this be a CORS issue?

    Cheers

  • Lets say for my game I want my user to be able to choose from 1000 fonts (about 250 meg when added to the project) but obviously this is way to big for a web game.

    So, is there some way I can download the selected .ttf from a url into the project at runtime and then use it once ready?

    This way the game can launch as normal and download individual fonts as and when they are needed.

    Cheers

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Say my game is 640*480 but I want to save a huge high res screen shot of it. (1920*1080 for example). Is there any way I can do this and save it out to a file (jpeg or png for example)?

    Cheer

  • Understood, but do you have any kind of very rough idea? :) I don't want to invest too much time if its not really feasible still. I know you probably think I'm just being lazy but do you think for example it could easily do 10 bipeds on a 2 year old mobile or more like 1000...or just one. I only say this because you mentioned the problem of frame rate earlier and I'm just keen to know really if its either a huge problem or just a problem if I wanted a screen full of sprites.

    BTW..have you seen Creature Animation Pro (https://creature.kestrelmoon.com/) it looks like an amazing Spine/Spriter alternative but again I don't think there is a C3 plugin :(

Grimmy's avatar

Grimmy

Member since 20 Nov, 2012

Twitter
Grimmy has 2 followers

Trophy Case

  • 12-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

17/44
How to earn trophies