1 Reply Latest reply on Jan 3, 2007 3:46 PM by kglad

    Unwanted movieclip rotation

    bcraigie
      Not sure if this is a bug or what, but I've a bit of flash with two buttons for going up and down a list of movieclips, 4 of which are displayed on screen at one time.

      When I click the Down button, it scrolls the list by doing a loadClip() to re-load each clip at its new position, and bring in new clips as the old ones "scroll" out of sight. It also loads other mc's related to the top clip in the list.

      Under normal circumstances this works fine, but if a mad user (or tester) repeatedly clicks quickly on the Down button, some of the images acquire a 90-degree rotation (evidenced by tracing the value of movieclip._rotation).
      Weird, because I'm not setting rotation anywhere at all. I guess it's something to do with multiple loadClips on the same mc before it is finished the previous load. Not quite sure how to handle this properly.

      I put in a delay on the button (using setInterval) so that once clicked, it could not be clicked again for a further second or so, which helps to reduce the problem, but I wonder if there is a way to properly block a loadClip if one is already in progress for the same movieClip. Because the loadClip is asynchronous and the clips are being loaded from a webserver, it makes blocking tricky.

      I thought about cancelling the loadClip in the .onLoadStart() event if the same clip is already loading but not finished, but that would put the scrolling out of sync, so probably what i need to do is disable the Down button until all 4 loadClips have completed using some kind of counter, decremented on each loadclip.

      What would be nicer would be to have Flash do it automatically using a queuing system such that the loadClip events on the same mc are queued up so that one starts only after the prior one finished (or failed).

      Scenario:

      4 Movieclips named mc1 mc2 mc3 mc4 and a cliploader called mcl.

      mcl.loadClip("name1",mc1);
      mcl.loadClip("name2",mc2);
      mcl.loadClip("name3",mc3);
      mcl.loadClip("name4",mc4);

      Ok, this is fine,
      But if it so happens that this occurs because the user clicks too quickly...

      mcl.loadClip("name3",mc3);
      mcl.loadClip("name4",mc3);

      Then things get confused because two different clips are trying to be loaded into the same movieclip (mc3) almost simultaneously.

      The worrying thing is sometimes it is a different mc than the one being loaded that is rotated by 90 degrees. Hmmm...

      One time I also got a "security violation ... out of sandbox " error (something like that) in the trace window suggesting some memory overlflowed somewhere.

      My question is, has anyone encountered this before, and why should it only be the rotation that is affected?

      Brian