2 Replies Latest reply on Nov 1, 2007 9:56 PM by kglad

    Dynamic onPress

    cfortin14
      I am trying to create a MovieClip at the root level, inside that MovieClip I am creating several dynamic MovieClips. To each one of those MovieClips I am trying to add an onPress event so I can do something as the MovieClips are pressed. This is the code I have:

      var vPos = 12;
      var hPos = 10;
      _root.createEmptyMovieClip("panel", _root.getNextHighestDepth());
      for(i=0;i<Videos.length;i++) {
      ln = i + 1
      _root.panel.createEmptyMovieClip("loader"+ln, _root.panel.getNextHighestDepth());
      _root.panel["loader"+ln].loadMovie(Videos .attributes.vThumb);
      _root.panel["loader"+ln]._y = vPos
      _root.panel["loader"+ln]._x = hPos
      hPos +=110;

      _root.panel["loader"+ln].onPress = function() {
      trace("Hello"+ln);
      }

      //form = new Object();
      //form.click = function(eventObj){
      // trace("Click");
      //}
      //_root.panel["loader"+ln].addEventListener("click", form);
      }

      Everything works except the onPress event

      What am I doing wrong?


      Your help is greatly appreciated,