5 Replies Latest reply on Feb 15, 2009 2:58 PM by kglad

    applying global function to a movieclip

      I'm creating a game where the character stays in the middle of the screen and the background scrolls past as buttons are pressed. I have several enemies and such that I want to scroll into view as well.
      I created a global function:

      _global.objects_move = function()
      if (Key.isDown(Key.UP)) {
      this._y -= 10;
      if (Key.isDown(Key.DOWN)) {
      this._y += 10;
      if (Key.isDown(Key.LEFT)) {
      this._x += 10;
      if (Key.isDown(Key.RIGHT)) {
      this._x -= 10;

      and I want to apply to all the different enemy movieclips so they scroll into view.
      I've tried adding this code onto the movieclips

      onClipEvent (enterFrame)

      and similar things but I just can't get it to work...