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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:13:26+00:00 2026-05-27T08:13:26+00:00

When you add an action to a sprite, since most things in Cocos are

  • 0

When you add an action to a sprite, since most things in Cocos are autoreleased, is it then released after it completes? Or, because you added it to a node, is it retained by the node?

If the action then ends, either due to completing on its own or because you stop it yourself, is it then released or is it still available to be run later?

I ask because I want to know if you need to recreate actions to reuse them, or if you can simply reference their tag and start and stop them at will whenever you want. Of if they repeat, if you can simply get them by tag number and then run them again; it’s not clear the “correct” way to go about this. Thanks for help.

  • 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-05-27T08:13:27+00:00Added an answer on May 27, 2026 at 8:13 am

    My understanding is that when you create and run an action on a sprite, the action is added to CCActionManager, which is a singleton that will manage the actions for you. This includes releasing all of them when the CCACtionManager itself is released and also when the action is done.

    This is the relevant code about the latter (from CCActionManager.m):

    -(void) update: (ccTime) dt
    {
    for(tHashElement *elt = targets; elt != NULL; ) {   
        ...
        if( ! currentTarget->paused ) {
    
            // The 'actions' ccArray may change while inside this loop.
            for( currentTarget->actionIndex = 0; currentTarget->actionIndex < currentTarget->actions->num; currentTarget->actionIndex++) {
                               ....
    
                if( currentTarget->currentActionSalvaged ) {
                                  ....
                    [currentTarget->currentAction release];
    
                } else if( [currentTarget->currentAction isDone] ) {
                                      .... 
                    CCAction *a = currentTarget->currentAction;
                    currentTarget->currentAction = nil;
                    [self removeAction:a];
                }
                    .....
            }
        }
    

    After doing some research, it seems that the topic of reusing and action is on shaky grounds. Anyway, you can read here what the cocos2d best practices suggest. IMO, I would not try and reuse an action…

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

Sidebar

Related Questions

I want to create an action once, then add it to multiple sprites. For
I am unable to add action listener to a particular node in the tree.
How can I add action to buttons of NSRunAlertPanel. Here's how I am creating
How can I add custom action in generator.yml that point to an action in
I am supposed to add submit action to an image.So on the main page,i
I have one custom action (add) and two custom objects (favorites list) and (tv
i'm trying to add a contextual action mode to a listview, but i'm having
When I create a view different from index action (for example the action video/add)
My route looks like: routes.Add(new Route({companyName}/{action}/{id}, new MvcRouteHandler()) { Defaults = new RouteValueDictionary(new {
Does anyone know how to add a listener to the action overflow menu button

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.