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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:56:09+00:00 2026-05-12T11:56:09+00:00

(source: flickr.com ) Hi again everyone :) So today I’m trying to basically create

  • 0

alt text
(source: flickr.com)

Hi again everyone 🙂 So today I’m trying to basically create a simple glow effect on button rollOver. I may be over complicating things, but the way I’m going about this is by having 2 movieClips(default state and over state).

First I add the default state to the stage, next I add the rollOver state to the stage, but at a depth of 0 and alpha set to 0 as well. Now I want the rollOver state to swap depths with the default state as well as animate up to full alpha using the TweetLite class so I get a nice smooth transition.

I’m getting an error right now, but heres my code:

import gs.TweenLite;
import fl.motion.easing.*;
import flash.display.MovieClip;


var shopButton:MovieClip;
var shopButtonRoll:MovieClip;
var maxIndex:Number = this.numChildren - 1;

// Button - places the default state onto the stage
shopButton = new ShopButton();
shopButton.name = "shopButton";
shopButton.x = 262;
shopButton.y = 207;
shopButton.stop();
thumbsMov.addChild(shopButton);

// Button Glow - places rollOver state under the default and with 0 alpha
shopButtonRoll = new ShopButtonRoll();
shopButtonRoll.name = "shopButtonRoll";
shopButtonRoll.x = 262;
shopButtonRoll.y = 207;
shopButtonRoll.alpha = 0;
thumbsMov.addChildAt(shopButtonRoll, 0);

// Listeners

shopButton.addEventListener(MouseEvent.MOUSE_UP, shopClick);
shopButton.addEventListener(MouseEvent.ROLL_OVER, sendToTop);
shopButton.addEventListener(MouseEvent.ROLL_OUT, shopOff);
shopButtonRoll.addEventListener(MouseEvent.ROLL_OVER, shopOver);

// Button Actions 
// shopOver should bring rollOver to top and animate to 100%

function shopOver(event:MouseEvent):void
{
     TweenLite.to(shopButtonRoll, 1, {alpha:1});
}
function shopOff(event:MouseEvent):void
{
     // Code to animate back to 0 then change depth of rollOver to 0
}
function shopClick(event:MouseEvent):void
}
     trace("You clicked Shop");
}

// sendToTop Function
// Sent to top - depth change
function sendToTop(e:Event):void
{
     //this.setChildIndex(ShopButton(e.target), maxIndex);
     this.setChildIndex(e.currentTarget as MovieClip, maxIndex);
}

The error I’m getting on rollOver 🙁

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/setChildIndex()
at test_fla::MainTimeline/sendToTop()

I don’t understand what the error means by the supplied DisplayObject must be a child of the caller?

  • 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-12T11:56:09+00:00Added an answer on May 12, 2026 at 11:56 am

    Based on what your trying to accomplished you don’t have to manage depths. Essentially you can just add your rollover effect inside the shopButton and then once rolled over the shopButton, animate the glow. I udpated your code with the following:

    import gs.TweenLite;
    import fl.motion.easing.*;
    import flash.display.MovieClip;
    
    
    var shopButton:MovieClip;
    var shopButtonRoll:MovieClip;
    
    // Button - places the default state onto the stage
    shopButton = new ShopButton();
    shopButton.name = "shopButton";
    shopButton.x = 262;
    shopButton.y = 207;
    shopButton.stop();
    thumbsMov.addChild(shopButton);
    
    // Button Glow - places rollOver state under the default and with 0 alpha
    shopButtonRoll = new ShopButtonRoll();
    shopButtonRoll.name = "shopButtonRoll";
    shopButtonRoll.alpha = 0;
    shopButton.addChild(shopButtonRoll);
    
    
    // Listeners
    shopButton.buttonMode = true;
    shopButton.addEventListener(MouseEvent.MOUSE_UP, shopClick);
    shopButton.addEventListener(MouseEvent.ROLL_OVER, shopOver);
    shopButton.addEventListener(MouseEvent.ROLL_OUT, shopOff);
    
    // Button Actions 
    // shopOver should bring rollOver to top and animate to 100%
    
    function shopOver(event:MouseEvent):void
    {
         TweenLite.to(shopButtonRoll, 1, {alpha:1});
    }
    function shopOff(event:MouseEvent):void
    {
        TweenLite.to(shopButtonRoll, 1, {alpha:0});
         // Code to animate back to 0 then change depth of rollOver to 0
    }
    function shopClick(event:MouseEvent):void
    }
         trace("You clicked Shop");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 216k
  • Answers 216k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I had tackled a similar problem in one of my… May 12, 2026 at 11:12 pm
  • Editorial Team
    Editorial Team added an answer The much better solution involves not storing all your projects… May 12, 2026 at 11:12 pm
  • Editorial Team
    Editorial Team added an answer you might consider binding against an implementation of ICollectionView. A… May 12, 2026 at 11:12 pm

Related Questions

(source: flickr.com ) Hi again everyone :) So today I'm trying to basically create
Hi everyone my problem today is I have a couple of buttons that slide
How can I export the private key embedded in an .cer file and convert
I have to put a grid inside a iframe. I select a row then
I work for a firm that provides certain types of financial consulting services in

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.