0 Replies Latest reply on Oct 28, 2006 11:27 AM by aezat

    make stars on the stage

    aezat
      Hai all, what i need to do is to make MCs zoomed in and out and when you zoom in it large and at point it disappear and view again as small size from faraway, i make it array and call it and draw the shapes its 6 MCs, but the problem it make it once not vise versa(what i mean if you first zoom out it stop and dont disappear and when you zoom in it large and disappear and appear again but if you zoomed out again it stopped and vise versa)
      here is the 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.floor(Math.random()*1000-100);
      menu_item_info .y = Math.floor(Math.random()*100-10);
      menu_item_info
      .z = Math.floor(Math.random()*1000);
      }
      //
      //var limit = 0;
      var FarthestItem = -1000000;
      for (var i = 0; i<num_menu_items; i++) {
      if (menu_item_info .z>FarthestItem) {
      FarthestItem = i;
      }
      }
      var NearstItem = 10000;
      for (var i = 0; i<num_menu_items; i++) {
      if (menu_item_info
      .z<NearstItem) {
      NearstItem = i;
      //trace(NearstItem);
      }
      }
      var limit = 0;
      var limit2 = 0;
      var origin_x:Number = 175;
      var origin_y:Number = 200;
      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 items_z:Array = new Array(num_menu_items);
      var items_n: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;
      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);
      }
      }
      }
      //here is the problem with me
      if (menu_item_info[FarthestItem].z>=1300) {
      if (limit != 1) {
      if (menu_item_info[FarthestItem].z<=-10) {
      for (var i = 0; i<num_menu_items; i++) {
      items_z
      = menu_item_info .z;
      //trace(items_z[5]);
      }
      }
      limit = 1;
      } else {
      for (var i = 0; i<num_menu_items; i++) {
      menu_item_info
      .z = items_z ;

      }
      }trace(menu_item_info[5].z);
      }
      if (menu_item_info[FarthestItem].z<=-10) {
      if (limit2 != 1) {
      if (menu_item_info[FarthestItem].z>=1300) {
      for (var i = 0; i<num_menu_items; i++) {
      items_n
      = menu_item_info .z;
      trace(items_n[5]);
      }
      }
      limit2 = 1;
      } else {
      for (var i = 0; i<num_menu_items; i++) {
      menu_item_info
      .z = items_n ;
      //trace(menu_item_info[5].z);
      }
      }
      }
      }
      };

      i know its hardful and it make me crazy, but any help i will be approtiate for that

      many thanx and best regards