Skip navigation
jagguy999
Currently Being Moderated

assign bitmap movieClip

Feb 17, 2013 11:29 PM

Hi,

 

I have a movieClip and I want to click a button and change the movieClip image, how do I do this?

 

 

mc1.addEventListener(MouseEvent.CLICK, mymc1ClickHandler);

 

function mymc1ClickHandler(evtObj:MouseEvent){

trace("Change movie Clip here");

 

}

 
Replies
  • Currently Being Moderated
    Feb 18, 2013 12:03 AM   in reply to jagguy999

    The easiest way tod do this: put two pictures on keyframes with a stop() command inside your movieclip and toogle the display like this:

     

    function mymc1ClickHandler(evtObj:MouseEvent){

             // the modulo Operator [%] will take care that 1switches to 2 and 2 switches to 1

              evtObj.currentTarget.gotoAndStop((evtObj.currentTarget.currentFrame%2 )+1);

     

    }

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 18, 2013 2:18 AM   in reply to jagguy999

    you should place all the code on frame 1 of your main (highest) timeline.

    If your buttons are embeded in other MovieClips you can use

     

    //if your movieClip is called "container"

    container.mc1.addEventListener(MouseEvent.CLICK, mymc1ClickHandler);

    container.mc1.addEventListener(MouseEvent.ROLL_OVER, mymc1_overHandler);

    container.mc1.addEventListener(MouseEvent.ROLL_OUT, mymc1_outHandler);

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points