A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [F8] Delaying a script?

  1. #1
    Senior Member
    Join Date
    Jul 2003
    Posts
    119

    [F8] Delaying a script?

    Hello all. I currently have this script

    PHP Code:
    onClipEvent (enterFrame) {
        if ((
    this.hitTest(_root.charClip))) {
            
    _root.gotoAndPlay(2);
        }

    This oviously does that when the charClip hits the movieclip it immediatly jumps to frame 2.

    Now is there a line i can add to this script that delays the jumping with one second?

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518

    Maybe you can adapt this to what you are trying to do...

    Code:
    onClipEvent (load) {
    	var hitme = false;
    	var intID;
    	function goTo() {
    		clearInterval(intID);
    		_root.gotoAndPlay(2);
    	}
    }
    onClipEvent (enterFrame) {
    	if ((this.hitTest(_root.charClip)) && !hitme) {
    		hitme = true;
    		intID = setInterval(goTo, 1000);
    	}
    }

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