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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:01:42+00:00 2026-06-11T11:01:42+00:00

I have an empty array collecting a hex value thats randomly selected from another

  • 0

I have an empty array collecting a hex value thats randomly selected from another array within a function. i am trying to pull the hex value from the array that gets filled and pass it to another function to randomly change the color value of a particle system…

private var ca:Array = new Array();
private var rc:String = ca; // pseudo...this is the string that needs to get passed

    public function addCursor(cursor:Cursor):void {

    var cc:Array = new Array("0xFFFF33", "0xFFFFFF", "0x79DCF4", "0xFF3333", "0xFFCC33", "0x99CC33");
    var rcc:String = cc[Math.floor(Math.random() * (cc.length))];
    ca.push(rcc); // 


    trace(rcc + ' 1st array');
    trace(ca + ' 2nd array');
    trace(rc + ' string to pass');

// unrelated stuff happens down here...

the 1st and 2nd arrays both trace the same hex value, but i cant find the right way to capture that string…ive tried several different methods that all return ‘null’ …which makes me think maybe the value is leaving the array before i try to snag it?

i removed ca.pop() which is called in a later function, just to see if rc would still return a null and it does.

  • 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-11T11:01:43+00:00Added an answer on June 11, 2026 at 11:01 am

    rcc is a string, not an array.

    So

    trace(rcc + ' chosen hex as a string');
    

    But I don’t see why you need an array (ca) just to hold a single string.

    This would work:

    private var rc:String;
    private var cc:Array = new Array("0xFFFF33", "0xFFFFFF", "0x79DCF4", "0xFF3333", "0xFFCC33", "0x99CC33");
    
    public function addCursor(cursor:Cursor):void {
    
    rc = cc[Math.floor(Math.random() * (cc.length))];
    
    trace(rc + ' the chosen hex');
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have reproduced this function: function getTables() { global $db; $value = array(); if
I have an empty array into which I am pushing values using javascript. I
I have created an empty json object having an array itemlist(which further contains itemid
Have an array of chars like char members[255]. How can I empty it completely
i have this problem: starting from an empty list (0 elements) i want check
have an issue updating magento product from frontend using a module that its function
I have following function which is called continuously from run() of a Thread which
I have a problem with random and arrays. I have a list empty list
I have a csv file which may have empty or blank rows. I want
When I am writing for example Spring Bean I often have empty element without

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.