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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:09:16+00:00 2026-05-30T21:09:16+00:00

I’m having a hard time with some code in actionscript 3.0. I don’y know

  • 0

I’m having a hard time with some code in actionscript 3.0. I don’y know how to randomize the movieclips stored on child and pick only 8 movieclips wherein there are 10 movieclips stored. I hope you’ll be able to help me with this problem. thanks

Here is the code:

    //start stage function
    this.mainmc.addEventListener (Event.ENTER_FRAME, setupStage1);
    this.waitingCounter=0;

//set up current stage
function setupStage1 (e:Event) {
    //wait for timeline
    if (this.waitingCounter<2) {
        this.waitingCounter++;
        //not ready yet, do nothing
        return;
    }
    //Start the timer
    timer.start();
    //hide hint
    this.mainmc.hintmc.visible=false;
    //hide star animation
    this.mainmc.starAnimation.visible=false;
    //listener for hint button
    this.mainmc.hintbut.addEventListener (MouseEvent.CLICK, showHint1);
    //create objects array
    this.obArr=[];
    //count the objects on stage
    for (var n=0; n<this.mainmc.numChildren; n++) {
        //get the children
        var ob=this.mainmc.getChildAt(n);
        //only take movie clips
        if (ob is MovieClip) {
            //only count the movie clips that have name declared
            if (ob.myname!=null) {
                //push to array
                this.obArr.push (MovieClip(ob));
            }
        }
    }

on the code above, the code will store all the movieclips that are present in the stage. it stores them in a child. each 10 movieclips has a variable name “myname”.

  • 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-30T21:09:17+00:00Added an answer on May 30, 2026 at 9:09 pm

    If you simply want to randomly sort items within an array, use the array.sort method and within your sort function, simply create a random number between 1 and 2. If it’s 1, return true, if it’s 2, return false. Here is an actionscript 2 snippet along with a link to a couple of tutorials:

    var a:Array = new Array(“a”, “b”, “c”, “d”, “e”);
    function shuffle(a,b):Number {
    var num : Number = Math.round(Math.random()*2)-1;
    return num;
    }
    var b:Array = a.sort(shuffle);
    trace(b);
    

    http://mrsteel.wordpress.com/2007/05/26/random-array-in-as2-as3-example-using-sort/

    http://sierakowski.eu/list-of-tips/75-random-sort-function-comes-handy-when-building-applications-with-playlists.html

    This is a much longer and more in-depth tutorial:
    http://active.tutsplus.com/tutorials/actionscript/quick-tip-how-to-randomly-shuffle-an-array-in-as3/

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string

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.