Jump to content

Steven P123

[Solved] Loading Into Layer Beneath A Static Layer

Recommended Posts



I've adapted a slide show from code I found on these forums.


I am trying to get my head around loading and layers. I have a watermark (mc_overlay) on a layer above a layer containing movie clip (mc_holder) into which I am loading a series of images. The first image does not get the water mark above, but every image thereafter does get the watermark. When it cycles back to the beginning, the first image still appears above the layer I want it to be under (I assume, since there is no mc_overlay in view).



3 mc_overlay

2 mc_holder

1 AS


My code:

import com.greensock.*;
import com.greensock.loading.*;
import com.greensock.events.LoaderEvent;
import com.greensock.loading.display.*;

var loadedImages:Array = [];
var curIndex:int = -1;

var queue:LoaderMax = new LoaderMax({maxConnections:1, onChildComplete:completeHandler});
queue.append( new ImageLoader("images/ansel_adams/1.jpg") );
queue.append( new ImageLoader("images/ansel_adams/2.jpg") );
queue.append( new ImageLoader("images/ansel_adams/3.jpg") );
queue.append( new ImageLoader("images/ansel_adams/4.jpg") );
queue.append( new ImageLoader("images/ansel_adams/5.jpg") );

//...add preloader here...
function completeHandler(event:LoaderEvent):void {
	var image:ContentDisplay = event.target.content;
	image.alpha = 0;
	image.visible = false;
	if (curIndex == -1) {
		//...remove preloader here...

function showNext():void {
	if (curIndex != -1) {
		TweenMax.to(loadedImages[curIndex], 1, {autoAlpha:0}); //fade old out
	if (curIndex >= loadedImages.length) {
		curIndex = 0;
	var image:ContentDisplay = loadedImages[curIndex];
	//this.addChild(image); //brings to the front //original
	mc_holder.addChild(image); //brings to the front
	TweenMax.to(image, 1, {autoAlpha:1});
	TweenMax.delayedCall(5, showNext);

Thanks in advance,

The user formerly known as Steven P

Link to comment
Share on other sites

Well, that's embarrassing. The overlay was appretnly there the whole time .... but blended in 'perfectly' with the first image.


Won't be the last time I'm wrong either. :mrgreen: :mrgreen: :mrgreen:

Link to comment
Share on other sites

No problem. 

Thanks for letting us know you solved it. It saves us some time. And don't worry, we all make these little mistakes.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.