Problems with isTouchEnabled

Forums Programming cocos2d support (graphics engine) Problems with isTouchEnabled

This topic contains 3 replies, has 2 voices, and was last updated by  Mark Sawicki 3 years, 8 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
Author Posts
Author Posts
August 14, 2010 at 2:06 pm #223983


Good morning – I have been working at setting up a particle emitter (from the example code-ParticleTest), however I keep getting this error when I try to run it and have had not luck with the other forum suggestions – Can anyone point out what I am doing wrong? Thanks —

error: request for member ‘isTouchEnabled’ in something not a structure or union

- (id) init
if ((self=[super init])) {
self.isTouchEnabled = YES;

// ask director the the window size
CGSize size = [[CCDirector sharedDirector] winSize];
// create and initialize a Label
CCLabel* label = [CCLabel labelWithString:@"The first little pig built his house out of straw." fontName:@"Marker Felt" fontSize:48];
// position the label on the center of the screen
label.position = ccp(size.width/2,70 );
// add the label as a child to this Layer
[self addChild: label];

CCMenuItemImage *item2 = [CCMenuItemImage itemFromNormalImage:@"r1.png" selectedImage:@"r2.png" target:self selector:@selector(restartCallback:)];
CCMenu *pig = [CCMenu menuWithItems: item2, nil];
pig.position = CGPointZero;
item2.position = ccp( 960,40);
[self addChild: pig z:100];

CCLabelAtlas *labelAtlas = [CCLabelAtlas labelAtlasWithString:@"0000" charMapFile:@"fps_images.png" itemWidth:16 itemHeight:24 startCharMap:'.'];
[self addChild:labelAtlas z:100 tag:kTagLabelAtlas];
labelAtlas.position = ccp(size.width-66,100);

// moving background
background = [CCSprite spriteWithFile:@"background3.png"];
[self addChild:background z:5];
[background setPosition:ccp(size.width/2, size.height-180)];

id move = [CCMoveBy actionWithDuration:4 position:ccp(300,0)];
id move_back = [move reverse];
id seq = [CCSequence actions: move, move_back, nil];
[background runAction:[CCRepeatForever actionWithAction:seq]];


return self;


August 14, 2010 at 3:41 pm #294382

Mark Sawicki


What is self in this case? It should be a a layer/subclass of a layer.


August 14, 2010 at 4:04 pm #294383


Hi, I have it set up so that it is layer of scene – is this the correct way to do it? THANKS

August 14, 2010 at 5:59 pm #294384

Mark Sawicki

So, what does the first line of your interface declaration look like(i.e.):

@interface LayersTest : CCColorLayer {

The super class should be CCLayer, or derivative of (CCColorLayer is a subclass of CCLayer).

isTouchEnabled is only defined in CCLayer, which I am guessing, is why you are getting that error.


Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.