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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:09:19+00:00 2026-06-10T04:09:19+00:00

Would you know how to change the value of flashPosX ? A log in

  • 0

Would you know how to change the value of flashPosX ? A “log” in changeFlashPosX works fine, but the value does not change:

-(void)changeFlashPosX{
    CCLOG(@"change");
    flashPosX = random() % 300;
    CCLOG(@"rando : %f", flashPosX);
}

-(void)animFlash{
    CCScaleTo *to1 = [CCScaleTo actionWithDuration:.2 scale:1];
    CCScaleTo *to0 = [CCScaleTo actionWithDuration:.6 scale:0];
    CCMoveTo *moveTo = [CCMoveTo actionWithDuration:0.1 position:ccp(flashPosX, flash.position.y)];
    CCCallFunc *callChange = [CCCallFunc actionWithTarget:self selector:@selector(changeFlashPosX)];
    CCSequence *seq = [CCSequence actions:to1, to0, callChange, moveTo, nil];
    //CCAction *repeatSeq = [CCRepeatForever actionWithAction:seq];
    CCRepeatForever *repeatSeq = [CCRepeatForever actionWithAction:seq];
    [flash runAction:repeatSeq];
}

The output :

rando : 164.000000
change
rando : 217.000000
change
rando : 241.000000
change
rando : 75.000000
  • 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-10T04:09:21+00:00Added an answer on June 10, 2026 at 4:09 am

    Try this:

    CCMoveTo *moveTo = [CCMoveTo actionWithDuration:0.1 position:ccp(random() % 300, flash.position.y)];
    

    If it works, then the issue is either with the scope and/or retention of your flashPosX variable, or with the routine loop called by the CCSequence.

    Also, try this:

    CCRepeatForever *repeatSeq = [CCRepeatForever actionWithAction:seq];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know how to change the value of attributes with SlowCheetah, but how would
Does any one know how I would have to change the following to work
i don't know what you call it, but how would i change fields /
I know how to change the value of a CheckBoxPreference , but I can't
I would like to know where to enter custom code to change the value
I would like to change the value of the readonly attribute using jQuery but
I would like to know how I can change a value in a session
I would like to know, how can we change the SRC url for IFRAME
I know this is very basic. I would like to use jQuery to change
I would like to know the Set Automatically value programmatically so I can validate

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.