newb flash question

Out of context: Reply #4

  • Started
  • Last post
  • 5 Responses
  • OSFA0

    Hey peepz, I'm trying to create a slide gallery but got completely lost. I got some of the code that I got as a sample and am trying to edit it to fit what I'm doing.

    This is the code from the sample. It creates 4 buttons and each assign xlocation, but what if I want to use just a prev and next button to do the same??? Thanks!!

    panel.x = 550;
    var targetX:int = 20;
    b1.addEventListener(MouseEvent.C... b1ClickEventHandler);
    b2.addEventListener(MouseEvent.C... b2ClickEventHandler);
    b3.addEventListener(MouseEvent.C... b3ClickEventHandler);
    b4.addEventListener(MouseEvent.C... b4ClickEventHandler);
    panel.addEventListener(Event.ENT... enterFrameHandler);

    function enterFrameHandler(e:Event):void
    {
    panel.x+=(targetX-panel.x)/5;
    }

    function b1ClickEventHandler(e:MouseEvent...
    {
    targetX = 193;
    }
    function b2ClickEventHandler(e:MouseEvent...
    {
    targetX = 20;
    }
    function b3ClickEventHandler(e:MouseEvent...
    {
    targetX = -150;
    }
    function b4ClickEventHandler(e:MouseEvent...
    {
    targetX = -322;
    }

View thread