今天,加载图片时有问题。 myButtonPList:loadTextures( "jineng/02103.png", "jineng/02103_light.png", "jineng/03101.png", UI_TEX_TYPE_PLIST )--]] --myButtonPList:addTouchEventListener(handler(self,self.ButtonCallback)) --myButtonPL
今天,加载图片时有问题。
myButtonPList:loadTextures(
"jineng/02103.png",
"jineng/02103_light.png",
"jineng/03101.png",
UI_TEX_TYPE_PLIST )--]]
--myButtonPList:addTouchEventListener(handler(self,self.ButtonCallback))
--myButtonPList:setPosition(cc.p(300,200))
--self.m_propRes:addChild(myButtonPList)
是出错的。因为UI_TEX_TYPE_PLIST已经加载到内存池里了,所以要用绝对路径,相对路径的应该是UI_TEX_TYPE_LOCAL(默认)
所以改为
local myButtonLocal = ccui.Button:create()
myButtonLocal:loadTextures(
"element_1004.png",
"element_1004.png",
"element_1004.png",
UI_TEX_TYPE_PLIST )
myButtonLocal:addTouchEventListener(handler(self,self.ButtonCallback))
myButtonLocal:setPosition(cc.p(300,300))
self.m_propRes:addChild(myButtonLocal)
即OK