首页 > 代码库 > quick cocos2dx 滚动条

quick cocos2dx 滚动条

--滚动条 labar
local function valueChanged(strEventName,pSender)
if nil == pSender then
return
end
local pControl = tolua.cast(pSender,"CCControlSlider")
local strFmt = nil
if pControl:getTag() == 10 then
print(pControl:getValue())

elseif pControl:getTag() == 2 then
print(pControl:getValue())
end

if nil ~= strFmt then
--pDisplayValueLabel:setString(CCString:create(strFmt):getCString())
end
end


local pSlider = CCControlSlider:create("res/sliderTrack.png","res/sliderProgress.png" ,"res/sliderThumb.png")
pSlider:setAnchorPoint(ccp(0.5, 1.0))
pSlider:setPosition(ccp(s.width / 2.0, s.height / 2.0))
pSlider:setMinimumValue(0.0)
pSlider:setMaximumValue(100.0)
pSlider:setTag(10)
--pSlider:setValue(3.0)
bglayer:addChild(pSlider,4)
pSlider:addHandleOfControlEvent(valueChanged, CCControlEventValueChanged)

 

 

--------------------

local to1 = CCProgressTo:create(1, 100)
local newTitle = CCProgressTimer:create(display.newSprite("#img_lvup_title.png"))
newTitle:setType(kCCProgressTimerTypeBar)
newTitle:setMidpoint(CCPointMake(0, 0))
newTitle:setBarChangeRate(CCPointMake(1, 0))
newTitle:setPosition(self.ImgTitle:getPosition())
newTitle:runAction(to1)
self:addChild(newTitle,100)