5 Replies Latest reply on Feb 11, 2007 10:09 AM by kglad

    Bugging Array by using COMBO BOX component !!!


      Today, I create a flash with Array. I did use prototype method to add one more fantastic function to sort the array randomly. But when I include one combo box component with static value in to the parent file, I have a big trouble. The flash file stop running & give the alert of endless looping. Ah ha, what a funny thing is happened out there?

      If you want to produce this bug, please follow me.

      Step1: Create 1 flash movie & name it "test.fla". Copy the code below into the first frame.
      //---------------------------------------------------------------------------------------- ---------------------------
      Array.prototype.randomSort = function():Array {
      var arr1:Array = this;
      var arr2:Array = new Array();
      var rand:Number;
      while (arr1.length>0) {
      rand = Math.floor(Math.random()*arr1.length);
      if (rand == 1 && arr1.length == 1) {
      rand = 0;
      arr1.splice(rand, 1);
      return arr2;
      //---------------------------------------------------------------------------------------- ---------------------------

      Step2: Export the movie by Ctrl+Enter -> we will have test.swf huh?

      Step3: Create another flash & name it "main.fla".

      Step4: In main.fla, create an empty movieclip symbol & name it loader_mc. Drag it to the stage & five the instance name "XXXloader_mc" for example.

      Step5: In main.fla, Drag one combo box component to the stage & add some data to the combo

      Step6: In the first frame of main.fla, load the test movie into XXXloader_mc. Try this

      Step7: Export main.fla. Ctrl+Enter again.

      Congratulation, you are in the problem.