Carousel on frame 2

  • ZeroScount
  • Born
  • Born
  • ZeroScount
  • Posts: 1

Post 3+ Months Ago

Hey,

When I place my carousel code/script on another frame than one it does not show. Does anyone, just from seeing my code/script spot a possible reason?

Code: [ Select ]
stop ();
//*************************************IMPORTS****************************************\\
import mx.transitions.Tween;
import mx.transitions.easing.*;
import mx.utils.Delegate;
import flash.filters.BlurFilter;

//*************************************CAROUSEL****************************************\\
var blur:BlurFilter = new BlurFilter (0, 0, 1);
var numOfItems:Number;
var radiusX:Number = 300;
var radiusY:Number = 70;
var centerX:Number = (Stage.width / 2);
var centerY:Number = (Stage.height / 2);
var speed:Number = 0.0015;
var speed2 = speed + 0.05;
var perspective:Number = 114;
var home:MovieClip = this;

var tooltips:Array = new Array ("tooltip1", "tooltip2", "tooltip3", "tooltip4", "tooltip5", "tooltip6", "tooltip7", "tooltip8", "tooltip9", "tooltip10", "tooltip11");

var const:Array = new Array ("const1", "const2", "const3", "const4", "const5", "const6", "const7", "const8", "const9", "const10", "const11");

var tooltip:MovieClip = this.attachMovie ("tooltip", "tooltip", 10000);
tooltip._alpha = 0;
//**********************CAROUSEL XML*******************************\\
this.onLoad = function () {
    numOfItems = 11;//11 items

    for (var i = 0; i < numOfItems; i++) {
        var t = home.attachMovie ("item", "item" + i, i + 1);
        t._alpha = 85;
        t.angle = i * ((Math.PI * 2) / numOfItems);
        t.onEnterFrame = mover;
        t.toolText = tooltips[i];
        t.const = const[i];
        home.tooltip._xscale = home.tooltip._yscale = this._parent._xscale;
        t.icon.inner.attachMovie ("bitmap" + i,"bitmap",1000 + i);
        t.r.inner.attachMovie ("bitmap" + i,"whatever" + i,6000 + i);
        t.icon.onRollOver = over;
        t.icon.onRollOut = out;
        t.icon.onRelease = released;
    }
};
//********************CAROUSEL TOOLTIP***********************\\
function over () {

    home.tooltip.tipText.text = this._parent.toolText;
    home.tooltip._x = this._parent._x + 4;
    home.tooltip._y = this._parent._y - this._parent._height / 2;
    home.tooltip.onEnterFrame = Delegate.create (this, moveTip);
    home.tooltip._alpha = 95;
    var s = (home.tooltip._y - perspective) / (centerY + radiusY - perspective);
    home.tooltip._xscale = home.tooltip._yscale = s * 700;
    home.tooltip._xscale = home.tooltip._yscale = this._parent._xscale;//Scaling Tooltip
}
function out () {

    delete home.tooltip.onEnterFrame;
    delete home.tooltip.tipText.text;
    home.tooltip._alpha = 0;
}

function released () {

    home.tooltip._alpha = 0;
    for (var i = 0; i < numOfItems; i++) {
        var t:MovieClip = home["item" + i];
        t.xPos = t._x;
        t.yPos = t._y;
        t.theScale = t._xscale;
        delete t.icon.onRollOver;
        delete t.icon.onRollOut;
        delete t.icon.onRelease;
        delete t.onEnterFrame;
        if (t != this._parent) {
            //If it's not the item we clicked on, fade it away
            var tw:Tween = new Tween (t, "_xscale", Strong.easeOut, t._xscale, 0, 1, true);
            var tw2:Tween = new Tween (t, "_yscale", Strong.easeOut, t._yscale, 0, 1, true);
            var tw3:Tween = new Tween (t, "_alpha", Strong.easeOut, 100, 0, 1, true);

        } else {
            //If it is the item we clicked on
            blur.blurX = 0.25;
            blur.blurY = 0.25;
            t.filters = [blur];
            t._alpha = 100;
            if (t.const == "const1" or "const2" or "const3" or "const4" or "const5" or "const6" or "const7" or "const8" or "const9" or "const10" or "const11") {
                t.icon.inner.bitmap.gotoAndStop (2);
            }
            //Enlarge the object         
            var tw:Tween = new Tween (t, "_xscale", Strong.easeOut, t._xscale, 466.5, 1, true);
            var tw2:Tween = new Tween (t, "_yscale", Strong.easeOut, t._yscale, 466.5, 1, true);
            var tw3:Tween = new Tween (t, "_x", Strong.easeOut, t._x, 350, 1, true);
            var tw4:Tween = new Tween (t, "_y", Strong.easeOut, t._y, 240, 1, true);
            var tw5:Tween = new Tween (theText, "_alpha", Strong.easeOut, 0, 100, 1, true);


            theText.text = t.const;
            var s:Object = this;
            var pixel:Object = t.icon.inner.bitmap.instance1.btn;
            tw.onMotionStopped = function () {

                item0.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
                item1.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
                item2.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
                item3.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
                item4.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
                item5.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
                item6.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
                item7.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
                item8.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
                item9.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
                item10.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
            };
        }
    }
}

function unReleashed () {
    delete this.onRelease;

    var tw5:Tween = new Tween (theText, "_alpha", Strong.easeOut, 100, 0, 0.6, true);

    for (var i = 0; i < numOfItems; i++) {
        var t:MovieClip = home["item" + i];
        if (t != this._parent) {
            var tw:Tween = new Tween (t, "_xscale", Strong.easeOut, 0, t.theScale, 1, true);
            var tw2:Tween = new Tween (t, "_yscale", Strong.easeOut, 0, t.theScale, 1, true);
            var tw3:Tween = new Tween (t, "_alpha", Strong.easeOut, 0, 85, 1, true);


        } else {
            t._alpha = 85;
            var tw:Tween = new Tween (t, "_xscale", Strong.easeOut, 100, t.theScale, 1, true);
            var tw2:Tween = new Tween (t, "_yscale", Strong.easeOut, 100, t.theScale, 1, true);
            var tw3:Tween = new Tween (t, "_x", Strong.easeOut, t._x, t.xPos, 1, true);
            var tw4:Tween = new Tween (t, "_y", Strong.easeOut, t._y, t.yPos, 1, true);


            t.icon.inner.bitmap.gotoAndStop (1);//Return to pixel version

            tw.onMotionStopped = function () {
                for (var i = 0; i < numOfItems; i++) {
                    var t:MovieClip = home["item" + i];
                    t.icon.onRollOver = Delegate.create (t.icon, over);
                    t.icon.onRollOut = Delegate.create (t.icon, out);
                    t.icon.onRelease = Delegate.create (t.icon, released);
                    t.onEnterFrame = mover;

                }
            };
        }
    }
}

function moveTip () {

    home.tooltip._x = this._parent._x;
    home.tooltip._xscale = home.tooltip._yscale = this._parent._xscale;
    home.tooltip._y = this._parent._y - this._parent._height / 2;

}
//********************IMAGE MOVER***********************\\
//Circle Area
function mover () {
    this._x = Math.cos (this.angle) * radiusX + centerX;
    this._y = Math.sin (this.angle) * 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);
    //Blur
    blur.blurX = Math.round (Math.sin (this.angle - Math.PI) * 1.50);
    blur.blurY = Math.round (Math.sin (this.angle - Math.PI) * 1.50);
    this.filters = [blur];

}
//Speed
this.onMouseMove = function () {
    if (_ymouse <= 380) {
        speed = (this._xmouse - (centerX) - 10) / 8300;
        speed2 = (this._xmouse - (centerX / 3 + 500) - 10) / 1900;
    }
};
  1. stop ();
  2. //*************************************IMPORTS****************************************\\
  3. import mx.transitions.Tween;
  4. import mx.transitions.easing.*;
  5. import mx.utils.Delegate;
  6. import flash.filters.BlurFilter;
  7. //*************************************CAROUSEL****************************************\\
  8. var blur:BlurFilter = new BlurFilter (0, 0, 1);
  9. var numOfItems:Number;
  10. var radiusX:Number = 300;
  11. var radiusY:Number = 70;
  12. var centerX:Number = (Stage.width / 2);
  13. var centerY:Number = (Stage.height / 2);
  14. var speed:Number = 0.0015;
  15. var speed2 = speed + 0.05;
  16. var perspective:Number = 114;
  17. var home:MovieClip = this;
  18. var tooltips:Array = new Array ("tooltip1", "tooltip2", "tooltip3", "tooltip4", "tooltip5", "tooltip6", "tooltip7", "tooltip8", "tooltip9", "tooltip10", "tooltip11");
  19. var const:Array = new Array ("const1", "const2", "const3", "const4", "const5", "const6", "const7", "const8", "const9", "const10", "const11");
  20. var tooltip:MovieClip = this.attachMovie ("tooltip", "tooltip", 10000);
  21. tooltip._alpha = 0;
  22. //**********************CAROUSEL XML*******************************\\
  23. this.onLoad = function () {
  24.     numOfItems = 11;//11 items
  25.     for (var i = 0; i < numOfItems; i++) {
  26.         var t = home.attachMovie ("item", "item" + i, i + 1);
  27.         t._alpha = 85;
  28.         t.angle = i * ((Math.PI * 2) / numOfItems);
  29.         t.onEnterFrame = mover;
  30.         t.toolText = tooltips[i];
  31.         t.const = const[i];
  32.         home.tooltip._xscale = home.tooltip._yscale = this._parent._xscale;
  33.         t.icon.inner.attachMovie ("bitmap" + i,"bitmap",1000 + i);
  34.         t.r.inner.attachMovie ("bitmap" + i,"whatever" + i,6000 + i);
  35.         t.icon.onRollOver = over;
  36.         t.icon.onRollOut = out;
  37.         t.icon.onRelease = released;
  38.     }
  39. };
  40. //********************CAROUSEL TOOLTIP***********************\\
  41. function over () {
  42.     home.tooltip.tipText.text = this._parent.toolText;
  43.     home.tooltip._x = this._parent._x + 4;
  44.     home.tooltip._y = this._parent._y - this._parent._height / 2;
  45.     home.tooltip.onEnterFrame = Delegate.create (this, moveTip);
  46.     home.tooltip._alpha = 95;
  47.     var s = (home.tooltip._y - perspective) / (centerY + radiusY - perspective);
  48.     home.tooltip._xscale = home.tooltip._yscale = s * 700;
  49.     home.tooltip._xscale = home.tooltip._yscale = this._parent._xscale;//Scaling Tooltip
  50. }
  51. function out () {
  52.     delete home.tooltip.onEnterFrame;
  53.     delete home.tooltip.tipText.text;
  54.     home.tooltip._alpha = 0;
  55. }
  56. function released () {
  57.     home.tooltip._alpha = 0;
  58.     for (var i = 0; i < numOfItems; i++) {
  59.         var t:MovieClip = home["item" + i];
  60.         t.xPos = t._x;
  61.         t.yPos = t._y;
  62.         t.theScale = t._xscale;
  63.         delete t.icon.onRollOver;
  64.         delete t.icon.onRollOut;
  65.         delete t.icon.onRelease;
  66.         delete t.onEnterFrame;
  67.         if (t != this._parent) {
  68.             //If it's not the item we clicked on, fade it away
  69.             var tw:Tween = new Tween (t, "_xscale", Strong.easeOut, t._xscale, 0, 1, true);
  70.             var tw2:Tween = new Tween (t, "_yscale", Strong.easeOut, t._yscale, 0, 1, true);
  71.             var tw3:Tween = new Tween (t, "_alpha", Strong.easeOut, 100, 0, 1, true);
  72.         } else {
  73.             //If it is the item we clicked on
  74.             blur.blurX = 0.25;
  75.             blur.blurY = 0.25;
  76.             t.filters = [blur];
  77.             t._alpha = 100;
  78.             if (t.const == "const1" or "const2" or "const3" or "const4" or "const5" or "const6" or "const7" or "const8" or "const9" or "const10" or "const11") {
  79.                 t.icon.inner.bitmap.gotoAndStop (2);
  80.             }
  81.             //Enlarge the object         
  82.             var tw:Tween = new Tween (t, "_xscale", Strong.easeOut, t._xscale, 466.5, 1, true);
  83.             var tw2:Tween = new Tween (t, "_yscale", Strong.easeOut, t._yscale, 466.5, 1, true);
  84.             var tw3:Tween = new Tween (t, "_x", Strong.easeOut, t._x, 350, 1, true);
  85.             var tw4:Tween = new Tween (t, "_y", Strong.easeOut, t._y, 240, 1, true);
  86.             var tw5:Tween = new Tween (theText, "_alpha", Strong.easeOut, 0, 100, 1, true);
  87.             theText.text = t.const;
  88.             var s:Object = this;
  89.             var pixel:Object = t.icon.inner.bitmap.instance1.btn;
  90.             tw.onMotionStopped = function () {
  91.                 item0.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
  92.                 item1.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
  93.                 item2.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
  94.                 item3.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
  95.                 item4.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
  96.                 item5.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
  97.                 item6.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
  98.                 item7.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
  99.                 item8.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
  100.                 item9.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
  101.                 item10.icon.inner.bitmap.vectpage1.btn.onRelease = Delegate.create (s, unReleashed);
  102.             };
  103.         }
  104.     }
  105. }
  106. function unReleashed () {
  107.     delete this.onRelease;
  108.     var tw5:Tween = new Tween (theText, "_alpha", Strong.easeOut, 100, 0, 0.6, true);
  109.     for (var i = 0; i < numOfItems; i++) {
  110.         var t:MovieClip = home["item" + i];
  111.         if (t != this._parent) {
  112.             var tw:Tween = new Tween (t, "_xscale", Strong.easeOut, 0, t.theScale, 1, true);
  113.             var tw2:Tween = new Tween (t, "_yscale", Strong.easeOut, 0, t.theScale, 1, true);
  114.             var tw3:Tween = new Tween (t, "_alpha", Strong.easeOut, 0, 85, 1, true);
  115.         } else {
  116.             t._alpha = 85;
  117.             var tw:Tween = new Tween (t, "_xscale", Strong.easeOut, 100, t.theScale, 1, true);
  118.             var tw2:Tween = new Tween (t, "_yscale", Strong.easeOut, 100, t.theScale, 1, true);
  119.             var tw3:Tween = new Tween (t, "_x", Strong.easeOut, t._x, t.xPos, 1, true);
  120.             var tw4:Tween = new Tween (t, "_y", Strong.easeOut, t._y, t.yPos, 1, true);
  121.             t.icon.inner.bitmap.gotoAndStop (1);//Return to pixel version
  122.             tw.onMotionStopped = function () {
  123.                 for (var i = 0; i < numOfItems; i++) {
  124.                     var t:MovieClip = home["item" + i];
  125.                     t.icon.onRollOver = Delegate.create (t.icon, over);
  126.                     t.icon.onRollOut = Delegate.create (t.icon, out);
  127.                     t.icon.onRelease = Delegate.create (t.icon, released);
  128.                     t.onEnterFrame = mover;
  129.                 }
  130.             };
  131.         }
  132.     }
  133. }
  134. function moveTip () {
  135.     home.tooltip._x = this._parent._x;
  136.     home.tooltip._xscale = home.tooltip._yscale = this._parent._xscale;
  137.     home.tooltip._y = this._parent._y - this._parent._height / 2;
  138. }
  139. //********************IMAGE MOVER***********************\\
  140. //Circle Area
  141. function mover () {
  142.     this._x = Math.cos (this.angle) * radiusX + centerX;
  143.     this._y = Math.sin (this.angle) * radiusY + centerY;
  144.     var s:Number = (this._y - perspective) / (centerY + radiusY - perspective);
  145.     this._xscale = this._yscale = s * 100;
  146.     this.angle += this._parent.speed;
  147.     this.swapDepths (Math.round (this._xscale) + 100);
  148.     //Blur
  149.     blur.blurX = Math.round (Math.sin (this.angle - Math.PI) * 1.50);
  150.     blur.blurY = Math.round (Math.sin (this.angle - Math.PI) * 1.50);
  151.     this.filters = [blur];
  152. }
  153. //Speed
  154. this.onMouseMove = function () {
  155.     if (_ymouse <= 380) {
  156.         speed = (this._xmouse - (centerX) - 10) / 8300;
  157.         speed2 = (this._xmouse - (centerX / 3 + 500) - 10) / 1900;
  158.     }
  159. };
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

other than frame one of what? The root timeline? a Movieclip? Where?

Why don't you just place that code inside a movieclip on frame one and place that movieclip on the stage?

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 15 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.