A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [RESOLVED] [HELP!] Remove MC when hittest

  1. #1
    Member
    Join Date
    Mar 2008
    Location
    England
    Posts
    69

    resolved [RESOLVED] [HELP!] Remove MC when hittest

    how do you delete completely or remove an MC called 'shot' when it hits a wall called 'wall' i have tried some hitest stuff but it doesn't seem to quite work, thanks

    funky...

  2. #2
    Junior Member
    Join Date
    Jun 2008
    Posts
    18
    use removeMovieClip to delete the shot.

  3. #3
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    PHP Code:
    if(shot.hitTest(wall)){ 
         
    shot.removeMovieClip();
     } 
    here is the entry in the Flash5 manual:
    http://www.adobe.com/support/flash/a...ionary534.html
    Last edited by renderhjs; 06-13-2008 at 09:22 AM.

  4. #4
    Member
    Join Date
    Mar 2008
    Location
    England
    Posts
    69
    Quote Originally Posted by renderhjs
    PHP Code:
    if(shot.hitTest(wall)){ 
         
    shot.removeMovieClip();
     } 
    here is the entry in the Flash5 manual:
    http://www.adobe.com/support/flash/a...ionary534.html
    thanks but do i add this to wall or shot MC or just in the frame?

  5. #5
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    try to rather not put code on MovieClips,- its a unhealthy practice. Makes your code clumpy, bloated and scattered in a ugly way.

    anyway put it in whatever event code,- if you have a button,- on the stage liket his

    PHP Code:
    someButton.onRelease = function(){
        if(
    shot.hitTest(wall)){ 
            
    shot.removeMovieClip(); 
        }

    if you have a frame based loop perhaps like this:
    PHP Code:
    _root.onEnterFrame = function(){
        if(
    shot.hitTest(wall)){ 
            
    shot.removeMovieClip(); 
        }


  6. #6
    talk to the hand! Never_land:('s Avatar
    Join Date
    Nov 2007
    Location
    your mother's bedroom
    Posts
    490
    Try
    removeMovieClip(shot)
    if it doesn't work

  7. #7
    Member
    Join Date
    Mar 2008
    Location
    England
    Posts
    69

    resolved

    yea, thanks i found unload movie clip worked in the end the others didnt for some reason it must not be in the right context of code, eg if you load movie clip u must unload...

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