Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8458467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:05:21+00:00 2026-06-10T13:05:21+00:00

I have a class that inherits from CCNode. This class has two CCSprites. When

  • 0

I have a class that inherits from CCNode. This class has two CCSprites. When the CCNode is initialized I expect two actions to be run on the two CCSprites, however the actions are skipped.

The two CCSprite variables are infoPanel and bg.

Header:

      //THIS IS NOT WORKING

#import "cocos2d.h"

    @interface GamePopUp : CCSprite <CCTargetedTouchDelegate> 

    @property (strong,readwrite) CCSprite* infoPanel;
    @property (strong,readwrite) CCSprite* bg;

 +(id)PopupInfo;
 -(id)initForInfoPopup;
 -(void)onEnter;
 -(void)onExit;
 -(void) rotate;

 @end

Implementation

-(id)initForInfoPopup
   { self = [super init];

  if(self)
  {
      _ourDevice = [[DimensionManager SharedDimensionManager]OurDevice];
      CGSize s = [[CCDirector sharedDirector] winSize];
      infoPanel = [CCSprite spriteWithFile:@"infoPanel.png"];

    if(_ourDevice == iPad)
    {
        infoPanel = [CCSprite spriteWithFile:@"infoPanel-hd.png"];
    }

    infoPanel.position = CGPointMake(s.width/2, s.height/2);




    bg = [CCSprite node];
    bg.color = ccBLACK;
    bg.opacity = 0;
    [bg setTextureRect:CGRectMake(0, 0, s.width, s.height)];
    bg.anchorPoint = ccp(0,0);

    [bg setTag:1];



    [self addChild:bg];
    [self addChild:infoPanel];

//These actions do not take place:
    [bg runAction:[CCFadeTo actionWithDuration:4 opacity:250]];
    [infoPanel runAction:[CCSequence actions:
                          [CCScaleTo actionWithDuration:4 scale:3],
                          [CCScaleTo actionWithDuration:4 scale:1],
                          nil]];





  }
 return self;

 }

The funny thing is that the same thing works in another class I found in a tutorial. That class inherets from CCSprite

Header:

  //THIS IS WORKING
  #import "cocos2d.h"

@interface PopUp : CCSprite {
  CCSprite *window,*bg;
  CCNode *container;
}

+(id)popUpWithTitle: (NSString *)titleText description:(NSString *)description sprite:(CCNode *)sprite;
- (id)initWithTitle: (NSString *)titleText description:(NSString *)description sprite:(CCNode *)sprite;

-(void)closePopUp;

@end

Implementation:

    - (id)initWithTitle: (NSString *)titleText description:(NSString *)description sprite:(CCNode *)sprite {
    self = [super init];
    if (self) {

     _ourDevice = [[DimensionManager SharedDimensionManager]OurDevice];

    CGSize s = [[CCDirector sharedDirector] winSize];
    container = sprite;
    CCLabelTTF *desc;
      int fSize = 36;

    if (_ourDevice == iPhone)
    {
    window = [CCSprite spriteWithFile:@"uglyPopup.png"];


         desc = [CCLabelTTF labelWithString:description fontName:@"TOONISH" fontSize:fSize/2];
    }else {
        window = [CCSprite spriteWithFile:@"uglyPopup-hd.png"];   
          desc = [CCLabelTTF labelWithString:description fontName:@"TOONISH" fontSize:fSize];
    }

    window.opacity = 160;
    bg = [CCSprite node];
    bg.color = ccBLACK;
    bg.opacity = 0;
    [bg setTextureRect:CGRectMake(0, 0, s.width, s.height)];
    bg.anchorPoint = ccp(0,0);
    [bg disableTouch];
    window.position = ccp(s.width/2, s.height/2);
    window.scale = 1;


    desc.position = ccp(window.position.x, window.position.y + window.contentSize.height / 2.2);
    desc.opacity = (float)255 * .75f;

    [window addChild:desc];
    [self addChild:bg z:-1 tag:tBG];
    [self addChild:window];
    [window addChild:container z:2];

    //THESE ACTIONS RUN:
    [bg runAction:[CCFadeTo actionWithDuration:ANIM_SPEED / 2 opacity:150]];
    [window runAction:[CCSequence actions:
                           [CCScaleTo actionWithDuration:ANIM_SPEED /2 scale:.9],
                           [CCScaleTo actionWithDuration:ANIM_SPEED /2 scale:.8],
                           nil]];


    }

    return self;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T13:05:22+00:00Added an answer on June 10, 2026 at 1:05 pm

    Try running your actions in onEnter function, actions will not run if your object’s isRunning boolean is NO

    - (void) onEnter
    {
        [super onEnter];
        //These actions do not take place:
        [bg runAction:[CCFadeTo actionWithDuration:4 opacity:250]];
        [infoPanel runAction:[CCSequence actions:
                              [CCScaleTo actionWithDuration:4 scale:3],
                              [CCScaleTo actionWithDuration:4 scale:1],
                              nil]];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class that inherits from UIView, and this class has some controls
I have a class that inherits from ApiController. It has a Put-method like this:
I have a class that inherits from a base class (this contains a lot
This is .NET 4.0/C#. I have a class that inherits from an interface: public
I have a class that inherits from defaultdict like this: class listdict(defaultdict): def __init__(self):
I have a class that inherits from a base class. This base class exposes
I have a class that inherits from Hash . When this class itself gets
I have a class that inherits from UIView However when trying to use the
I have a class that inherits from a generic dictionary as follows: Class myClass
I have a class that inherits from Page, called APage. public abstract class APage:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.