thanks for replying,jmp909
i solved the problem
first i insert data that i wanna call to database
[code]
------------------------------ button function --------------------------------
local function btnMomo()
db:exec [[INSERT INTO tb_character VALUES (1, “momo”)]]
print(“momo selected”)
director:changeScene(“loading”, “crossfade”)
end
local function btnMimi()
db:exec [[INSERT INTO tb_character VALUES (1, “mimi”)]]
print(“mimi selected”)
director:changeScene(“loading”, “crossfade”)
end
local function btnChichi()
db:exec [[INSERT INTO tb_character VALUES (1, “chi-chi”)]]
print(“chi-chi selected”)
director:changeScene(“loading”, “crossfade”)
end
local function btnChocho()
db:exec [[INSERT INTO tb_character VALUES (1, “cho-cho”)]]
print(“cho-cho selected”)
director:changeScene(“loading”, “crossfade”)
end
----------------------------------- button ------------------------------------
local MomoBtn = menuUI.newButtonMenu{
default = “Images/character/momo btn.png”,
over = “Images/character/over.png”,
onRelease = btnMomo,
x = 65,
y = display.contentHeight/2
}
MomoBtn:scale(0.7, 0.7)
local MimiBtn = menuUI.newButtonMenu{
default = “Images/character/mimi btn.png”,
over = “Images/character/over.png”,
onRelease = btnMimi,
x = 192,
y = display.contentHeight/2,
}
MimiBtn:scale(0.7, 0.7)
local ChichiBtn = menuUI.newButtonMenu{
default = “Images/character/chi-chi btn.png”,
over = “Images/character/over.png”,
onRelease = btnChichi,
x = 319,
y = display.contentHeight/2+1,
}
ChichiBtn:scale(0.7, 0.7)
local ChochoBtn = menuUI.newButtonMenu{
default = “Images/character/cho-cho btn.png”,
over = “Images/character/over.png”,
onRelease = btnChocho,
x = 445,
y = display.contentHeight/2,
}
ChochoBtn:scale(0.7, 0.7)
then in other file .lua, i call it…first i made it as global variable then i change it to local variable so i can manipulate then like what i want
[code]
require “sqlite3”
local dbPath = system.pathForFile (“database.sqlite”, system.DocumentsDirectory)
local db = sqlite3.open(dbPath)
–load character
for row in db:nrows(“SELECT * FROM tb_character”) do
local text = row.name
t = “Images/character/”…text…".png"
end
local character = display.newImage(t) --this variable that i use to animate
[import]uid: 33180 topic_id: 7902 reply_id: 28336[/import]