Forum

Web Application Export

23 September 2015 11:18
Following the YouTube tutorial here: https://www.youtube.com/watch?v=wddoTT1bXeY
But I must be missing somethings, I cant get the player to load. The local server is up and running, other demo scenes will load, all files in place. I attached a zip of the project. It is just the default cube scene.
HTML Code:
<!DOCTYPE html>
<html>
<head>
     <title>Cube</title>
     <script type="text/javascript" src="b4w.full.min.js"></script>
     <script type="text/javascript" src="cube.js"></script>
     
	 <style>
     body {
               margin: 0;
               overflow: hidden;
          }
     #container_id {
               position: absolute;
               width: 100%;
               height: 50%;
          }
     </style>
	 
</head>
<body>
     <div id="container_id"></div>
</body>


</html>


Javascript:
"use strict";

var app    = b4w.require("app");
var data   = b4w.require("data");

app.init({
        canvas_container_id: "container_id", 
        physics_enabled: false,
        autoresize: true,
		callback: load_cb
    });
	
	function load_cb() {
		data.load("cube.json, loaded_cb");
	}
	
	function loaded_cb() {
		
	}


Live link: http://williamwelker.com/b4w/my_cube/index.html
23 September 2015 11:30
Hi Will,

The browser console (press F12) outputs a 404 error for this resource:
http://williamwelker.com/b4w/my_cube/wwmain.json,%20loaded_cb?t=31082015123644

Looks like the quotation mark is in wrong place:
data.load("wwmain.json, loaded_cb");

Should be:
data.load("wwmain.json", loaded_cb);

The Founder | Twitter | Facebook | Linkedin
23 September 2015 18:31
Thanks Yuri for your help. Here is the working result:
http://williamwelker.com/b4w/my_cube/index.html
For anybody who wants to start with a working basic example: http://williamwelker.com/b4w/my_cube.zip
Unzip it and put it in your SDK file like: C:\blend4web\deploy\apps\my_cube
Then make sure your local server is running and test it at http://localhost:6687/deploy/apps/my_cube/index.html
This is a bare bones application export so there are no camera controls, just a static default cube from Blender.
I typed this out from scratch, so if you want to do that, you can paste your code into http://www.jslint.com/ to check it for errors. I am not a professional coder so I had a few.
 
Please register or log in to leave a reply.