A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [f8]Keep track of the current page

Threaded View

  1. #1
    Junior Member
    Join Date
    Oct 2006
    Posts
    11

    [f8]Keep track of the current page

    Hi hope someone can help

    On the stage, i have three buttons called, button1,2,3 In the Library, I have three movie clips called, page1 page2 page3.
    When the movie loads page1 is loaded and when you click on button2 page1 fades out and page2 fades in
    Then press on button1, page2 fades out and page1 fades back in again.
    All's well with the code and two buttons.

    My problem is when i try to add button3 I cant get the current page code to work.
    At the moment all the ( var currentPage = "page1"; ) code is doing is stoping the current page fading in again when your on that page.

    could someone help with some code that will Keep track of the current page

    This is the code for the two buttons

    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    var currentPage = "page1";

    var page1:MovieClip = this.attachMovie("page1","page1",10);
    page1._x = Stage.width/2;
    page1._y = Stage.height/2;


    button1.onRelease = function() {
    if(currentPage !="page1") {
    var fadeout:Tween = new Tween(page2,"_alpha",Strong.easeOut,100,0,1,true);
    fadeout.onMotionFinished = function() {
    var page1:MovieClip = _root.attachMovie("page1","page1",10);
    page1._x = Stage.width/2;
    page1._y = Stage.height/2;
    page1._alpha = 0;

    var fadein:Tween = new Tween(page1,"_alpha",Strong.easeOut,0,100,1,true);
    currentPage = "page1";
    }
    }
    }

    button2.onRelease = function() {
    if(currentPage !="page2") {
    var fadeout:Tween = new Tween(page1,"_alpha",Strong.easeOut,100,0,1,true);
    fadeout.onMotionFinished = function() {
    var page2:MovieClip = _root.attachMovie("page2","page2",10);
    page2._x = Stage.width/2;
    page2._y = Stage.height/2;
    page2._alpha = 0;

    var fadein:Tween = new Tween(page2,"_alpha",Strong.easeOut,0,100,1,true);
    currentPage = "page2";
    }
    }
    }
    Last edited by jsfaulds; 10-28-2006 at 07:46 PM. Reason: no title

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