Code:
import flash.filters.DropShadowFilter;
import mx.transitions.easing.*;
// variables ------------------------------------------
this.pathToPics = "images/";
var pArray:Array = new Array( new Array("Cat 1", new array("img1.jpg","txt1"),new Array("img2.jpg","txt2")),
new Array("Cat 2", new Array("img3.jpg","txt3"),
new Array("img4.jpg","txt4")),
new Array("Cat 3", new Array("img5.jpg","txt5"),
new Array("img6.jpg", "txt6")),
new Array("Cat 4", new Array("img7.jpg","txt7"),
new Array("img8.jpg","txt8")));
this.viewtime = 5;
this.slidespeed = 25;
this.pIndex = 1;
var intervalId:Number;
var headtxt_mc:MovieClip = _root.createEmptyMovieClip('headtxt_mc',10);
this.headtxt_mc.createTextField("headtxt", 1,10,10,700,150);
// create filters
var dropShadow:DropShadowFilter = new DropShadowFilter(4, 45, 0x000000, 0.8, 10, 10, 2, 3);
// create text formats
var headformat:TextFormat = new TextFormat();
headformat.font = "Tahoma";
headformat.size = 34;
headformat.bold = true;
headformat.color = 0x1CB065;
headformat.align = "center"
this.headtxt_mc.headtxt.setNewTextFormat(headforma t);
this.flm_back0_mc.slide1_mc.pic1_mc.loadMovie(this .pathToPics+this.pArray[0][1][0]);
this.flm_back0_mc.slide2_mc.pic2_mc.loadMovie(this .pathToPics+this.pArray[0][2][0]);
this.flm_back0_mc.slide1_mc.pictxt1_mc.captiontxt1 .text = this.pArray[0][1][1];
this.flm_back0_mc.slide1_mc.pictxt1_mc.captiontxt1 .filters = [dropShadow];
this.flm_back0_mc.slide2_mc.pictxt2_mc.captiontxt2 .text = this.pArray[0][2][1];
this.flm_back0_mc.slide2_mc.pictxt2_mc.captiontxt2 .filters = [dropShadow];
this.headtxt_mc.headtxt.text = this.pArray[0][0];
this.flm_back0_mc.duplicateMovieClip("flm_back1_mc", this.pIndex+10);
this["flm_back1_mc"]._x = -740;
intervalId = setInterval(this, "tween", this.viewtime*1000);
// MovieClip methods ----------------------------------
MovieClip.prototype.tween = function() {
this.pIndex ++;
tweenin = new mx.transitions.Tween(this["flm_back"+this.pIndex+"_mc"], "_x", mx.transitions.easing.Regular.easeIn, -740, 0, 1, true);
this.changePhoto();
}
MovieClip.prototype.changePhoto = function() {
// make sure pIndex falls within pArray.length
if (this.pIndex < this.pArray.length) {
if(this["flm_back"+this.pIndex+"_mc"] == undefined){
this.flm_back0_mc.duplicateMovieClip("flm_back"+this.pIndex+"_mc", this.pIndex+10);
this["flm_back"+this.pIndex+"_mc"]._x = -730;
this.loadPhoto();
if(this["flm_back"+(this.pIndex-1)+"_mc"] != undefined){
tweenout = new mx.transitions.Tween(this["flm_back"+(this.pIndex-1)+"_mc"], "_x", mx.transitions.easing.Regular.easeInOut, 0, 740, 1, true);
}
}else{
this["flm_back"+this.pIndex+"_mc"]._x = -730;
this.headtxt_mc.headtxt.text = this.pArray[this.pIndex][0];
}
}else{
this.pIndex = 0;
this["flm_back"+this.pIndex+"_mc"]._x = -710;
this.headtxt_mc.headtxt.text = this.pArray[this.pIndex][0];
}
};
MovieClip.prototype.loadPhoto = function() {
// specify the movieclip to load images into
this["flm_back"+this.pIndex+"_mc"].slide1_mc.pic1_mc.loadMovie(this.pathToPics+this. pArray[this.pIndex][1][0]);
this["flm_back"+this.pIndex+"_mc"].slide2_mc.pic2_mc.loadMovie(this.pathToPics+this. pArray[this.pIndex][2][0]);
this.onEnterFrame = loadMeter;
this["flm_back"+this.pIndex+"_mc"].slide1_mc.pictxt1_mc.captiontxt1.text = this.pArray[this.pIndex][1][1];
this["flm_back"+this.pIndex+"_mc"].slide2_mc.pictxt2_mc.captiontxt2.text = this.pArray[this.pIndex][2][1];
this.headtxt_mc.headtxt.text = this.pArray[this.pIndex][0];
}
MovieClip.prototype.loadMeter = function() {
var l, t, r, s;
l = this["flm_back"+this.pIndex+"_mc"].slide1_mc.pic1_mc.getBytesLoaded();
t = this["flm_back"+this.pIndex+"_mc"].slide1_mc.pic1_mc.getBytesTotal();
r = this["flm_back"+this.pIndex+"_mc"].slide2_mc.pic2_mc.getBytesLoaded();
s = this["flm_back"+this.pIndex+"_mc"].slide2_mc.pic2_mc.getBytesTotal();
if ((t>0 && t == l) && (s>0 && s == r)) {
this.onEnterFrame = null;
} else {
trace(l/t);
}
};
I seem to be having problems with transitioning the slides in then pausing and then transitioning them out bringing in the next slide simultaniously.
Bookmarks