Jump to content
Search Community

Tweening container vs mask. Slideshow

mathias5 test
Moderator Tag

Recommended Posts

Hi,

 

i have this horizontal list of images stored in a container mc. The container is masked and i want to animate the container when clicking on next/prev buttons. the container should then slide so a new image gets visible.

I ll try to explain it a bit better.

 

the container is a movie clip with a dynamic with. the mask has a fixed with (so correct amount of images get shown). all images are aligned horizontal. now i want to animate the container on click left/prev so the images thats visible changes.

 

Here is the positioning of the images. I don't know how to get the sliding work.

			for(var i:int = 0; i<this.container.numChildren; i++) {
				var mc:DisplayObject = this.container.getChildAt(i);
				if(mc is MovieClip) {
					mc.x = xPos;
					xPos += mc.width + margin;
					mc.y = 0;
				}
			}

Currently my sliding function looks like this:

		private function slideLeft(event:MouseEvent):void {
			if(!TweenMax.isTweening(container)) {
				var tx:Number = Math.min(container.x + itemWidth, _mask.x);
				TweenMax.to(container, 0.4, {x:Math.floor(tx),ease:Expo.easeInOut});
			}
		}
		
		private function slideRight(event:MouseEvent):void {
			if(!TweenMax.isTweening(container)) {
				var tx:Number = Math.max(container.x - itemWidth, _mask.x-_mask.width);
				TweenMax.to(container, 0.4, {x:Math.floor(tx),ease:Expo.easeInOut});
			}
		}

Here is an image of what i meen.

 

 

 

post-17115-0-37127500-1415117740_thumb.jpg

Link to comment
Share on other sites

Its very difficult to troubleshoot this blind. I see a variable named itemWidth but I have no idea what its value is or where it is defined.

I'd guess you want to change the x of the containerbased on the width of the mask.

 

 

If you can zip up a simplified version and post it here that would help. (use the "more reply options" button).

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.
×
×
  • Create New...