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 7815453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:31:41+00:00 2026-06-02T05:31:41+00:00

I need to call a function after a CCSpeed delay so that I can

  • 0

I need to call a function after a CCSpeed delay so that I can change the speed dynamically. As far as I know, I can’t use a CCSpeed inside a CCSequence, so I tried using a CCSequence (CCDelayTime, CCCallFuncND, nil) inside a CCSpeed, which also doesn’t appear to work. Anyone have any suggestions?

In my BackgroundLayer class, I have a NSNumber *multiplierSpeed; :

@interface BackgroundLayer : CCLayer {
    NSNumber *multiplierSpeed;
}
@property (nonatomic, retain) NSNumber *multiplierSpeed;

-(void)rotateWorldAndSwapIn:(id)sender data:(int)frame;
@end

And in my implementation:

@synthesize multiplierSpeed;
-(id)init {
    self = [super init];
    if (self != nil) {
        //...
        multiplierSpeed = [NSNumber numberWithFloat:1.0f];
        CCSpeed *delay = [CCSpeed actionWithAction:[CCSequence actions:[CCDelayTime actionWithDuration:20],[CCCallFuncND actionWithTarget:self selector:@selector(rotateWorldAndSwapIn:data:) data:(void*)3], nil] speed:1.0f];
        [delay setTag:10];
        [self runAction:delay];
        //...
    }
}

-(void)rotateWorldAndSwapIn:(id)sender data:(int)frame {
    CCLOG(@"test"); //This is fine
    CCLOG(@"multiplierSpeed=%f",[multiplierSpeed floatValue]); //Crashes here
    //... 
} 

I am getting this error:

EXC_BAD_ACCESS on callbackMethod_(targetCallback_,selector_,target_, data_);

in the CCActionInstant.m file.

Also, is it because CCSpeed wraps around CCCallFuncND, which has no delay, that’s throwing this error? If so, do you have any alternative suggestions?

Thanks for helping!

  • 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-02T05:31:43+00:00Added an answer on June 2, 2026 at 5:31 am

    You need to use self.multiplierSpeed instead of only multiplierSpeed.

    self.multiplierSpeed = [NSNumber numberWithFloat:1.0f];
    

    and then in the CCLOG,

    CCLOG(@"multiplierSpeed=%f",[self.multiplierSpeed floatValue]); //Won't crash anymore
    

    Unless you use self.varName, Objective-c won’t be using the getter/setter methods, rather would try to access the instance variable directly causing a bad memory access (as no memory was allocated for that var)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to call the javascript function dynamically after some delay, The function display_1,
I have a bit of a quandary. I need to call a function inside
I have a jquery Ajax call function that I use to submit form to
I need to call my function abc() , 5 seconds after the document ready
If I need call this functions one after other, $('#art1').animate({'width':'1000px'},1000); $('#art2').animate({'width':'1000px'},1000); $('#art3').animate({'width':'1000px'},1000); I know
I have a recursive function (in C#) that I need to call about 800
I have a jquery function and I need to call it after opening the
i need to call customFormElements.js js function after aspx page is loaded, after submit
I need to call a function in an unmanaged .dll written in C lang
I need to call a function by clicking a button. The button is on

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.