Search code examples
flashbuttonadobe

How to make a movie clip or graphic open up when a button is clicked in Flash?


I have converted my button into a button symbol and I want it so that whenever I click the button, it opens up a movie clip or graphic that is stored in my Library. Adobe Flash


Solution

  • I assume that you are in AS3. You have several options, but the easiest one would be to :

    • give your button an instance name : click on it, open the properties panel and fill the instance name field, for example with "myButton".

    • give your movieclip a linkage name in your library : right-click on it, open the properties panel, check the Export for actionScript box and fill the Class field, with myClip.

    • listen to the click event on your button :

      myButton.addEventListener(MouseEvent.CLICK, clickMyButton);
      
    • add the clip on the stage when you click it :

      function clickMyButton(evt:MouseEvent):void {addChild(myClip);}