views:

233

answers:

1

Hello, I got problem in cocos2D application. I have a sprite and text in one screen. The text should be able to move up/down when we swipe. And when we select on the sprite it should take to next scene. So, both should have the istouchEnabled to YES. But text should take the touchesMoved and sprite should take touchesEnded. But my problem is either one is working. If am able to swipe the text, I am not able to select the sprite.( touchesEnded for sprite is not called).

Please guide me, I am stuck here.

+1  A: 

Sounds like you might be trying to mix the functionality of UIScrollView and the graphical capabilities of Cocos2D. Me and my team ran into this issue a few months ago. We wrote an article about it...

http://getsetgames.com/2009/08/21/cocos2d-and-uiscrollview/

Hopefully that helps you out.

Rob Segal
I think you wrote the code about the touchEnded and touchMoved for same object. But my problem is I have a static test which should scroll and it should respond to the touches Moved function. A static image which is a sprite and it should animate. Now this sprite should respond to the touchesEnded function.
srikanth rongali
I haven't checked in a while so I can't remember but what class do text instances derive from. I suspect its not CCSprite in which case I'm not sure there are built in ccTouchesEnded and ccTouchesBegan event handlers implicitly setup. If this is true what you could do is make your text an image so it is used in scene as a CCSprite instance providing the necessary handlers. Just another thought.Where are you now with things? There are a few ways you can check that touches are being received by your sprite instance as a first step.
Rob Segal