Hello, we have a loop and inside another loop to create a small slideshow of 3 images, so the Main loop creates 3 movieclips and each movieclip has a slideshow of 3 images. The problem is that the slideshows (internal loop) runs only on the last movieclip (like jumping the first 2 movieclips)…
thanks in advance.
//fill arrays with attrbute data
expose_attr_text = MovieClip(this.parent)._attr_text.split(",");//fill the array with the String variable data
var total_text_normal_style2 = expose_attr_text.length;//count the length
//fill array variable with small icons enable/disable from playlist
expose_attr_small_icons = MovieClip(this.parent)._attr_small_icons.split(",");
//load the image
var ImgWidth_b_style_2:Number = 422;//keep aspect ratio variable
var ImgHeight_b_style_2:Number = 352;//keep aspect ratio variable
var k_b_style_2:Number;//keep aspect ratio variable
var find_the_center_style_2:Number//keep aspect ratio variable
var imgLoader:Loader = new Loader();
var context_style_b:LoaderContext;//security remote URL
//slideshow variables
var the_new_time_for_each_image_style2:Number = MovieClip(this.parent).expose_chart_total_time / 3;//get the total time of the chart and split it to 3
var ret_style2:Function;//IO_ERROR
var index_style2:int;//IO_ERROR
var my_loader_error_style2:Loader;
var my_loaders_array_style2:Array = [];
var my_success_counter_style2:Number = 0;
var my_total_style2 = 3;//total images that the loop will display
var my_slideshow_style2:MovieClip = new MovieClip();
var myInterval_style2:uint;
var my_image_slides_style2:MovieClip = new MovieClip();
var my_time_style2:Number = the_new_time_for_each_image_style2;
var my_image_style2:Loader;
var imgLoader_style2:Loader;
var my_playback_counter_style2b:Number = 0;
var addedon_movieclip:Boolean = false;
//loop
for (var yybbm2:int = 0; yybbm2 < 3; yybbm2++) {
try{
var yybbm = MovieClip(this.parent)._listeLoaderObject.getCounterPosition;
} catch (e:Error) { }
try{
MovieClip(this.parent)._listeLoaderObject.setConsoleLog = "Counterposition: " + yybbm;
} catch (e:Error) { }
///////////////////////////////////////////////////////////////////////////////////
//PROPERTY MC//////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
//filter shadow
var dropShadow_b:DropShadowFilter = new DropShadowFilter();
dropShadow_b.distance = 0;
dropShadow_b.angle = 45;
dropShadow_b.color = 0x333333;
dropShadow_b.alpha = 1;
dropShadow_b.blurX = 5;
dropShadow_b.blurY = 5;
dropShadow_b.strength = 1;
dropShadow_b.quality = 15;
dropShadow_b.inner = false;
dropShadow_b.knockout = false;
dropShadow_b.hideObject = false;
//create the MovieClip
var property_mcb:MovieClip = new MovieClip();
property_mcb.graphics.beginFill(the_color_5_new5);
property_mcb.graphics.drawRoundRect(0, 0, 433, 646, 25, 25);
property_mcb.graphics.endFill();
property_mcb.name = "propertie_item" + yybbm;
//property_mcb.cacheAsBitmap =true;
property_mcb.x = 3 + (yybbm2 % 3) * 475;
property_mcb.y = Math.floor(yybbm2 / 3) * 665;
property_mcb.filters = new Array(dropShadow_b);//add the shadow
//border
property_mcb.graphics.lineStyle( 4, 0xFFFFFF );
property_mcb.graphics.drawRoundRect( 0, 0, property_mcb.width + 1, property_mcb.height + 1 , 25, 25);
property_mcb.graphics.endFill();
//add sub MovieClip
var property_mc_sub:MovieClip = new MovieClip();
property_mc_sub.graphics.beginFill(0xFFFFFF);
property_mc_sub.graphics.drawRoundRect(8, 50, 418, 589, 25, 25);
property_mc_sub.graphics.endFill();
property_mcb.addChild(property_mc_sub);//add the MovieClip
//build the mask
var roundRect_mask:MovieClip = new MovieClip();
roundRect_mask.graphics.beginFill(0xFFFFFF);
roundRect_mask.graphics.drawRoundRectComplex(7, 50, 419, 350, 15, 15, 0, 0);
property_mcb.addChild(roundRect_mask);//add image to stage
//security remote URL
if(Security.sandboxType == Security.REMOTE) {//load remote URL
context_style_b = new LoaderContext();
context_style_b.securityDomain = SecurityDomain.currentDomain;
}
//trace Images in Console
//MovieClip(this.parent)._listeLoaderObject.setConsoleLog = "Image: " + MovieClip(this.parent)._listeLoaderObject.getObjektImages[yybbm];
//Slideshow
for (var yy_style2:Number = 0; yy_style2 < my_total_style2; yy_style2++) {
MovieClip(this.parent)._listeLoaderObject.setConsoleLog = "IMG- " + yy_style2 + ' :' + MovieClip(this.parent)._listeLoaderObject.getObjektImages[yybbm][yy_style2]
//load the images
imgLoader_style2 = new Loader();
imgLoader_style2.load(new URLRequest(MovieClip(this.parent)._listeLoaderObject.getObjektImages[yybbm][yy_style2]), context_style_b);
imgLoader_style2.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete_style2);
imgLoader_style2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandlera_style2(yy_style2));//(yy_style2) = this value comes from the looper
function errorHandlera_style2(index_style2:int):Function {
ret_style2 = function(e:IOErrorEvent):void {
//on IO_ERROR replace the image by the position in array
my_loader_error_style2 = new Loader();
my_loader_error_style2.load(new URLRequest('images/dummy_propertie.png' + do_not_cache_sub));
my_loader_error_style2.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete_style2);
my_loaders_array_style2.splice(index_style2, 1, my_loader_error_style2);//replace item by the index position
}
return ret_style2;
}
my_loaders_array_style2.push(imgLoader_style2);
}
function onComplete_style2(e:Event):void {
my_success_counter_style2++;
if (my_success_counter_style2 == my_total_style2) {
startShow_style2();
}
var bit_style2:Bitmap = e.target.content;
//bit_style2.smoothing = true;
var my_loaderInfo_style2:LoaderInfo = LoaderInfo(e.target);
my_loaderInfo_style2.removeEventListener(Event.COMPLETE, onComplete_style2);
}
function startShow_style2():void {
property_mcb.addChild(my_slideshow_style2);
my_slideshow_style2.mask = roundRect_mask;
addedon_movieclip = true;
if (addedon_movieclip == true) {
MovieClip(this.parent)._listeLoaderObject.setConsoleLog = "Slideshow on stage: " + yy_style2;
}
//my_slideshow_style2.cacheAsBitmap = true;
my_slideshow_style2.addChild(my_image_slides_style2);
nextChart_style2();
}
function nextChart_style2():void {
//get the values
var clear_interval_style2 = clearInterval(myInterval_style2);//clear the Timer
myInterval_style2 = setInterval(Interval_Listener_style2, my_time_style2 * 1000);//set the new Interval time value
my_image_style2 = Loader(my_loaders_array_style2[my_playback_counter_style2b]);
//positioning
my_image_slides_style2.addChild(my_image_style2);
my_image_style2.visible = false;
my_image_style2.alpha = 0;
my_image_style2.x = 8;
my_image_style2.y = 50;
my_image_style2.mask = roundRect_mask;//mask the image
//TweenLite.to(my_image_style2, 0.5, {autoAlpha:1, ease:Linear.easeNone, overwrite:"none"});
//keep aspect ratio or stretch images
if (keep_the_aspect_filter_internal == 1) {
//stretch
my_image_style2.width = 422;
my_image_style2.height = 352;
//select between (from praesentation.xml value) the effect
if (effe_between_images == 1) {
//fade-in
TweenLite.to(my_image_style2, 0.5, {autoAlpha:1, ease:Linear.easeNone, overwrite:"none"});
} else if (effe_between_images == 2) {
//slide
my_image_style2.alpha = 1;//hide image
my_image_style2.visible = true;//hide image
my_image_style2.x = 8 -600;
my_image_style2.y = 50;
TweenLite.to(my_image_style2, 0.5, {x:8, ease:Cubic.easeOut, overwrite:"none"});//slide in
} else {
//fade-in
TweenLite.to(my_image_style2, 0.5, {autoAlpha:1, ease:Linear.easeNone, overwrite:"none"});
}
} else {//with aspect ratio
//select between (from praesentation.xml value) the effect
if (effe_between_images == 1) {
//fade-in with aspect ratio
k_b_style_2 = ImgHeight_b_style_2 / ImgWidth_b_style_2;
if( my_image_style2.width * k_b_style_2 > my_image_style2.height ){
k_b_style_2 = ImgWidth_b_style_2 / my_image_style2.width;
} else {
k_b_style_2 = ImgHeight_b_style_2 / my_image_style2.height;
}
my_image_style2.width *= k_b_style_2 + 0.1;
my_image_style2.height *= k_b_style_2 + 0.2;
find_the_center_style_2 = 422 - my_image_style2.width;//find the center of each image
my_image_style2.y = 0;//always 0
my_image_style2.x = find_the_center_style_2 / 2;//position to center
TweenLite.to(my_image_style2, 0.5, {autoAlpha:1, ease:Linear.easeNone, overwrite:"none"});
} else if (effe_between_images == 2) {
//slide
my_image_style2.alpha = 1;//hide image
my_image_style2.visible = true;//hide image
my_image_style2.x = 8 -600;
my_image_style2.y = 50;
//fade-in with aspect ratio
k_b_style_2 = ImgHeight_b_style_2 / ImgWidth_b_style_2;
if( my_image_style2.width * k_b_style_2 > my_image_style2.height ){
k_b_style_2 = ImgWidth_b_style_2 / my_image_style2.width;
} else {
k_b_style_2 = ImgHeight_b_style_2 / my_image_style2.height;
}
my_image_style2.width *= k_b_style_2 + 0.1;
my_image_style2.height *= k_b_style_2 + 0.2;
find_the_center_style_2 = 422 - my_image_style2.width;//find the center of each image
my_image_style2.y = 0;//always 0
//e.target.content.x = find_the_center_style_2 / 2;//position to center
TweenLite.to(my_image_style2, 0.5, {x:find_the_center_style_2 / 2, ease:Cubic.easeOut, overwrite:"none"});//slide in
} else {
//fade-in with aspect ratio
k_b_style_2 = ImgHeight_b_style_2 / ImgWidth_b_style_2;
if( my_image_style2.width * k_b_style_2 > my_image_style2.height ){
k_b_style_2 = ImgWidth_b_style_2 / my_image_style2.width;
} else {
k_b_style_2 = ImgHeight_b_style_2 / my_image_style2.height;
}
my_image_style2.width *= k_b_style_2 + 0.1;
my_image_style2.height *= k_b_style_2 + 0.2;
find_the_center_style_2 = 422 - my_image_style2.width;//find the center of each image
my_image_style2.y = 0;//always 0
my_image_style2.x = find_the_center_style_2 / 2;//position to center
TweenLite.to(my_image_style2, 0.5, {autoAlpha:1, ease:Linear.easeNone, overwrite:"none"});
}
}
}
function Interval_Listener_style2():void {
hidePrev_style2();
my_playback_counter_style2b++;
if (my_playback_counter_style2b == my_total_style2) {
my_playback_counter_style2b = 0;
}
nextChart_style2();
}
function hidePrev_style2():void {
var my_image_style2:Loader = Loader(my_image_slides_style2.getChildAt(0));
TweenLite.to(my_image_style2, 0, {autoAlpha:0, ease:Linear.easeNone, overwrite:"none", onComplete:function(){
//my_image_slides_style2.removeChildAt(0)
//release the videos (remove them from memory)
while(my_image_slides_style2.numChildren){//select all the images in loop
my_image_slides_style2.removeChildAt(0);//remove the images
}
}});
}
addChild(property_mcb);//add the Properties MovieClips
property_mcb.alpha = 0;
property_mcb.y = 10;
property_mcb.alpha = 1;
///////////////////////////////////////////////////////////////////////////////////
//PROPERTY MC//////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
}