Error while checking whether a selector is scheduled or not ?

Hi

I am scheduling a selector in CCTouchesBegan() function and then unscheduling it in CCTouchesEnded() function.
But before unScheduling it in CCTouchesEnded(), I am checking whether a selector is scheduled or not as follows :

`if(this->isScheduled(schedule_selector(FirstLevelGame::updateScroller)))
{

    this->unschedule(schedule_selector(FirstLevelGame::updateScroller));
}`

it gives error when I try to build :

* _ undefined reference to `cocos2d::CCNode::isScheduled(void (cocos2d::CCObject::**))’_
**

I am a noob in this field, plz help where am I making mistake

You can do an alternative.
You could create a bool member variable that will be true if updateScroller is running and set it to false if it is not. You can then check this variable in the ccTouchesBegan method.
Of course, you would need to manually set the variable to true when you start scheduling updateScroller and set it to false when you unschedule updateScroller

Hi Lance, Thanks

Yes I already did the same you suggested.
But just wanted to know if that function usage is buggy or version problem or any other problem.

I tried it and I’m getting a linker error and linker error usually means that the object/method you are accessing does not exist.

I think the reason is that schedule_selector* requires a method that accepts afloat* argument. In your case you need to have updateScroller* accept a float parameter, likeupdateScroller( float dt )*
I’m not sure, though. I’ve never tested it myself.

Hi Lance,

Yes updateScroller() function at my end is defined as follows::

@

void FirstLevelGame::updateScroller(float dt) {

CCPoint scrollWt = ccp(1000, 0);
mCCParallaxNode~~>setPosition, ccpMult));
CCArray* backGrndArray = CCArray::arrayWithCapacity;
backGrndArray~~>addObject(mEarthBackground3);
backGrndArray~~>addObject;
backGrndArray~~>addObject(mCloudBackground3);

for (int i = 0; i < backGrndArray~~>count; i++) {
CCSprite *backSprite = backGrndArray~~>objectAtIndex(i);
int x_pos = mCCParallaxNode~~>convertToWorldSpace).x;
int size = winSize.width;
if ) {
mCCParallaxNode~~>incrementOffset(ccp(winSize.width * (–3), 0),
backSprite);
}
}
}

@

including same float (duration) parameter . No clue what could be reason for this problem.

isScheduled was not implemented in CCNode.cpp file.
That why you get linker error while compiling.