I'm getting an error in my loqbutton function implementation.

I'm trying to use the sprite button functions but I'm getting an error at the start. It still works but the error is something I would like to fix.

Here is the code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
local loqsprite = require("loq_sprite")
local menuSF = loqsprite.newFactory("menuSprites")
 
-- Create a complex button with press, down, release, up states.
-- Attaches listeners for onPress, onDown, onRelease, onUp and onTap events.
 
local loqbutton = require("loq_ui_button")
 
local sbtn = loqbutton.newButton { -- create a SpriteButton constructor table
    spriteGroup = menuSF:newSpriteGroup("NewGameButton")
 
    -- when the state changes automatically play the sprite
    , autoPlay = true
 
    -- the sprites for the button states
    , up = "NewGameButton"
    , down = "NewGameButtonDown"
    , press = "NewGameButtonDown"
    , release = "NewGameButton"
 
    -- the start frame of the state
    , upFrame = 1
    , downFrame = 2
    , pressFrame = 3
    , releaseFrame = 4
 
    -- the callback functions for the button states
    , onUp = function(event) print('startButton up') end
    , onDown = function(event) print('startButton down') end
    , onPress = function(event) print('startButton press') end
    , onRelease = function(event) print('startButton release') end
    , onTap = function(event) print('startButton tap') end
 
 
    -- custom data passed along to button to position it
    , x = 100
    , y = 100
 
    -- custom data to set the button's id
    , id = 'button 1'
}

Also when I press and hold outside of a button and drag over a button it continues even though the code I have is an on release code.

Does you menuSprites sprite actually have 4 frames to use with the start frame properties?

1
2
3
4
    , upFrame = 1
    , downFrame = 2
    , pressFrame = 3
    , releaseFrame = 4
views:1473 update:2011/10/12 9:17:43
corona forums © 2003-2011