Hello,
I’ve got 2 simple (I think) questions.
I using the Director Class 1.4 in my App. And almost everything is working good.
There are different shapes on the screen.
For example:
[code]local redShape = display.newRect(0, 110, 320/2.9, 321/7)
redShape:setFillColor®
redShape:setStrokeColor(212,212,212)
redShape.strokeWidth = 2
localGroup:insert(redShape)
– redShape function
local function pressredShape (event)
if event.phase == “ended” then
director:changeScene (“red”)
end
end
redShape:addEventListener (“touch”, pressredShape)[/code]
That’s all working nice:)
But the problem is, I want to add a Tabbar in the screen.
So I use the widget.newTabBar.
[code]local function onBtnShapes( event )
director:changeScene (“shapes”)
end
local function onBtnEdit( event )
director:changeScene (“edit”)
end
local tabButtons = {
{
label=“Shapes”,
up=“icon.png”,
down=“icon.png”,
width=32, height=32,
onPress=onBtnShapes,
selected=true
},
{
label=“Edit”,
up=“icon.png”,
down=“icon.png”,
width=32, height=32,
onPress=onBtnEdit,
},
}
local tabs = widget.newTabBar{
top=430,
buttons=tabButtons
}[/code]
The TabBar is displayed on the screen:
Question 1
If the user is on the Shapes screen (start screen)
- The user touched “Shapes” on the TabBar and a new scene will be loaded.
But I don’t want that. The screen must stay the same. ( “selected=true” )
How can I do that?
Question 2
If the user is on the Shapes screen (start screen)
- The user touched “Edit” on the TabBar and a new scene will be loaded.
The only problem is that the screen don’t stay. When the user release the TabBar icon the screen will disappear…
How can I fix this? Maybe a touch is better then press?
[import]uid: 150924 topic_id: 28084 reply_id: 328084[/import]