1 Reply Latest reply on May 31, 2008 6:10 AM by AunStudio

    onPress doesn't work on image...

      Hi there,

      I am having a problem when trying to add an onPress handler to a JPG which is loaded into a movieclip.
      onPress doesn't work.

      ActionScript Code:

      for (i=0; i<ecards.length; i++) {
      var mc:MovieClip = attachMovie("recipient", "recipient"+i, i);
      mc.onPress = function(){


      "recipient" is a 100x75 rectangle (same size as JPG).
      if I comment the line "mc.loadMovie("images/button.jpg");" it displays only the original mc and traces the name property, but when I load the image into it, it doesn't trace it anymore.

      Any help would be appreciated.
      Thanks in advance!
        • 1. Re: onPress doesn't work on image...
          AunStudio Level 1
          I got a solution from Ali Inhan at Actionscript.org:

          for (i = 0; i < ecards.length; i++) {
          var mcl:MovieClipLoader = new MovieClipLoader();
          var listener:Object = new Object();
          listener.onLoadInit = function(m:MovieClip) {
          m.onPress = function() {
          var mc:MovieClip = attachMovie("recipient", "recipient" + i, i); mcl.loadClip("images/button.jpg", mc);