0 Replies Latest reply on Oct 22, 2006 9:40 AM by aezat

    Star wars with Actionscript2 flash8

    aezat
      Hai all,
      I am new in flash an i was making project like star wars, its a mc i duplicate it and make it moving on the stage, this is the code that rawing the mcs, i want to make it loop, so when it disapppear, it appears agian from teh oppposite side, the code is here

      stop();
      // array code
      var moving:Boolean = true;
      var num_menu_items:Number = 6;
      var menu_item_info:Array = new Array(num_menu_items);
      trace(menu_item_info.length);
      for (var i = 0; i<num_menu_items; i++) {
      menu_item_info = new Object();
      }
      menu_item_info[0].movie = "thumb0";
      menu_item_info[1].movie = "thumb1";
      menu_item_info[2].movie = "thumb2";
      menu_item_info[3].movie = "thumb3";
      menu_item_info[4].movie = "thumb4";
      menu_item_info[5].movie = "thumb5";
      menu_item_info[0].frame = "portfolio";
      menu_item_info[1].frame = "games";
      menu_item_info[2].frame = "clients";
      menu_item_info[3].frame = "contact";
      menu_item_info[4].frame = "about";
      menu_item_info[5].frame = "technologies";
      for (var i = 0; i<num_menu_items; i++) {
      _root.menu_mc.duplicateMovieClip("menu_mc"+i, i);
      _root["menu_mc"+i].movie = menu_item_info
      .movie;
      _root["menu_mc"+i].frame = menu_item_info .frame;
      menu_item_info
      .x = Math.random()*500-250;
      menu_item_info .y = Math.random()*50-25;
      menu_item_info
      .z = Math.random()*500;
      }
      var FarthestItem = -1000000;
      for (var i = 0; i<num_menu_items; i++) {
      if (menu_item_info .z>FarthestItem) {
      FarthestItem = i;
      }
      }
      var origin_x:Number = 300;
      var origin_y:Number = 250;
      var dist:Number = 175;
      var trans:Number = Math.PI/180;
      var translation_inc:Number = 10;
      var translation_x:Number = 0;
      var translation_z:Number = 0;
      var menu_item_size:Number = 75;
      var trans_regulate:Number = 20;
      //var trans_regulate:Number = Math.floor(Math.random() * (100 - 10 + 1) + 10);
      var limit:Number = 0;
      var items_z:Array = new Array(num_menu_items);

      onEnterFrame = function () {
      if (moving == true) {
      translation_x = (origin_x-_root._xmouse)/trans_regulate;
      translation_z = (_root._ymouse-origin_y)/trans_regulate;
      for (var i = 0; i<num_menu_items; i++) {
      tx = menu_item_info
      .x+translation_x;
      tz = menu_item_info .z+translation_z;
      menu_item_info
      .x = tx;
      menu_item_info .z = tz;
      //trace(menu_item_info
      .z);
      if (tz<-dist) {
      _root["menu_mc"+i]._visible = false;
      } else {
      perspective_ratio = dist/(dist+tz);
      perspective_x = origin_x+tx*perspective_ratio;
      perspective_y = origin_y-menu_item_info .y*perspective_ratio;
      perspective_scale = menu_item_size*perspective_ratio;
      if (((perspective_x+perspective_scale)<0) || ((perspective_x-perspective_scale)>origin_x*4)) {
      _root["menu_mc"+i]._visible = false;
      } else {
      _root["menu_mc"+i]._visible = true;
      _root["menu_mc"+i]._x = perspective_x;
      _root["menu_mc"+i]._y = perspective_y;
      _root["menu_mc"+i]._xscale = _root["menu_mc"+i]._yscale=perspective_scale;
      _root["menu_mc"+i].swapDepths(-tz);
      }
      }
      }
      if (_ymouse<300) {
      spin1_mc._rotation--;
      spin2_mc._rotation++;
      } else {
      spin1_mc._rotation++;
      spin2_mc._rotation--;
      }
      }
      };


      any help, tahnx