Skip to content

Instantly share code, notes, and snippets.

@ariefbayu
Created September 8, 2011 06:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ariefbayu/1202815 to your computer and use it in GitHub Desktop.
Save ariefbayu/1202815 to your computer and use it in GitHub Desktop.
To create header image with background repeated image.
//require line
var SceneView = require('ui').SceneView;
//`:load` line
var scene = new SceneView({ style: { width: 'fill-parent', height: 36 }});
scene.setLayers(sceneLayers.count);
scene.defineSpritesheet('headerImage', app.imageURL('header_image.png'), 128, 36);
scene.add({
sprite: 'headerImage',
x: 0,
y: 0,
layer: sceneLayers.image,
frame: 0
});
scene.defineSpritesheet('background', app.imageURL('header_background.png'), 1, 36);
scene.setLayerBackground(sceneLayers.background, {
sprite: 'background',
x: 0,
y: 0,
width: 400,
height: 36,
tile: true
});
self.add( scene );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment