Android 为什么createjs.Ticker在我尝试使用phone gap/cordova运行我的应用程序时给我一个错误?

Android 为什么createjs.Ticker在我尝试使用phone gap/cordova运行我的应用程序时给我一个错误?,android,cordova,cordova-2.0.0,easeljs,Android,Cordova,Cordova 2.0.0,Easeljs,我是新来的电话差距和easeljs。我正在尝试在我的android桌面上运行我的重力球应用程序。当我尝试在平板电脑上通过eclipse运行应用程序时,我在LogCat中发现一个错误: 05-27 15:48:57.180:E/Web控制台(22640):未捕获引用错误:createjs未在file:///android_asset/www/index.html:144 我在下面附上我的代码。有人能帮我解释为什么这不起作用吗?谢谢你 负责人: //watch id引用当前的“watch加速”`

我是新来的电话差距和easeljs。我正在尝试在我的android桌面上运行我的重力球应用程序。当我尝试在平板电脑上通过eclipse运行应用程序时,我在LogCat中发现一个错误:

05-27 15:48:57.180:E/Web控制台(22640):未捕获引用错误:createjs未在file:///android_asset/www/index.html:144

我在下面附上我的代码。有人能帮我解释为什么这不起作用吗?谢谢你

负责人:


//watch id引用当前的“watch加速”`
var-watchID=null;
var accX、accY、accZ;
//等待Cordova加载
//
函数onLoad(){
文件。添加的监听器(“deviceready”,OnDeviceraddy,false);
}
//科尔多瓦准备好了
//
函数ondevicerady(){
startWatch();
//注册事件侦听器
}
//获取设备的区域设置时区
函数checkLocale(){
navigator.globalization.getLocaleName(
函数(locale){alert('locale:'+locale.value+'\n');},
函数(){alert('Error get locale\n');}
);
}
//onSuccess:获取当前加速度的快照
//
成功时的功能(加速){
//var元素=document.getElementById('deviceAcceleration');
accX=加速度.x;
accY=加速度,y;
accZ=加速度.z;
}  
//开始观察加速度
//
函数startWatch(){
//每10秒更新一次加速度
var选项={频率:100};
watchID=navigator.Accelerator.watchAcceleration(onSuccess、onError、options);
}
//不要再看加速度了
//
功能秒表(){
if(watchID){
navigator.Accelerator.clearWatch(watchID);
watchID=null;
}
}
//OneError:无法获取加速度
//
函数onError(){
警报('onError!');
}
以下是正文中的脚本:

var canvas;
var FPS = 40;

//Create a stage by getting a reference to the canvas
var stage;

//var bricks =[]
var balls = [];
//var paddle;

//initiates the applet
function init() {

    var ballImg = new Image();
    ballImg.src = "ball.gif";

    //var brickImg = new Image();
    //brickImg.src = "";

    var paddleImg = new Image();
    paddleImg.src = "";

    canvas = document.getElementById('canvas');
    //get the window dimensions
    canvas.width = window.innerWidth;
    canvas.height = window.innerHeight;

    stage = new createjs.Stage(canvas);

    createjs.Touch.enable(stage);

    var ball = new createjs.Bitmap(ballImg);
    ball.height = 120;
    ball.width = 120;
    //center of the object
    ball.radius = ball.height/2;
    ball.x = accX;
    ball.y = accY;
    ball.z = accZ;
    ball.velx = ball.vely =  ball.velz = 0;
    ball.acc = 0;
    balls.push(ball);
    stage.addChild(ball);

    createjs.Ticker.addEventListener("tick",repaint);
    createjs.Ticker.setFPS(FPS);

}


function moveBall(ball){
    //var velocity = Math.sqrt((accX*accX) +(accY*accY));
    //var xAccMag = Math.abs(accX);
    //var yAccMag = Math.abs(accY);

    //if the ball is on the edges of the canvas
    if(ball.x + ball.radius >= canvas.width){
        ball.velx *= -0.85;
        ball.vely *= 0.95;
        ball.x = canvas.width - ball.radius;
    }else if(ball.x - ball.radius <= 0){
        ball.velx *= -0.85;
        ball.vely *= 0.95;
        ball.x =  ball.radius;
    }else if(ball.y + ball.radius >=canvas.height){
        ball.velx *= 0.9;
        ball.vely *= -0.85;
        ball.y = canvas.height - ball.radius;
    }else if(ball.y - ball.radius <=0){
        ball.velx *= 0.9;
        ball.vely *= -0.85;
        ball.y= ball.radius;
    }

    ball.velx + (accX*(-1));
    ball.vely + accY;
}

function repaint(){
    moveBall(balls[0]);
    var rotation = ball.velx * FPS/1000;
    var ball = balls[0];
    ball.y += ball.vely * FPS/1000;
    ball.x += ball.velx * FPS/1000;

    ball.rotation += rotation;
    //clamp rotation
    ball.rotation = ball.rotation%360;
    stage.update();
}

$(document).ready( function () {
    init();
});
var画布;
var-FPS=40;
//通过获取对画布的引用来创建阶段
var期;
//var砖=[]
var=[];
//变桨;
//启动小程序
函数init(){
var ballImg=新图像();
ballImg.src=“ball.gif”;
//var brickImg=新图像();
//brickImg.src=“”;
var palleimg=新图像();
paddleImg.src=“”;
canvas=document.getElementById('canvas');
//获取窗口尺寸
canvas.width=window.innerWidth;
canvas.height=window.innerHeight;
stage=newcreatejs.stage(画布);
createjs.Touch.enable(stage);
var ball=new createjs.Bitmap(ballImg);
高度=120;
球宽=120;
//物体的中心
ball.radius=ball.height/2;
ball.x=accX;
ball.y=accY;
ball.z=accZ;
ball.velx=ball.vely=ball.velz=0;
ball.acc=0;
推(球);
舞台。儿童(球);
createjs.Ticker.addEventListener(“勾号”,重新绘制);
createjs.Ticker.setFPS(FPS);
}
功能移动球(球){
//var-velocity=Math.sqrt((accX*accX)+(accY*accY));
//var xAccMag=Math.abs(accX);
//var yAccMag=数学abs(accY);
//如果球在画布的边缘上
如果(ball.x+ball.radius>=画布宽度){
ball.velx*=-0.85;
ball.vely*=0.95;
ball.x=canvas.width-ball.radius;
}else if(ball.x-ball.radius=canvas.height){
ball.velx*=0.9;
ball.vely*=-0.85;
ball.y=canvas.height-ball.radius;

}否则,如果(ball.y-ball.radius)正文开头有一些脚本标记,我会删除它们,因为这篇文章会给我发布问题带来问题。你会删除包含createjs库的脚本标记吗?因为我现在看到的只是缺少这些脚本标记。-还有(主题外)您包括两个不同版本的jQuery…即使这不会给您带来任何错误,您也应该只使用一个版本,就像同时驾驶两辆车一样,它可能会工作,但很可能会在某个时候崩溃;-)
var canvas;
var FPS = 40;

//Create a stage by getting a reference to the canvas
var stage;

//var bricks =[]
var balls = [];
//var paddle;

//initiates the applet
function init() {

    var ballImg = new Image();
    ballImg.src = "ball.gif";

    //var brickImg = new Image();
    //brickImg.src = "";

    var paddleImg = new Image();
    paddleImg.src = "";

    canvas = document.getElementById('canvas');
    //get the window dimensions
    canvas.width = window.innerWidth;
    canvas.height = window.innerHeight;

    stage = new createjs.Stage(canvas);

    createjs.Touch.enable(stage);

    var ball = new createjs.Bitmap(ballImg);
    ball.height = 120;
    ball.width = 120;
    //center of the object
    ball.radius = ball.height/2;
    ball.x = accX;
    ball.y = accY;
    ball.z = accZ;
    ball.velx = ball.vely =  ball.velz = 0;
    ball.acc = 0;
    balls.push(ball);
    stage.addChild(ball);

    createjs.Ticker.addEventListener("tick",repaint);
    createjs.Ticker.setFPS(FPS);

}


function moveBall(ball){
    //var velocity = Math.sqrt((accX*accX) +(accY*accY));
    //var xAccMag = Math.abs(accX);
    //var yAccMag = Math.abs(accY);

    //if the ball is on the edges of the canvas
    if(ball.x + ball.radius >= canvas.width){
        ball.velx *= -0.85;
        ball.vely *= 0.95;
        ball.x = canvas.width - ball.radius;
    }else if(ball.x - ball.radius <= 0){
        ball.velx *= -0.85;
        ball.vely *= 0.95;
        ball.x =  ball.radius;
    }else if(ball.y + ball.radius >=canvas.height){
        ball.velx *= 0.9;
        ball.vely *= -0.85;
        ball.y = canvas.height - ball.radius;
    }else if(ball.y - ball.radius <=0){
        ball.velx *= 0.9;
        ball.vely *= -0.85;
        ball.y= ball.radius;
    }

    ball.velx + (accX*(-1));
    ball.vely + accY;
}

function repaint(){
    moveBall(balls[0]);
    var rotation = ball.velx * FPS/1000;
    var ball = balls[0];
    ball.y += ball.vely * FPS/1000;
    ball.x += ball.velx * FPS/1000;

    ball.rotation += rotation;
    //clamp rotation
    ball.rotation = ball.rotation%360;
    stage.update();
}

$(document).ready( function () {
    init();
});