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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:40:53+00:00 2026-05-15T16:40:53+00:00

I have three balls. What do I do? They should look like they are

  • 0

I have three balls. What do I do?

They should look like they are being juggled when animated, but
I’m not indexing them correctly. Please help.
Thanks

Edit
Maybe I should just use an array. getChildAt sort of works, but it’s not looping though perfectly. It moves one or two balls, not one by one…

//JUGGLING ANIMATION WITH 3 BALLS
var myTimer:Timer = new Timer(444);
myTimer.addEventListener(TimerEvent.TIMER,someFunction);
myTimer.start();
function someFunction(event:TimerEvent) {
var T:Number =0; 

//WHERE I'M SETTING IT WRONG
T++; 
T %= 3;
var dr:*;
dr = getChildAt(numChildren - 1);
for(var i:int; i <T; i++){
setChildIndex(dr,i);
trace(i);
}
}

Output
The output traces zero, and the animation looks like it moves either 1 or 2 balls at once, rather than looping through each.

  • 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-15T16:40:54+00:00Added an answer on May 15, 2026 at 4:40 pm

    Edit:

    Don’t know what you really want to achieve but change only one index within one call

    var depth:Number =0;
    
    var myTimer:Timer = new Timer(444);
    
    myTimer.addEventListener(TimerEvent.TIMER,someFunction);
    myTimer.start();
    
    function someFunction(event:TimerEvent):void {
      depth =(depth + 1) % 3;
    
      var dr:DisplayObject = getChildAt(numChildren - 1);
    
      setChildIndex(dr, depth);
    
      trace(depth);
    }
    

    Your T value is wrong you can’t increment and doing modulo in the same time=>

    T = (T + 1) % 3;
    

    or

    T++; 
    T %= 3;
    

    and you are also reseting T to 0 every time within your repeated function, put it outside of the function :

    var T:Number =0;
    
    var myTimer:Timer = new Timer(444);
    myTimer.addEventListener(TimerEvent.TIMER,someFunction);
    myTimer.start();
    
    function someFunction(event:TimerEvent):void {
      T =(T + 1) % 3;
      var dr:DisplayObject = getChildAt(numChildren - 1);
      for(var i:int=0; i <T; i++){
        setChildIndex(dr,i);
        trace(i);
      }
    }
    
    • You also have forget to set a value for i into your loop.
    • And you are changing in the same loop, T times the child index, so at the end only the last one set will be visible on your screen.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have pong balls that are being generated very consistently, but the rates change
I have three tables: page, attachment, page-attachment I have data like this: page ID
I have an object tree that looks something like Ball / \ LegalBall IllegalBall
I have three tables tag , page , pagetag With the data below page
I have three models: class ReleaseItem < ActiveRecord::Base has_many :pack_release_items has_one :pack, :through =>
I have three unordered lists that have been created as Scriptaculous Sortables so that
I have three (C++) classes: Player, Hand, and Card. Player has a member, hand,
I have three divs : <div id=login /> <div id=content /> <div id=menu />
I have three TextBox controls on the page <asp:TextBox ID=TextBox1 runat=server AutoPostBack=True OnTextChanged=TextBox_TextChanged TabIndex=1>
I have three tables in the many-to-many format. I.e, table A, B, and AB

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.