7 Replies Latest reply on Feb 18, 2010 3:16 PM by Ned Murphy

    Completely Baffled

    FocusLevelX Level 1

      I've attached my code - this is weird!


      My entire flash file is basically 3 rotating ads. When the web page loads, I want the 1st ad displayed to be random. Then it can play till the end, and start over and play normally so:


      Frame 1 in ActionScript I have code to pick a random number 1, 2 or 3. Depending on which it picks, it goes to a certain frame. So if it picks 2, it starts playing with ad# 2...then 3, then back to 1,2,3, etc....at the end of the timeline, I have gotoandplay(2), so it skips the initial code that picks a random frame to start....


      Here's the code on frame 1:


      var frameA:Array=[null,2,471,907];
      function randF(n1:int,n2:int):int{
      var ul:int = Math.max(n1,n2);
      var ll:int = Math.min(n1,n2);
      return Math.floor(Math.random()*(ul-ll+1))+ll;
      var Where:uint = randF(1,3);


      Here's the problem - if the random code picks 1 or 2, it works as expected. However, if it picks 3, it correctly traces "907", but it appears to actually start playing around 895 - so you end up seeing the very tail end of ad#2 - which I don't want. I've even increased 907 to 950, and the same thing happens!


      I've attached my FLA file....if anyone can help, I'd sure appreciate it - this is driving me crazy.