0 Replies Latest reply on Oct 29, 2009 1:47 PM by Ginger85

    Audio clips cutting off at the beginning, after replacing audio.

    Ginger85

      I have received an fla for a complex game, and have been directly replacing the audio clips in it with new ones with the same file name. The game randomly chooses themes, displaying text and a corresponding audio clip.  After replacing the old files with the new ones, out of 20 audio clips, about 6 of them get cut off at the beginning. There is no discernible difference in the length of the clips, or empty space at the beginning between the original audio files and the new ones.

       

      Is it possible that there is something happening in the actionscript that could be causing the problem? The fla calls a file calls Themes.as, this is the code in the file, case the answer is in there somewhere:

       

      import utils.Randomise;

      //

      class com.tt.games.newsfinder.Themes{

       

      //AVAILABLE THEMES

      public static var THEME_1:String = "sports";

      public static var THEME_2:String = "music";

      public static var THEME_3:String = "pets";

      public static var THEME_4:String = "flying";

      public static var THEME_5:String = "new teeth";

      public static var THEME_6:String = "hats";

      public static var THEME_7:String = "bikes";

      public static var THEME_8:String = "swimming";

      public static var THEME_9:String = "zoos";

      public static var THEME_10:String = "shoes";

      public static var THEME_11:String = "bedtime stories";

      public static var THEME_12:String = "moving house";

      public static var THEME_13:String = "cleaning your teeth";

      public static var THEME_14:String = "films";

      public static var THEME_15:String = "painting and drawing";

      public static var THEME_16:String = "food";

      public static var THEME_17:String = "drinks";

      public static var THEME_18:String = "the seaside";

      public static var THEME_19:String = "trees";

      public static var THEME_20:String = "boats";

       

      //SELECTED THEM

      public static var CURRENT_THEME:String;

       

      //FRAME LABELS FOR ANT NEWS TOPICS

      public static var TOPICS_SPORT:Array = ["football","cricket","tennis","balls","bowling"];

      public static var TOPICS_MUSIC:Array = ["guitar","recorder","notes"];

      public static var TOPICS_PETS:Array = ["fish","hamster","dog","rabbit","mouse"];

      public static var TOPICS_FLYING:Array = ["plane_green","plane_yellow","plane_small"];

      public static var TOPICS_NEW_TEETH:Array = ["teeth"];

      public static var TOPICS_HATS:Array = ["hat1","hat2","hat3"];

      public static var TOPICS_BIKES:Array = ["bike1","bike2","bike3"];

      public static var TOPICS_SWIMMING:Array = ["goggles","flippers","rubber_ring"];

      public static var TOPICS_ZOO:Array = ["octopus","monkey","snake","dolphin"];

      public static var TOPICS_SHOES:Array = ["shoes1","shoes2","shoes3"];

      public static var TOPICS_BOOKS:Array = ["book1","book2","book3"];

      public static var TOPICS_MOVING:Array = ["box1","box2","box3"];

      public static var TOPICS_CLEANING_TEETH:Array = ["toothpaste"];

      public static var TOPICS_FILM:Array = ["projector","camera"];

      public static var TOPICS_DRAWING:Array = ["pencil"];

      public static var TOPICS_FOOD:Array = ["cake"];

      public static var TOPICS_DRINK:Array = ["tea_pot","cups"];

      public static var TOPICS_SEASIDE:Array = ["sandcastle","bucket","spade","crabs"];

      public static var TOPICS_TREES:Array = ["tree1","tree2","tree3"];

      public static var TOPICS_BOATS:Array = ["boat1","boat2","boat3"];

       

       

      /*

      *

      */

      public static function fGetTopicsByTheme(p_nLength:Number):Array{

      var l_aTopics:Array = new Array();

      var l_aChosen:Array = new Array();

      switch(CURRENT_THEME){

      case THEME_1: l_aTopics = TOPICS_SPORT.slice(); break;

      case THEME_2: l_aTopics = TOPICS_MUSIC.slice(); break;

      case THEME_3: l_aTopics = TOPICS_PETS.slice(); break;

      case THEME_4: l_aTopics = TOPICS_FLYING.slice(); break;

      case THEME_5: l_aTopics = TOPICS_NEW_TEETH.slice(); break;

      case THEME_6: l_aTopics = TOPICS_HATS.slice(); break;

      case THEME_7: l_aTopics = TOPICS_BIKES.slice(); break;

      case THEME_8: l_aTopics = TOPICS_SWIMMING.slice(); break;

      case THEME_9: l_aTopics = TOPICS_ZOO.slice(); break;

      case THEME_10: l_aTopics = TOPICS_SHOES.slice(); break;

      case THEME_11: l_aTopics = TOPICS_BOOKS.slice(); break;

      case THEME_12: l_aTopics = TOPICS_MOVING.slice(); break;

      case THEME_13: l_aTopics = TOPICS_CLEANING_TEETH.slice(); break;

      case THEME_14: l_aTopics = TOPICS_FILM.slice(); break;

      case THEME_15: l_aTopics = TOPICS_DRAWING.slice(); break;

      case THEME_16: l_aTopics = TOPICS_FOOD.slice(); break;

      case THEME_17: l_aTopics = TOPICS_DRINK.slice(); break;

      case THEME_18: l_aTopics = TOPICS_SEASIDE.slice(); break;

      case THEME_19: l_aTopics = TOPICS_TREES.slice(); break;

      case THEME_20: l_aTopics = TOPICS_BOATS.slice(); break;

      }

       

      if(l_aTopics.length < p_nLength){

      //make it long enough!

      var l_nDif:Number = p_nLength - l_aTopics.length;

      for(var i:Number = 0; i< l_nDif; i++){

      //add the list itself, in case its length is 1!

      l_aTopics = l_aTopics.concat(l_aTopics);

      }

       

       

      }

      //now trim it

      l_aChosen = l_aTopics.slice(0,p_nLength);

       

      return l_aChosen;

      }

       

      /*

      * get a random selection of topics of a fixed length, not including those from the chosen theme

      */

      public static function fGetRandomTopics(p_nItems:Number):Array{

      var l_aTopics:Array = new Array();

      if(CURRENT_THEME != THEME_1) l_aTopics = l_aTopics.concat(TOPICS_SPORT);

      if(CURRENT_THEME != THEME_2) l_aTopics = l_aTopics.concat(TOPICS_MUSIC);

      if(CURRENT_THEME != THEME_3) l_aTopics = l_aTopics.concat(TOPICS_PETS);

      if(CURRENT_THEME != THEME_4) l_aTopics = l_aTopics.concat(TOPICS_FLYING);

      if(CURRENT_THEME != THEME_5) l_aTopics = l_aTopics.concat(TOPICS_NEW_TEETH);

      if(CURRENT_THEME != THEME_6) l_aTopics = l_aTopics.concat(TOPICS_HATS);

      if(CURRENT_THEME != THEME_7) l_aTopics = l_aTopics.concat(TOPICS_BIKES);

      if(CURRENT_THEME != THEME_8) l_aTopics = l_aTopics.concat(TOPICS_SWIMMING);

      if(CURRENT_THEME != THEME_9) l_aTopics = l_aTopics.concat(TOPICS_ZOO);

      if(CURRENT_THEME != THEME_10) l_aTopics = l_aTopics.concat(TOPICS_SHOES);

      if(CURRENT_THEME != THEME_11) l_aTopics = l_aTopics.concat(TOPICS_BOOKS);

      if(CURRENT_THEME != THEME_12) l_aTopics = l_aTopics.concat(TOPICS_MOVING);

      if(CURRENT_THEME != THEME_13) l_aTopics = l_aTopics.concat(TOPICS_CLEANING_TEETH);

      if(CURRENT_THEME != THEME_14) l_aTopics = l_aTopics.concat(TOPICS_FILM);

      if(CURRENT_THEME != THEME_15) l_aTopics = l_aTopics.concat(TOPICS_DRAWING);

      if(CURRENT_THEME != THEME_16) l_aTopics = l_aTopics.concat(TOPICS_FOOD);

      if(CURRENT_THEME != THEME_17) l_aTopics = l_aTopics.concat(TOPICS_DRINK);

      if(CURRENT_THEME != THEME_18) l_aTopics = l_aTopics.concat(TOPICS_SEASIDE);

      if(CURRENT_THEME != THEME_19) l_aTopics = l_aTopics.concat(TOPICS_TREES);

      if(CURRENT_THEME != THEME_20) l_aTopics = l_aTopics.concat(TOPICS_BOATS);

       

      l_aTopics = Randomise.fRandomise(l_aTopics);

       

      return l_aTopics.slice(0,p_nItems);

      }

       

      /*

      *

      */

      public static function fGetThemeByTopic(p_sTopic:String):String{

      if(fIsInList(p_sTopic,TOPICS_SPORT)) return THEME_1;

      if(fIsInList(p_sTopic,TOPICS_MUSIC)) return THEME_2;

      if(fIsInList(p_sTopic,TOPICS_PETS)) return THEME_3;

      if(fIsInList(p_sTopic,TOPICS_FLYING)) return THEME_4;

      if(fIsInList(p_sTopic,TOPICS_NEW_TEETH)) return THEME_5;

      if(fIsInList(p_sTopic,TOPICS_HATS)) return THEME_6;

      if(fIsInList(p_sTopic,TOPICS_BIKES)) return THEME_7;

      if(fIsInList(p_sTopic,TOPICS_SWIMMING)) return THEME_8;

      if(fIsInList(p_sTopic,TOPICS_ZOO)) return THEME_9;

      if(fIsInList(p_sTopic,TOPICS_SHOES)) return THEME_10;

      if(fIsInList(p_sTopic,TOPICS_BOOKS)) return THEME_11;

      if(fIsInList(p_sTopic,TOPICS_MOVING)) return THEME_12;

      if(fIsInList(p_sTopic,TOPICS_CLEANING_TEETH)) return THEME_13;

      if(fIsInList(p_sTopic,TOPICS_FILM)) return THEME_14;

      if(fIsInList(p_sTopic,TOPICS_DRAWING)) return THEME_15;

      if(fIsInList(p_sTopic,TOPICS_FOOD)) return THEME_16;

      if(fIsInList(p_sTopic,TOPICS_DRINK)) return THEME_17;

      if(fIsInList(p_sTopic,TOPICS_SEASIDE)) return THEME_18;

      if(fIsInList(p_sTopic,TOPICS_TREES)) return THEME_19;

      if(fIsInList(p_sTopic,TOPICS_BOATS)) return THEME_20;

      return "";

      }

       

      /*

      *

      */

      private static function fIsInList(p_s:String,p_aList:Array):Boolean{

      var l_n:Number = p_aList.length;

      var l_b:Boolean = false;

      for(var i:Number = 0; i < l_n;i++){

      if(p_aList[i] == p_s){

      //trace("!!! ** match >> " + p_aList[i] + " matches " + p_s);

      l_b = true;

      break;

      }

      }

      return l_b;

      }

       

      /*

      *

      */

      public static function fRandomTheme():String{

       

      var l_aThemes:Array = [THEME_1,

      THEME_2,

      THEME_3,

      THEME_4,

      THEME_5,

      THEME_6,

      THEME_7,

      THEME_8,

      THEME_9,

      //THEME_10, << removed the shoes topic as we didn't have the audio for it!

      THEME_11,

      THEME_12,

      THEME_13,

      THEME_14,

      THEME_15,

      THEME_16,

      THEME_17,

      THEME_18,

      THEME_19,

      THEME_20

      ];

       

      var l_s:String = String(Randomise.fPickRandom(l_aThemes));

       

      CURRENT_THEME = l_s;

      return l_s;

      }

       

      /*

      *

      */

      public static function fGetHeader(p_n:Number):String{

      var l_sHeader:String = "Can you find " + p_n + " people who ";

      l_sHeader += fGetActivity();

      l_sHeader += "?";

      return l_sHeader;

      }

       

      /*

      *

      */

      public static function fGetEndTxt(p_n:Number):String{

      var l_sTxt:String = "That's brilli-Ant! You found " + p_n + " people who ";

      l_sTxt += fGetActivity();

      l_sTxt += "!";

      return l_sTxt;

      }

       

      /*

      *

      */

      public static function fGetActivity():String{

      var l_sHeader:String ="";

      switch(CURRENT_THEME){

      case THEME_1: l_sHeader += "played sports today"; break;

       

      case THEME_2: l_sHeader += "are learning a musical instrument"; break;

       

      case THEME_3: l_sHeader += "have a new pet"; break;

       

      case THEME_4: l_sHeader += "have been flying"; break;

       

      case THEME_5: l_sHeader += "have lost a tooth"; break;

       

      case THEME_6: l_sHeader += "are wearing a hat"; break;

       

      case THEME_7: l_sHeader += "can ride a bike"; break;

       

      case THEME_8: l_sHeader += "went swimming"; break;

       

      case THEME_9: l_sHeader += "went to the zoo"; break;

       

      case THEME_10: l_sHeader += "have new shoes"; break;

       

      case THEME_11: l_sHeader += "read a book"; break;

       

      case THEME_12: l_sHeader += "are moving house"; break;

       

      case THEME_13: l_sHeader += "cleaned their own teeth"; break;

       

      case THEME_14: l_sHeader += "watched a film"; break;

       

      case THEME_15: l_sHeader += "drew a picture"; break;

       

      case THEME_16: l_sHeader += "baked a cake"; break;

       

      case THEME_17: l_sHeader += "made a cup of tea"; break;

       

      case THEME_18: l_sHeader += "went to the beach"; break;

       

      case THEME_19: l_sHeader += "climbed a tree"; break;

       

      case THEME_20: l_sHeader += "have been in a boat"; break;

       

      }

      return l_sHeader;

      }

       

      /*

      *

      */

      public static function fGetSuggestion():String{

      var l_sTxt:String = ""

      switch(CURRENT_THEME){

      case  THEME_1: l_sTxt = "How many sports can you think of that you play with a ball? How many of them have you played?"; break;

      case  THEME_2: l_sTxt = "Do you know any songs? Why not sing it right now?"; break;

      case  THEME_3: l_sTxt = "How about taking the dog for a walk? You don’t have a dog? Take someone else’s dog for a walk!"; break;

      case  THEME_4: l_sTxt = "Not everyone can go flying, but everyone can fly a kite! Why don’t you make your own kite and see if it flies?"; break;

      case  THEME_5: l_sTxt = "Have you got a wobbly tooth? Don’t forget to put it under your pillow when it falls out!"; break;

      case  THEME_6: l_sTxt = "Does your Mum have a hat? What does it look like on you?"; break;

      case  THEME_7: l_sTxt = "Can your Dad ride a bike? Why don’t you ask him?"; break;

      case  THEME_8: l_sTxt = "Can your Mum swim? Why don’t you ask her?"; break;

      case  THEME_9: l_sTxt = "How many animals can you think of that begin with the letter M? Ask someone else and see who thinks of the most!"; break;

      //case  THEME_10: l_sTxt = "shoes..."; break;

      case  THEME_11: l_sTxt = "What’s your favourite bedtime story? Can you read it to yourself?"; break;

      case  THEME_12: l_sTxt = "Have you ever moved house? Why not ask a grown-up about a time when they moved house?"; break;

      case  THEME_13: l_sTxt = "Have you cleaned your teeth today? I hope so! How many toothbrushes are there in your bathroom?"; break;

      case  THEME_14: l_sTxt = "What was the last film you saw? Do you have a favourite? Ask a grown-up to tell you about their favourite film!"; break;

      case  THEME_15: l_sTxt = "You can draw your news too! Draw a picture of what you did today!"; break;

      case  THEME_16: l_sTxt = "Have you ever baked a cake? Cooking can be fun - and if you make something delicious, that’s definitely news!"; break;

      case  THEME_17: l_sTxt = "Fruits make great drinks. How many different fruits can you think of that you can drink?"; break;

      case  THEME_18: l_sTxt = "You can do lots of different things at the beach. How many different things can you think of?"; break;

      case  THEME_19: l_sTxt = "Can you see any trees outside the nearest window? How many can you see?"; break;

      case  THEME_20: l_sTxt = "Why don’t you make your own boat and see if it floats in the bath?"; break;

      }

      return l_sTxt;

      }

       

      }

       

       

      Any help would be extremely appreciated.

       

      Thank you,

       

      Ginger