Loop banner 3 times with AS2
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Loop banner 3 times with AS2

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    10

    Loop banner 3 times with AS2

    Hello, I have built a banner in Flash CS5 using AS2 (LMCTWEEN AS) and I need the code to loop 3 times.. I do not understand how to do this.. I am attaching the code in the hopes that someone can fill in the blanks for me. I appreciate any help..

    Actionscript Code:
    /*************************************************
    **  INCLUDES
    *************************************************/

    #include "lmc_tween.as"


    /*************************************************
    **  VARS
    *************************************************/



    /*************************************************
    **  FRAME ACTIONS
    *************************************************/

    openingAni();
    stop();


    /*************************************************
    **  ANIMATIONS
    *************************************************/


    function reSet():Void { 
            itsabout.tween('_x', 383.70, 0, 'easeInOutSine', 2);
            togo.tween('_x', 430.90, 0, 'easeInOutSine', 2);
            down.tween('_x', 377.25, 0, 'easeInOutSine', 2);
            fourcities.tween('_x', 515.30, 0, 'easeInOutSine', 2);
            twentyfour.tween('_x', 452.05, 0, 'easeInOutSine', 2);
            lockup.tween('_y', 630.40, 0, 'easeInOutSine', 2);   
            city.tween('_y', 621.95, 0, 'easeInOutSine', 2);
            citymask.tween('_y', 622.15, 0, 'easeInOutSine', 2);
            kevaan.tween('_y', 630.40, 0, 'easeInOutSine', 2);
            kevaan.tween('_x', 79, 0, 'easeInOutSine', 2);
            gbgr.alphaTo(0, 0, 'easeInOutSine', 2);
            legal.alphaTo(0, 0, 'easeInOutSine', 2);       
            footer.tween('_y', 622.15, 0, 'easeInOutSine', 2);
            specialjudge.tween('_x', 342.20, 0, 'easeInOutSine', 2);               
            clcikme.tween('_x', 334.20, 0, 'easeInOutSine', 2, openingAni);
    }



    function openingAni():Void {
            itsabout.tween('_x', 46.40, .1, 'easeInOutSine', .6);
            togo.tween('_x', 90.40, .1, 'easeInOutSine', .8);
            down.tween('_x', 40.05, .1, 'easeInOutSine', 1, playFrm1);


    }

    function playFrm1():Void {
            itsabout.tween('_x', -346.40, .1, 'easeInOutSine', .9);
            togo.tween('_x', -390.40, .1, 'easeInOutSine', 1.1);
            down.tween('_x', -340.05, .1, 'easeInOutSine', 1.3);
            fourcities.tween('_x', 70.35, .1, 'easeInOutSine', 1.1);
            twentyfour.tween('_x', 7.18, .1, 'easeInOutSine', 1.4, playFrm3);
           
    }

    function playFrm3():Void {
            fourcities.tween('_x', -370.35, .3, 'easeInOutSine', 1);
            twentyfour.tween('_x', -357.18, .1, 'easeInOutSine', 1.3);   
            lockup.tween('_y', 50, .3, 'easeInOutSine', 1, playFrm5);   
            city.tween('_y', 398.90, .3, 'easeInOutSine', 1);
            citymask.tween('_y', 399.10, .3, 'easeInOutSine', 1);
            kevaan.tween('_y', 270.50, .3, 'easeInOutSine', 1.2);
            gbgr.alphaTo(100, 0, 'easeInOutSine', 1.5);
            legal.alphaTo(100, 0, 'easeInOutSine', 1.5);       
            footer.tween('_y', 537.15, .2, 'easeInOutSine', 1.5);
            specialjudge.tween('_x', 30.20, .2, 'easeInOutSine', 2, playFrm7);
           
           
    }

    function playFrm7():Void {
            kevaan.tween('_x', 0, .2, 'easeInOutSine', 1.8);   
            clcikme.tween('_x', 145.50, .2, 'easeInOutSine', 1.9, reSet);      
           
    }


    /**********************************************************
    * BUTTONS
    **********************************************************/


    bb.onRelease= function():Void {
    getURL('http://www.standupitsmillertime.com', '_blank');

    }

  2. #2
    Senior Member
    Join Date
    Mar 2010
    Posts
    157

    Count the number of loops..

    this should work:

    Actionscript Code:
    openingAni();
    stop();

    var loops:Number = 0;

    function reSet():Void {
           
            loops++;
           
            if(loops<3){
           
                    itsabout.tween('_x', 383.70, 0, 'easeInOutSine', 2);
                    togo.tween('_x', 430.90, 0, 'easeInOutSine', 2);
                    down.tween('_x', 377.25, 0, 'easeInOutSine', 2);
                    fourcities.tween('_x', 515.30, 0, 'easeInOutSine', 2);
                    twentyfour.tween('_x', 452.05, 0, 'easeInOutSine', 2);
                    lockup.tween('_y', 630.40, 0, 'easeInOutSine', 2);   
                    city.tween('_y', 621.95, 0, 'easeInOutSine', 2);
                    citymask.tween('_y', 622.15, 0, 'easeInOutSine', 2);
                    kevaan.tween('_y', 630.40, 0, 'easeInOutSine', 2);
                    kevaan.tween('_x', 79, 0, 'easeInOutSine', 2);
                    gbgr.alphaTo(0, 0, 'easeInOutSine', 2);
                    legal.alphaTo(0, 0, 'easeInOutSine', 2);       
                    footer.tween('_y', 622.15, 0, 'easeInOutSine', 2);
                    specialjudge.tween('_x', 342.20, 0, 'easeInOutSine', 2);               
                   clcikme.tween('_x', 334.20, 0, 'easeInOutSine', 2, openingAni);
           
            }else{
                    stop();
            }
    }

    //rest of your code
     


    Let me know if it did the job

  3. #3
    Junior Member
    Join Date
    May 2012
    Posts
    10
    koenahn, thank you so much! that was exactly what i needed.. and now that i see it in place.. i understand why what i was doing wouldn't work. again, thanks.

  4. #4
    Senior Member
    Join Date
    Mar 2010
    Posts
    157
    Glad I could help you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width


HTML5 Development Center

Poll by Flashkit.com