Flash CS3 help carousel effect with buttons

Discussion in 'Web Design and Development' started by DARKiLLUSiON, Oct 27, 2008.

  1. DARKiLLUSiON macrumors 6502

    Joined:
    Sep 21, 2007
    Location:
    Toronto, Canada
    #1
    Hey guys
    I need any help I could get anyway
    I've been googling this for a awhile and still can't find anything relate to it
    or I'm just not searching for the right terms...

    http://osaka.cool.ne.jp/iluvayu22/chin3.swf

    what's the action script that the person use in order to make the image
    scrolls left/right by just clicking on the black icons on the left
    is sorta like a carousel but is not looping or anything and it does stop in the center of the image...
     
  2. snickelfritz macrumors 65816

    snickelfritz

    Joined:
    Oct 24, 2003
    Location:
    Tucson AZ
    #2
    It's very common for Flash developers to use custom tweening classes for simple animations like this.
    I recommend that you download and learn to use TweenMax or TweenLite.
    It's very simple to use, once you understand the basics.

    Here's the basic timeline code (AS3) for something like this:
    PHP:
    import gs.TweenLite;

    btnGroup.addEventListener(MouseEvent.MOUSE_OVERbtnOverfalse0true);
    btnGroup.addEventListener(MouseEvent.MOUSE_OUTbtnOutfalse0true);
    btnGroup.addEventListener(MouseEvent.CLICKbtnClickfalse0true);
    btnGroup.mouseEnabled false;

    var 
    btnName:String "";
    var 
    xVal:Number;

    function 
    btnOver(event:MouseEvent):void
    {
        
    TweenLite.to(event.target.btnBase.5, {tint:0x006699});
    }

    function 
    btnOut(event:MouseEvent):void
    {
        
    TweenLite.to(event.target.btnBase.5, {tint:null});
    }

    function 
    btnClick(event:MouseEvent):void
    {
        
    btnName event.target.name;
        switch (
    btnName)
        {
            case 
    "btn1" :
                
    xVal 200;
                break;
            case 
    "btn2" :
                
    xVal = -300;
                break;
            case 
    "btn3" :
                
    xVal = -800;
                break;
            case 
    "btn4" :
                
    xVal = -1300;
                break;
        }
        
    TweenLite.to(pageGroup1, {x:xVal});
    }
    FLA is attached.
    GL
     

    Attached Files:

  3. DARKiLLUSiON thread starter macrumors 6502

    Joined:
    Sep 21, 2007
    Location:
    Toronto, Canada
    #3

    thank you so much :D
    I'll try that
     

Share This Page