5 Replies Latest reply on Jan 25, 2007 11:49 AM by SwedKim

    How to add a button by writing in Actionscript?

    SwedKim
      I have a Flash Button. If I had drag this button from the Library to the Document then I know how to have a mouse event. I would write the event in the same Frame.
      But I don't want to drag it from the Library. I want to display this button by by using Actionscript, "attachMovie".
      1. Is this the correct way to attach a button by Actionscript?
      2. How do I add a actionlistner?

      My guess would be as the following but it doesnt' work:
      var informationButton:MovieClip = _root.attachMovie("myButton", "newButton", _root.getNextHighestDepth());
      WhatShouldBeHere.onRelease() = function(){
      myFunction();
      }
      Thank you for all your suggestions....