Skip navigation
Currently Being Moderated

AS2 code for movie clip array w/ loop

Apr 11, 2012 11:15 AM

Hi everyone.  I'm working on this for my job, and I've hit a wall.  I want to have an array that loops my movie clips.  However, there also needs to be the ability for the loop to stop and play a specific movie clip when a specific thumbnail that corresponds to that clip is clicked on.  Then, when that movie is done playing, the array is accessed again and the array continues once again, also looping.  I don't even know if this is possible.

 

I set up something that worked in Flash Catalyst, but the only problem is that FC doesn't have the ability to have a fullscreen button in it for the document.  I need to be able to have the entire document go fullscreen when a button is pressed.  If anyone knows of an easier way to do that, that would also be a good answer.  Code for above or an easier way to do all of this with a fullscreen button would be great and very much appreciated!   I do not have Flash Builder.

 

Here is the code I'm using so far:

 

var currentSwf:Number = 0;
var swfs:Array = new Array("StandFiles/SmartStand.swf", "StandFiles/Intro.swf");

 

var listener:Object = new Object();
var mcl:MovieClipLoader = new MovieClipLoader();
mcl.addListener(listener);

 

   // When the swf loads, set it up to constantly check its current frame
// against the total frames, and if those match, the swf is done playing.
// If that's the case, then load the next one.

 

listener.onLoadInit = function(targ:MovieClip):Void {
   targ.onEnterFrame = function():Void {
      if (this._currentframe == this._totalframes) {
         loadNext();
         delete this.onEnterFrame;
      }
   }
}

var i = 1;

while (i < 5){

trace ("This code is repeated");

i++;

}

 

//Previous and Next Swf Buttons

 

function loadNext():Void {

 

if (currentSwf <swfs.length-1){

  currentSwf++;

loadSWF(currentSwf);

}

}

 

 

function loadSWF(nextSWFToLoad){

   mcl.loadClip(swfs[nextSWFToLoad],theTargetClip_mc);

}

 

 

loadSWF(currentSwf);

 

 

function loadPrevious():Void{

   currentSwf--;

   if(currentSwf==-1) currentSwf = swfs.length-1;

   loadSWF(currentSwf);

}

 

 

previous_btn.onRelease = loadPrevious;

next_btn.onRelease = loadNext;

 

//End Previous and Next Swf Buttons

 

 

//Play Button

 

play_btn.onRelease = function() {

theTargetClip_mc.play();

}

 

//Pause Button

 

pause_btn.onRelease = function() {

theTargetClip_mc.stop();

}

 
Replies
  • kglad
    72,235 posts
    Jul 21, 2002
    Currently Being Moderated
    Apr 14, 2012 4:02 PM   in reply to Cuwen

    you probably won't get any response there, either.

     

    i checked your message one or two days ago and passed on it because your code is so poorly formatted it is difficult to read.  i notice that there have been over 60 views of your message and noone else responded, either.  my guess is most of them felt like me about your code formatting.

     

    hopefully, your code is properly formatted in whatever app you use to code.  if so, you can then use control-c, control-v (pc) to copy and paste to this forum.  mac has similar shortcuts.  if your code looks that way in the app you're using, format your code.

     

    p.s.  your lack of formatting makes it look like there are unrelated bits of code in your message.  and, to be sure, some parts are unrelated to anything like:

     

    var i = 1;

    while (i < 5){

    trace ("This code is repeated");

    i++;

    }

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points