FORUMS: list search recent posts

AS3 Carousel help needed.

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Crystal Shannon
AS3 Carousel help needed.
on Apr 16, 2009 at 4:09:14 am

First off, thanks to the tut at the gotoandlearn.com site that helped me create the carousel
which I have taken the liberty to edit it to fit my needs.

Now....
1. I have added buttons in for left and right and now need some help to center my images one by one when the arrows are clicked. ( the left button should go the the previous image, and the right button should go to the next image. ) As of now, when you click on the button, the images rotate continuously.

2. I would like for the images in the back of the carousel to go to an alpha of about .5

3. I would like to keep the carousel the size it is, but tilt the front of it down, and the back of it up so you can see the icons in the back.


That's it.. easy right... not for me, LOL.


Any help or tut redirects are welcomed. Thanks guys!!


var icons:Array = new Array();
icons.push("image1", "image2", "image3", "image4", "image5");

var numOfItems:Number = icons.length;

var radiusX:Number = 160;
var radiusY:Number = 20;
var centerX:Number = Stage.width/2.01;
var centerY:Number = Stage.height/2;
var speed:Number = 0;
//var perspective:Number = 350;
//var home:MovieClip = this;


for(var i=0; i<numOfItems;i++)
{
var t = this.attachMovie(icons[i], "item"+i, i+1);
t.angle = i * ((Math.PI*2)/numOfItems);
t.onEnterFrame = carousel;
}

function carousel()
{
this._x = Math.cos(this.angle) * radiusX + centerX;
this._y = Math.sin(this.angle) * radiusY + centerY;
var s:Number = this._y / (centerY+radiusY);
this._xscale = this._yscale = s * 85;
this.angle += this._parent.speed;
this.swapDepths(Math.round(this._xscale) + 100);
}



right_btn.onPress = function()
{
this.right_arrow_mc.gotoAndPlay(6);
speed = 50;

}
right_btn.onRollOut = function()
{
speed = 0;
}

right_btn.onRelease = function()
{
speed = 0;
}

left_btn.onPress = function()
{
this.right_arrow_mc.gotoAndPlay(6);
speed = 0.08;

}
left_btn.onRollOut = function()
{
speed = 0;
}

left_btn.onRelease = function()
{
speed = 0;
}




Return to posts index

Crystal Shannon
Re: AS3 Carousel help needed.
on Apr 16, 2009 at 11:38:14 am

Hi, OK. I've figured it out for the most part.
All I need now is to move the current image in the array to the next one when the onRelease button is clicked. The back button will do the same, except will go backwards. This is what I now have. PLEASE help me!!
I'm so close to finishing.

Thanks

import mx.utils.Delegate;
import mx.transitions.Tween;
import mx.transitions.easing.*;



var icons:Array = new Array();
icons.push("image1","image2","image3","image4","image5");


var numOfItems:Number = 5;

var radiusX:Number = 150;
var radiusY:Number = 40;
var centerX:Number = Stage.width/2;
var centerY:Number = Stage.height/5;
var speed:Number = 0;
var perspective:Number = 130;
var home:MovieClip = this;


for (var i = 0; i<numOfItems; i++) {
var t = this.attachMovie(icons[i], "item"+i, i+1);
t.angle = i*((Math.PI*2)/numOfItems);
t.onEnterFrame = carousel;
}



function carousel() {
this._x = Math.cos(this.angle)*radiusX+centerX;
this._y = Math.sin(this.angle)*radiusY+centerY;
//Zig Zag-- cool
// this._y = Math.sin(this.angle*4) * radiusY + centerY;
var s:Number = (this._y+perspective)/(centerY+radiusY+perspective);
this._xscale = this._yscale=s*100;
this.angle += this._parent.speed;
this.swapDepths(Math.round(this._xscale)+100);
this._alpha = (Math.round(this._xscale)+15);

}



right_btn.onRelease = function() {
this.right_arrow_mc.gotoAndPlay(6);
//var tw:Tween = new Tween (t.icons, "_x", Strong.easeOut,t._x, 200, t.focus,true);
//var tw:Tween = new Tween (t.icons, "_y", Strong.easeOut,t._y, 320, t.focus,true);
speed = (t._x = 220)/2500;
//speed = 10000/82310;
};
right_btn.onRollOut = function() {
speed = 0;
};



left_btn.onRelease = function() {
this.left_arrow_mc.gotoAndPlay(6);

//speed = -10000/82300;
};
left_btn.onRollOut = function() {
speed = 0;
};



Return to posts index

Crystal Shannon
Re: AS3 Carousel help needed.
on Apr 20, 2009 at 12:50:04 am

I'm going to post again, I've solved some of these problems, so I won't be following this one any more. Thanks


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]