3 Replies Latest reply on Jul 4, 2006 8:52 AM by DazFaz

    how to automatically link 2 scenes

    m2ming
      hi, i am facing problem in using actionscript because i am a beginner. i am creating a game where i need my users to find 7hidden items from scene1, after they get all the 7 items it will automatically link to the scene2 which is the 'game over' scene.
      I created those 7 items as buttons, should it be any problem for me to adding any action script. Thanks.
        • 1. Re: how to automatically link 2 scenes
          DazFaz Level 1
          //on Each of the hidden object buttons place within the "press" actions, one of the array declarations e.g. on item one _global.intem1 = "found"
          var hiddenObjects:Array = new Array ("_global.item1", "_global.item2", "_global.item3", "_global.item4", "_global.item5", "_global.item6", "_global.item7");
          var MyHiddenCounter:Object = new Object ();
          var foundArray:Array = new Array()
          MyHiddenCounter.onMouseUp = function () {
          for (var i = 0; i < hiddenObjects.length; i++) {
          trace(hiddenObjects )
          if (eval(hiddenObjects
          ) == "found") {
          foundArray = "1";
          } else {
          foundArray
          = "0";
          }
          }
          trace(foundArray.toString())
          if (foundArray.toString () == "1,1,1,1,1,1,1") {//All items found then
          trace("All found");
          gotoAndStop("MyGameOver",1);
          }else{
          trace("NOT All found");
          }
          };
          Mouse.addListener (MyHiddenCounter);
          • 2. Re: how to automatically link 2 scenes
            m2ming Level 1
            thank you so much! i will try out this action script. :)
            • 3. Re: how to automatically link 2 scenes
              DazFaz Level 1
              You are welcome.