@ ar2rsawseen or someone who tried this before. I need to set drag status of AceSlide during runtime. Is that possible ?
I tried:
function AceSlide:setDrag(s)
if (self.conf.allowDrag == true) then
print("Drag Off")
self.conf.allowDrag = false
for i = 1, self.total do
local xtarget = self:getChildAt(i)
--self:getChildAt(i):setAlpha(0)
self:getChildAt(i):removeEventListener(Event.MOUSE_DOWN, self.onMouseDown, xtarget)
self:getChildAt(i):removeEventListener(Event.MOUSE_MOVE, self.onMouseMove, xtarget)
self:getChildAt(i):removeEventListener(Event.MOUSE_UP, self.onMouseUp, xtarget)
end
end
but no luck. Any ideas ?
Comments
Firstly I think it should be
--dirty little fix
local fix = Sprite.new()
-- self:addChild(fix)
if self.conf.allowDrag then
fix:addEventListener(Event.MOUSE_DOWN, self.onMouseDown, self)
fix:addEventListener(Event.MOUSE_MOVE, self.onMouseMove, self)
fix:addEventListener(Event.MOUSE_UP, self.onMouseUp, self)
end
commenting out add child(fix) seems to work now but I wonder what is this for ?
Likes: anneMurielle
AceSlide actually was my first component created for Gideros, thus I may have created some mistakes there that could be avoided now, but until it done the job, I never bothered to fix it
Basically if removing this works, it means that inside :setDrag(s) event is not removed from all elements.
Thus you may need to update it as:
And don't worry, I won't go offline till we resolve this
The following demo only shows text scrolling but of course any objects can be added to the slider:
You can get the code and the demo project from my GitHub repo here.
best regards
Likes: Ozkar619, OZApps