Hi there,
I have 6 movie clips on my stage myCLIP_1 …myCLIP_6 and I am trying to get _parent to fade out and _child to fade in which worked for 1 movie clip but not for all 6
tried it with array and loops all failed
But just need the professional help now
Hope someone can help me …
THANKS in advance.
stop();
import com.greensock.*;
import com.greensock.easing.*;
var lightbox : Sprite;
var darkener : Shape;
var thumbnail = "";
var myTarget = "";
myCLIP_1.addEventListener(MouseEvent.CLICK, btnclick);
myCLIP_2.addEventListener(MouseEvent.CLICK, btnclick);
myCLIP_3.addEventListener(MouseEvent.CLICK, btnclick);
myCLIP_4.addEventListener(MouseEvent.CLICK, btnclick);
myCLIP_5.addEventListener(MouseEvent.CLICK, btnclick);
myCLIP_6.addEventListener(MouseEvent.CLICK, btnclick);
function btnclick(event:Event):void {
if(event.target == myCLIP_1)
{
thumbnail = event.target;
myCLIP_1.buttonMode = true;
myTarget = "MOVIES/1/m1.png";
}
else if(event.target == myCLIP_2)
{
thumbnail = event.target;
myCLIP_2.buttonMode = true;
myTarget = "MOVIES/1/m2.png";
}
else if(event.target == myCLIP_3)
{
thumbnail = event.target;
myCLIP_3.buttonMode = true;
myTarget = "MOVIES/1/m3.png";
}
else if(event.target == myCLIP_4)
{
thumbnail = event.target;
myCLIP_4.buttonMode = true;
myTarget = "MOVIES/1/m4.png";
}
else if(event.target == myCLIP_5)
{
thumbnail = event.target;
myCLIP_5.buttonMode = true;
myTarget = "MOVIES/1/m5.png";
}
else if(event.target == myCLIP_6)
{
thumbnail = event.target;
myCLIP_6.buttonMode = true;
myTarget = "MOVIES/1/m6.png";
}
}
function onThumbnailClick(event:MouseEvent):void
{
darkener = new Shape();
darkener.graphics.beginFill(0x000000, .6);
darkener.graphics.drawRect(0,0,320,280);
darkener.graphics.endFill();
addChild(darkener);
TweenLite.from(darkener, .5, {alpha: 0});
loadImage("myTarget");
}
function loadImage(url : String) : void
{
var loader : Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoaded);
loader.load(new URLRequest(url));
}
function onImageLoaded(event:Event):void
{
thumbnail.mouseEnabled = false;
LoaderInfo(event.target).removeEventListener(Event.COMPLETE, onImageLoaded);
var image:Bitmap = Bitmap(Loader(LoaderInfo(event.target).loader).content);
image.x = image.y = 0;
lightbox = new Sprite();
lightbox.graphics.beginFill(0xFFFFFF, 1);
lightbox.graphics.drawRect(0,0,image.width, image.height);
lightbox.graphics.endFill();
lightbox.x = 10;
lightbox.y = 10;
lightbox.buttonMode = true;
lightbox.addChild(image);
addChild(lightbox);
TweenLite.from(lightbox, 1, {alpha:0});
lightbox.addEventListener(MouseEvent.CLICK, onCloseLightbox);
}
function onCloseLightbox(event:MouseEvent):void
{
lightbox.mouseEnabled = false;
var timeline : TimelineLite = new TimelineLite({onComplete: removeLightbox});
timeline.insert(new TweenLite(lightbox, 1, {alpha:0}));
timeline.append(new TweenLite(darkener, .3, {alpha:0}));
}
function removeLightbox():void
{
lightbox.removeEventListener(MouseEvent.CLICK, onCloseLightbox);
removeChild(lightbox);
lightbox = null;
thumbnail.mouseEnabled = true;
}