SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2004
    Location
    Oklahoma
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    onRelease with setInterval

    In a flash mx site I am creating, I have a movie clip of buttons that navigates to different pages. I want to create an animation for when a page is changed so that the current page flies out and the new page to be viewed flies in.

    In the button movie clip I have the following actionscript. The problem is that as soon as I release a button, the next page is displayed and there isn't a 1 second delay to allow for the Page Out animation to finish.

    I also tried to use the ._currentframe property, but that also wasn't working as I think I am not using it in the correct location.

    I hope this makes sense!

    Thanks in advance for any help

    Code:
    //Button Actions
    
    //initialize all the buttons
    for (var i=1; i<=2; i++) {
    	this["Speaker"+i].onPress = Pressed;
    	this["Speaker"+i].onRelease = Released;
    	this["Speaker"+i].Name = "Speaker"+i;
    }
    
    currentPage = this["Speaker1"].Name;
    
    function Pressed(){
    	//Play the Animation Out Frames for the page currently displayed
    	if (currentPage <> this.Name){
    		_root.Conference[currentPage].gotoAndPlay("Out");
    		currentPage = this.Name;
    	}
    }
    
    function Released(){
    	//if (_root.Conference[CurrentPage]._currentframe == 40){
    	//changePage(this.Name);
    	//}
    	waitTime = setInterval(changePage(this.Name), 1000);
    }
    	
    function changePage(newPage){
    	clearInterval(waitTime);
    	//Go to the new Page to be displayed
    	_root.Conference.gotoAndPlay(newPage);
    }

  2. #2
    SitePoint Wizard jim_morrison3's Avatar
    Join Date
    Apr 2004
    Location
    UK
    Posts
    2,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    I cant think much at the moment but did you try placing the changePage() function in a previous frame or the first frame of main timeline ? Maybe then it should work.
    Good Luck!
    There are things known and Things unknown
    And in between are the Doors.
    I love hand Coding.

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2004
    Location
    Oklahoma
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply!

    No luck.

    I tried putting it in the first frame of the Main Timeline and then the next page wouldn't even come in because I don't think it could find that function.

    I only have 1 frame in the buttons Movie Clip. So I expanded it to 2 frames and placed the changePage() function on the first frame. But as soon as I released the mouse, the changePage() function was called and there wasn't a 1 second delay.


Bookmarks

Posting Permissions

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