Okay...
left
rightCode:onClipEvent (load) { //import caurina.transitions.Tweener; this._alpha = 60; this.onRollOver = function() { //_parent.counter = 1; //trace(_parent.counter); clearInterval(_parent.myTimer); Tweener.addTween(this, {_alpha:30, time:0.1, transition:"linear"}); Tweener.addTween(this, {_height:30, time:0.5, transition:"easeoutCirc"}); }; this.onRollOut = this.onReleaseOutside = function() { //_parent.counter = null; Tweener.addTween(this, {_alpha:60, time:0.1, transition:"linear"}); Tweener.addTween(this, {_height:30, time:0.2, transition:"easeoutCirc"}); _parent.myTimer = setInterval( function(){_parent.scrollIcons(1);}, 6000 ); }; this.onRelease = function() { this._parent.scrollIcons(-1); }; }
mainCode:onClipEvent (load) { //import caurina.transitions.Tweener; this._alpha = 60; this.onRollOver = function() { //trace(_parent.counter); clearInterval(_parent.myTimer); Tweener.addTween(this, {_alpha:30, time:0.1, transition:"linear"}); Tweener.addTween(this, {_height:30, time:0.5, transition:"easeoutCirc"}); }; this.onRollOut = this.onReleaseOutside = function() { Tweener.addTween(this, {_alpha:60, time:0.1, transition:"linear"}); Tweener.addTween(this, {_height:30, time:0.2, transition:"easeoutCirc"}); _parent.myTimer = setInterval( function(){_parent.scrollIcons(1);}, 6000 ); }; this.onPress = function() { this._parent.scrollIcons(1); }; }
Code:// ******* Variables I have added :: //// myTimer = null; //var counter = null; var roll = null; // ******* Time Delays :: ///// myTimer = setInterval( function(){ scrollIcons(1);}, 6000 ); //•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• // ******* importing other classes :: //// import caurina.transitions.Tweener; //•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• //=================================================================================== // Initialization methods //----------------------------------------------------------------------------------- this.init = function():Void { // Initializes the movieclip // Properties this.icons = [this.mk302wx1, this.dytp8640, this.ot3866 ]; this.iconNames = ["MK LCT302WX1", "DY TP-8640CS", "OT 3866"]; this.currentIcon = 1; // Finally, redraws this.redraw(true); this.stop(); }; //•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• //=================================================================================== // Execution methods //----------------------------------------------------------------------------------- this.redraw = function(p_immediate:Boolean) { // Redraws every item on their new position var i:Number; var scaleSmall:Number = 0.3; // Scale when not focused var scaleBig:Number = 1; // Scale when focused var baseX:Number = 340; // Base column for focused position var baseY:Number = 160; // Base row for all icons var iconDistance:Number = 130; // Distance between the center axis of each icon var iconDistanceFocused:Number = 220; // Distance between the center axis of each icon WHEN FOCUSED var animationTime:Number = p_immediate ? 0 : 0.5; var animationType:String = "easeoutCirc"; // Redraw: icons // Set correct scale for (i = 0; i < this.icons.length; i++) { var distance:Number = this.currentIcon - i; var itemScale:Number = Math.abs(distance) > 1 ? scaleSmall : ((1-Math.abs(distance)) * (scaleBig-scaleSmall)) + scaleSmall; var itemX:Number = baseX + (distance * -iconDistance); if (distance != 0) { itemX += (iconDistanceFocused - iconDistance) * (distance > 0 ? -1 : +1); } Tweener.addTween(this.icons[i], {_x:itemX, _xscale:100 * itemScale, _yscale:100 * itemScale, time:animationTime, transition:animationType}); this.icons[i]._y = baseY; if (animationTime > 0) { // Apply a motion blur depending on the ammount of pixels the object has to be moved var ammountToBlur:Number = Math.abs(this.icons[i]._x - itemX) / 12; Tweener.addTween(this.icons[i], {_blur_blurX:ammountToBlur, _blur_quality:2, time:animationTime/2, transition:"easeOutQuint"}); Tweener.addTween(this.icons[i], {_blur_blurX:0, time:animationTime/2, delay:animationTime/2, transition:"easeOutQuad"}); }} //•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• // Redraw: text this.caption.text = this.iconNames[this.currentIcon]; }; // ******* control for the scrolling looping back to number one this.scrollIcons = function(p_offset:Number) { if (p_offset == 1) { this.icons.push(this.icons.shift()); this.iconNames.push(this.iconNames.shift()); } else { this.icons.unshift(this.icons.pop()); this.iconNames.unshift(this.iconNames.pop()); } this.setIcon(this.currentIcon+p_offset); }; //•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• // Finally Setting the Correct Icon (SET ICON FUNCTION) this.setIcon = function(p_icon:Number) { // Set the currently selected icon if (p_icon != undefined) { if (p_icon < 0) p_icon = 0; if (p_icon > this.icons.length - 1) p_icon = this.icons.length - 1; if (p_icon != this.currentIcon) { //this.currentIcon = p_icon; this.redraw(false);}}}; //=================================================================================== // End //----------------------------------------------------------------------------------- this.init();




Reply With Quote
