Results 1 to 3 of 3
  1. #1

    HitTest: Getting the BALL in the HOOP

    I am trying to create a very simple "drag-and-drop move to the next frame" movie. I have searched the forums and tried a number of things, but to no avail.

    I have a three frame movie. The first two frames loop with a movie clip of a BALL and a movie clip of a HOOP. Frame 2 has an action of gotoAndPlay(1); to create the loop. When the user "grabs" the BALL via this hitTest, I want the movie to advance to Frame 3 when BALL goes into the HOOP.

    The BALL is on its own layer with the following code:

    onClipEvent (load) {
    _x = 78;
    _y = 163;
    speed = 1;
    }
    onClipEvent (enterFrame) {
    if (hitTest (_root._xmouse, _root._ymouse, true)) {
    endX = _root._xmouse;
    endY = _root._ymouse;
    _x += (endX - _x) / speed;
    _y += (endY - _y) / speed;
    }
    }

    The HOOP movie is on its own layer with the following code:

    onClipEvent (enterFrame) {
    if (_root.hitTest(_root.ball)) {
    _root.gotoAndPlay(3);
    }
    }

    This doesn't work at all. When the HOOP code is in movie, the BALL script doesn't work. When I remove the HOOP script, the BALL moves around as it should.

    I've tried putting the movies on the same layer--no good. Adding a stop(); command in place of the loop--no good. Switching layer order--no good.

    Any help or alternatives would be appreciated.

    Woody

  2. #2
    hoop

    onClipEvent (enterFrame) {
    if (this.hitTest(_root.ball)) {
    _root.gotoAndPlay(3);
    }
    }
    <embed src=http://www.m3style.lv/karlis/kirupa_footer.swf width=300 height=60 style="border:1px solid #000000"></embed>
    >website

  3. #3
    and btw. enterFrame loops itself you dont have to loop with frames
    <embed src=http://www.m3style.lv/karlis/kirupa_footer.swf width=300 height=60 style="border:1px solid #000000"></embed>
    >website

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
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012