Hey guys,
I have an animated header that does some initial animations and then when that stops i want to start some action script using an xml file to make the header start to rotate transitions continuously.
I found some actionscript that does the transitions with the xml file but it is the kind where it’s in an external .as file and the fla uses the document class to reference to it. this will not work for me because i want to do some other animations on the header first and THEN start the transitioning.
My question is, can the actionscript in the package be modified so i can just drop it in an action layer in a keyframe at the end of my .fla so that it will just transition after the opening animations that i have using timelines and tweens etc? I also want the animations to continue to loop but not start the whole video over again from the opening animations.
here is the script
package {
import flash.display.MovieClip;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.display.Loader;
import flash.utils.Timer;
import flash.events.Event;
import flash.events.TimerEvent;
import fl.transitions.Tween;
import fl.transitions.easing.*;
public class Photos extends MovieClip {
var xml:XML;
var urlLoader:URLLoader;
var photos:XMLList;
var photoLoader:Loader;
var photoArray:Array;
var fadePhotos:Tween;
var currentPhoto:Number;
var timer:Timer;
public function Photos():void {
urlLoader=new URLLoader ;
urlLoader.load(new URLRequest("insert path to xml file here"));
urlLoader.addEventListener(Event.COMPLETE, onComplete);
photoArray=new Array ;
currentPhoto=0;
timer=new Timer(5000);
timer.addEventListener(TimerEvent.TIMER, nextPhoto);
}
private function onComplete(event:Event):void {
xml=new XML(event.target.data);
photos=new XMLList(xml.image);
for (var i:int=0; i < photos.length(); i++) {
photoArray.push(photos*.@src);
}
timer.start();
nextPhoto(null);
}
private function nextPhoto(e:TimerEvent):void {
if (currentPhoto < photoArray.length) {
photoLoader=new Loader ;
photoLoader.load(new URLRequest(photoArray[currentPhoto]));
this.addChild(photoLoader);
fadePhotos=new Tween(photoLoader,"alpha",None.easeNone,0,1,2,true);
currentPhoto++;
} else {
currentPhoto=0;
nextPhoto(null);
photoLoader.unload();
}
}
}
}
Thanks all,
any help is appreciated.