function onTest() { var factory = shell.factory; var thumb = (factory) ? factory.createBitmap("myBmp", "../content/img1.png", scene) : null; if (thumb) { // set the bitmap's max size and add the new bitmap resource into our scene's library thumb.setThumbWidth(100); thumb.setThumbHeight(100); var lib = scene.library; if (lib) { // add it to the library lib.addResource(thumb); } } }