A Flash Developer Resource Site

Results 1 to 17 of 17

Thread: [RESOLVED] Visible to Invisible after idle.

  1. #1
    Member
    Join Date
    Sep 2009
    Posts
    57

    resolved [RESOLVED] Visible to Invisible after idle.

    how to make a clip invisible after 4 seconds of idle.

  2. #2
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    define "idle"
    Z¡µµ¥ D££

    Soup In A Box

  3. #3
    Senior Member
    Join Date
    Jun 2008
    Posts
    549
    You would need to use the getTimer() method to work out the time the movie clip has been idle.

  4. #4
    Member
    Join Date
    Sep 2009
    Posts
    57
    idle as in after the clip has not been used, it turns invisible. In my case the clip I want to make invisible is the control panel to my video gallery, which after 4 seconds I want to turn invisibe.

  5. #5
    Member
    Join Date
    Sep 2009
    Posts
    57
    Quote Originally Posted by ilike2 View Post
    You would need to use the getTimer() method to work out the time the movie clip has been idle.
    how do I use the getTimer() method for a clip?

  6. #6
    Senior Member
    Join Date
    Jun 2008
    Posts
    549
    Quote Originally Posted by danddleo View Post
    how do I use the getTimer() method for a clip?
    Place in a if statement like below:

    Code:
    if (getTimer()>4000) {
    		my_mc._visible = false;
    }

  7. #7
    Member
    Join Date
    Sep 2009
    Posts
    57
    ok I used it on the clip but after it disappeared completely after i clicked on one of the control panel buttons. here is the code I used.



    Code:
    on (rollOver){
    	_parent.ba._visible = true;
    	_parent.bb._visible = true;
    	_parent.bc._visible = true;
    	_parent.bd._visible = true;
    	_parent.controlpanel._visible = true;
    	if (getTimer()>4000) {
    		_parent.controlpanel._visible = false;
    		_parent.ba._visible = false;
    		_parent.bb._visible = false;
    		_parent.bc._visible = false;
    		_parent.bd._visible = false;
    	}
    }

  8. #8
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    I don't think getTimer() is exactly what you want...

    The getTimer() function tells you the number of milliseconds that have passed since the movie started playing. What you need is how long it has been since the user last tried to access the movie clip...

    I made a quick example of one way to do it. It has an explanation inside, and fully commented code. Hope it helps!

    -Zippy Dee
    Attached Files Attached Files
    Z¡µµ¥ D££

    Soup In A Box

  9. #9
    Member
    Join Date
    Sep 2009
    Posts
    57
    Quote Originally Posted by ZippyDee View Post
    I don't think getTimer() is exactly what you want...

    The getTimer() function tells you the number of milliseconds that have passed since the movie started playing. What you need is how long it has been since the user last tried to access the movie clip...

    I made a quick example of one way to do it. It has an explanation inside, and fully commented code. Hope it helps!

    -Zippy Dee
    can I put a timer to hide after a mousemove function. here is the code i used, all I need is a timer that will make it invisible after a mousemove function. I feel this will be easier than a get time function.

    Code:
    onMouseMove = function()
    {
    	ba._visible = true;
    	bb._visible = true;
    	bc._visible = true;
    	bd._visible = true;
    	controlpanel._visible = true;
    };

  10. #10
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    Code:
    timer = 0;
    onEnterFrame = function(){
    	if(timer <= 60){ //change that number to the desired number of frames to wait before hiding
    		timer ++;
    	}else{
    		ba._visible = false;
    		bb._visible = false;
    		bc._visible = false;
    		bd._visible = false;
    		controlpanel._visible = false;
    	}
    }
    onMouseMove = function(){
    	ba._visible = true;
    	bb._visible = true;
    	bc._visible = true;
    	bd._visible = true;
    	controlpanel._visible = true;
    	timer = 0;
    }
    That should be it.
    Z¡µµ¥ D££

    Soup In A Box

  11. #11
    Member
    Join Date
    Sep 2009
    Posts
    57
    Quote Originally Posted by ZippyDee View Post
    Code:
    timer = 0;
    onEnterFrame = function(){
    	if(timer <= 60){ //change that number to the desired number of frames to wait before hiding
    		timer ++;
    	}else{
    		ba._visible = false;
    		bb._visible = false;
    		bc._visible = false;
    		bd._visible = false;
    		controlpanel._visible = false;
    	}
    }
    onMouseMove = function(){
    	ba._visible = true;
    	bb._visible = true;
    	bc._visible = true;
    	bd._visible = true;
    	controlpanel._visible = true;
    	timer = 0;
    }
    That should be it.
    I tried this code put it shifts everything to the left and my progress bar does not move.

  12. #12
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    if you have another onEnterFrame function somewhere else, then just put that onEnterFrame code into the one you already have.
    Z¡µµ¥ D££

    Soup In A Box

  13. #13
    Member
    Join Date
    Sep 2009
    Posts
    57
    Quote Originally Posted by ZippyDee View Post
    if you have another onEnterFrame function somewhere else, then just put that onEnterFrame code into the one you already have.
    ok, basically what I am trying to do, is do the same effect done by the YouTube control panel when you view the video in fullscreen mode. The controlers fade out until the mouse moves again. does that help you better understqnd what I am trying to do?

  14. #14
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    I understand exactly what you are trying to do. I don't see why that code I gave you wouldn't work.
    Z¡µµ¥ D££

    Soup In A Box

  15. #15
    Member
    Join Date
    Sep 2009
    Posts
    57
    Quote Originally Posted by ZippyDee View Post
    I understand exactly what you are trying to do. I don't see why that code I gave you wouldn't work.
    If I post the files, could you see if you can fix it? That may be easier.

  16. #16
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    Yeah, I can take a look. That will probably be easier.
    Z¡µµ¥ D££

    Soup In A Box

  17. #17
    Member
    Join Date
    Sep 2009
    Posts
    57
    here is the file.
    Attached Files Attached Files
    Last edited by danddleo; 01-07-2010 at 10:47 PM.

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