A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Sliding Content

  1. #1
    Junior Member
    Join Date
    Mar 2007
    Posts
    10

    Unhappy Sliding Content

    Hi i am using Flash cs3, As2.0

    and , i need one help ! with kirupa's sliding menu
    http://www.kirupa.com/developer/flash8/slidingMenu.htm
    on this tutorial. Kirupa Has done with 5 Buttons to slide 5 contents.

    but I need only Prev , next Buttons to slide

    var currentPosition:Number = contentHold.content1._x;
    var startFlag:Boolean = false;
    menuSlide = function (input:MovieClip) {
    if (startFlag == false) {
    startFlag = true;
    var finalDestination:Number = input._x;
    var distanceMoved:Number = 0;
    var distanceToMove:Number = Math.abs(finalDestination-currentPosition);
    var finalSpeed:Number = .3;
    var currentSpeed:Number = 0;
    var dir:Number = 1;
    if (currentPosition<=finalDestination) {
    dir = -1;
    } else if (currentPosition>finalDestination) {
    dir = 1;
    }
    this.onEnterFrame = function() {
    currentSpeed = Math.round((distanceToMove-distanceMoved+1)*finalSpeed);
    distanceMoved += currentSpeed;
    contentHold._x += dir*currentSpeed;
    if (Math.abs(distanceMoved-distanceToMove)<=1) {
    contentHold._x = maskMovie._x-currentPosition+dir*distanceToMove;
    currentPosition = input._x;
    startFlag = false;
    delete this.onEnterFrame;
    }
    };
    }
    };




    /////////////////////////////////

    var _first:Boolean = true;
    function goOn():Void {
    if (_first) {
    _first = false;
    menuSlide(contentHold.content2);
    } else {
    _first = true;
    menuSlide(contentHold.content1);
    }

    }
    var myDelay:Number = setInterval(goOn, 10000);



    ////////////////////////////////////

    b1.onRelease = function() {

    menuSlide(contentHold.content1);
    };
    b2.onRelease = function() {

    menuSlide(contentHold.content2);
    };



    This code is Sliding only 2 contents, need to slide 5

    Please .....Help!!!!!!!

  2. #2
    Member
    Join Date
    Aug 2008
    Posts
    33
    Would you please upload YOUR fla file?

    At the end of code above you put:

    b1.onRelease = function() {

    menuSlide(contentHold.content1);
    };
    b2.onRelease = function() {

    menuSlide(contentHold.content2);
    };


    well, this is why you can only see 2 slide content,

    You should put:

    b1.onRelease = function() {
    menuSlide(contentHold.content1);
    };
    b2.onRelease = function() {
    menuSlide(contentHold.content2);
    };
    b3.onRelease = function() {
    menuSlide(contentHold.content3);
    };
    b4.onRelease = function() {
    menuSlide(contentHold.content4);
    };
    b5.onRelease = function() {
    menuSlide(contentHold.content5);
    };


    Do you mean that?!

Tags for this Thread

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