请确保您使用正确的语法。
var bgImage = preload.getResult("screenImage").result;
var bgBitmap = new createjs.Bitmap(bgImage);
stage.addChild(bgBitmap);
还有什么是你得到的错误?这是一个应该有所帮助的快速示例。
function init() {
canvas = document.getElementById("testCanvas");
//check to see if we are running in a browser with touch support
stage = new createjs.Stage(canvas);
createjs.Ticker.setFPS(24);
createjs.Ticker.addListener(stage);
images = images || {};
var manifest = [
{src:"image.jpg", id:"image"}
]
loader = new createjs.PreloadJS(false);
loader.onFileLoad = handleFileLoad;
loader.onComplete = handleComplete;
loader.loadManifest(manifest);
}
function handleFileLoad(o) {
//You could store all your images in object to call them easily.
if (o.type == "image") {
images[o.id] = o.result;
}
}
function handleComplete(event) {
var bg = new createjs.Bitmap(loader.getResult("image").result);
//OR samething
//var bg = new createjs.Bitmap(images['image']);
stage.addChild(bg);
}
function tick() {
stage.update();
}
希望这可以帮助。