-1

我用两种不同的 jQuery 效果制作了一个页面,一种效果很好,但背景效果不仅仅在在线模式下有效。离线工作...

Firebug 显示两个错误:

ReferenceError:未定义 b2AABB

worldAABB = 新 b2AABB(); (Zeile 58,Spalte 1)

语法错误:非法字符

一世”

Main.js(Zeile 58,Spalte 1)

这部分代码如下所示:

function init() {

  canvas = document.getElementById( 'canvas' );

  document.onmousedown = onDocumentMouseDown;
  document.onmouseup = onDocumentMouseUp;
  document.onmousemove = onDocumentMouseMove;
  document.ondblclick = onDocumentDoubleClick;

  document.addEventListener( 'touchstart', onDocumentTouchStart, false );
  document.addEventListener( 'touchmove', onDocumentTouchMove, false );
  document.addEventListener( 'touchend', onDocumentTouchEnd, false );

  // init box2d

  worldAABB = new b2AABB(); // this is the line 58
  worldAABB.minVertex.Set( -200, -200 );
  worldAABB.maxVertex.Set( screen.width + 200, screen.height + 200 );

  world = new b2World( worldAABB, new b2Vec2( 0, 0 ), true );

  setWalls();
  reset();
}

ajax.googleapisFTP 中是本地的。

4

1 回答 1

0

你使用 $(document).ready() 来调用 init 函数?

如果在调用函数之前未加载 js 文件,则调用失败。

于 2013-04-30T01:25:32.297 回答