A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: focus of play(); when it is inside a function

  1. #1
    Member
    Join Date
    Mar 2009
    Posts
    31

    Question focus of play(); when it is inside a function

    Have a small MC that is used several times (in main time line and in other MCs). I have a pause function inside the MC, that should pause its play for a few seconds, regardless of where it is placed. This is the pause I'm using:

    Actionscript Code:
    var nInterval = setInterval(Pause, 3000);

    function Pause() {
        clearInterval(nInterval);
        play();
    }

    Only problem is the play() starts not only the timeline in the MC, but also the master timeline.

    As the play() is inside a function in the MC, I can't seem to address the MC's timeline with commands like "this.".

    Any help? I"m sure it is something simple.
    Thanks!

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518
    You can pass parameters through the setInterval function...
    Code:
    var nInterval = setInterval(Pause, 3000, mcToPlayNameHere);
    function Pause(mc) {
    	clearInterval(nInterval);
    	mc.play();
    }

  3. #3
    Member
    Join Date
    Mar 2009
    Posts
    31
    Quote Originally Posted by dawsonk View Post
    You can pass parameters through the setInterval function...
    Code:
    var nInterval = setInterval(Pause, 3000, mcToPlayNameHere);
    function Pause(mc) {
    	clearInterval(nInterval);
    	mc.play();
    }
    Passing this thru setInterval did indeed work.

    Thanks!


    Still find it a little strange that a function has no awareness of the item that called it. Or am I just thinking of this wrong?

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