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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:51:17+00:00 2026-05-26T17:51:17+00:00

Is there an easy way to switch out a movieClip for another dynamically loaded

  • 0

Is there an easy way to switch out a movieClip for another dynamically loaded movieClip?

I have and eventListener onCLICK that when selected it starts an FLVPlayback but I would also like to swap out with another movieClip Play Now / Now Playing button.

Just some background. I am looping and loading a play button jpg’s into one movie clip and assigning an incremental number as a name to the play button movie clip. On Click that play button plays a movie but now I would also like to switch the play button graphic to a playing now graphic.

//ADD EVENT LISTENER TO ALL MY THUMBS_BUTTON
    thumbs_button.addEventListener (MouseEvent.CLICK, playVideoThumb);

    for (var i:Number = 0; i < my_total; i++) {

        var playButton_url = "play_now.png";
        var playButton_loader = new Loader();
        playButton_loader.name = i;
        playButton_loader.load (new URLRequest(root_path + playButton_url));
        playButton_loader.contentLoaderInfo.addEventListener (Event.COMPLETE, playButtonLoaded);
        playButton_loader.y = (115 * i) + (135 * i) + 138;


//PUT NEW LOADED IMAGE INTO THUMBS_BUTTON
function playButtonLoaded (e:Event):void {
    var my_playButton:Loader = Loader(e.target.loader);
    thumbs_button.addChild (my_playButton);
}


//THIS IS WHERE I NEED TO REMOVE THE PLAY NOW AND PUT IN THE NOW PLAYING BUTTON
function playVideoThumb (e:MouseEvent):void {
    var video_url = root_path +  my_videos[e.target.name].@URL;
    my_player.source = video_url;
    var blank_butt:Number = thumbs_button.getChildByName(e.target.name).x;
    thumbs_button.removeChild(thumbs_button.getChildByName(e.target.name));
}
  • 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-26T17:51:18+00:00Added an answer on May 26, 2026 at 5:51 pm

    Looking at your code I assume you probably want a radiobutton like functionality. There a few ways to do this. One way would by removing and adding children or in the case below just using the visible property:

    // will contain hidden button
    var hidden_button: DisplayObject = null;
    // playing now button
    var playingNow_button: Loader;
    
    //ADD EVENT LISTENER TO ALL MY THUMBS_BUTTON
    thumbs_button.addEventListener (MouseEvent.CLICK, playVideoThumb);
    
    for (var i:Number = 0; i < my_total; i++) {
        var playButton_url: String = "play_now.png";
        var playButton_loader: Loader = new Loader();
        playButton_loader.name = i;
        playButton_loader.load (new URLRequest(root_path + playButton_url));
        playButton_loader.contentLoaderInfo.addEventListener (Event.COMPLETE, playButtonLoaded);
        playButton_loader.y = (115 * i) + (135 * i) + 138;
    }
    // load playingNow graphic
    playingNow_button = new Loader();
    playingNow_button.load(new URLRequest(root_path + 'playing_now.png'));
    playingNow_button.contentLoaderInfo.addEventListener (Event.COMPLETE, playingNowLoaded);
    
    
    //PUT NEW LOADED IMAGE INTO THUMBS_BUTTON
    function playButtonLoaded (e:Event):void {
        var my_playButton:Loader = Loader(e.target.loader);
        thumbs_button.addChild (my_playButton);
    }
    
    //ADD PLAYING_NOW BUT HIDE
    function playingNowLoaded (e:Event):void {
        playingNow_button.visible = false;
        thumbs_button.addChild (playingNow_button);
    }
    
    
    //THIS IS WHERE I NEED TO REMOVE THE PLAY NOW AND PUT IN THE NOW PLAYING BUTTON
    function playVideoThumb (e:MouseEvent):void {
        // exit if user clicked playing Now button
        if (e.target == playingNow_button) return;
        // also exit if user clicked on something that is not a loader
        if (!(e.target is Loader)) return;
        // show hidden button (if any)
        if (hidden_button != null) hidden_button.visible = true;
        // assign current button to hidden_button
        hidden_button = DisplayObject(e.target);
        // copy location, scale and rotation
        playingNow_button.transform.matrix = hidden_button.transform.matrix;
        // show playingNow and hide button
        playingNow_button.visible = true;
        hidden_button.visible = false;
        // play video
        var video_url = root_path +  my_videos[e.target.name].@URL;
            my_player.source = video_url;
    }
    

    If you don’t need any processing of the loaded buttons, you can immediately add the Loader objects to the thumbs_button. You don’t have to do this in the COMPLETE handler.

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

Sidebar

Related Questions

Since there is no easy way to switch color theme in Eclipse I'm wondering
Is there an easy way to have a text box display a format in
Is there easy way to send email notification with cruise control? I Was reading
Is there any easy way to exchange the position of 2 elements - or
Is there an easy way to add shadows in opengl-es 1.x? Or only in
Is there an easy way to migrate a hosted LAMP site to Amazon Web
Is there an easy way how can I get in C char * from
Is there an easy way to iterate over an associative array of this structure
Is there an easy way in C# to create Ordinals for a number? For
Is there an easy way to produce MSDN-style documentation from the Visual Studio XML

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.