FORUMS: list search recent posts

Animation Loop Code

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Cutter Johnston
Animation Loop Code
on Jun 11, 2009 at 11:18:32 am

A while back I was asking how to continuously loop an animation . I did not receive any truly useful relpies. I did come up with a solution that is flexible, expandable and works great. Here is the code:

import fl.video.*;

stop();

var arrayNum:Number = 0;

var videoArray:Array = new Array();
videoArray[0] = "AnimationOfFlyingZits.flv";

var flvControl = playBack;
var flvSource = videoArray[arrayNum];


playBack.pauseButton = pauseBtn;
playBack.playButton = playBtn;
playBack.source = videoArray[arrayNum];

playBack.addEventListener(VideoEvent.COMPLETE, videoComplete);

playBack.source = videoArray[arrayNum];


function videoComplete(event:VideoEvent):void{
//trace(event.target.source);
if(event.target.source == videoArray[0]){
event.target.play();

}

}

The solution is in the EventListener for the playBack and the function below it.

Hope it helps someone with the same issue!

Cutter



Return to posts index

demetri tashie
Re: Animation Loop Code
on Jun 11, 2009 at 12:54:43 pm

hi cutter-
nice solution ! shows good creative thinking.

food for thought: you could do it even more simply, without the bother of the array-

just:

import fl.video.*;

playBack.addEventListener(VideoEvent.COMPLETE, videoComplete);

playBack.source = "YourVideo.flv";

function videoComplete(event:VideoEvent):void{
event.target.play();
}



Return to posts index

Cutter Johnston
Re: Animation Loop Code
on Jun 11, 2009 at 9:28:55 pm

Understood. Actually this a scaled down version of a site that contains 12 animations. I just cut those from the code I posted. Thanks though. I will use this for publishing a single clip.



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]