Is it possible to set UI button's image with spritesheet?

As question asked,
I try to sent ui button with spritesheet. But it doesn't work.

1
2
3
4
5
6
7
8
9
10
11
12
  local sheet = sprite.newSpriteSheet("buttonSheet.png",100,100);
  local spriteSet = sprite.newSpriteSet(sheet, 1, 10);
  local spriteBtn = {};
  for i=1, spriteNum do
    spriteBtn[i] = sprite.newSprite(spriteSet);
    spriteBtn[i].currentFrame = i;
    end
 
local button = {};
  for i=1, 10 do
 button[i] = ui.newButton{
 defaultSrc = spriteBtn[i],....

No, this isn't possible.

You could make your own button using a spritesheet that looked like a normal ui button if you wished, however.

Peach :)

I see, thanks peach!

Actually, that depends on the ui.lua

Take a look at that one...

http://developer.anscamobile.com/code/enhanced-ui-library-uilua

Hey PixelEnvision,

I hadn't previously seen this - it's awesome you put it together :) Will have to check it out properly later.

SleepySheepy, I guess perhaps with the help of PixelEnvision's code this is possible! Awesome!

Peach :)

Thanks, it works fine

views:1579 update:2011/11/26 9:01:35
corona forums © 2003-2011