A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: remove a movie clip from external movieclip

  1. #1
    Senior Member
    Join Date
    May 2004
    Posts
    627

    remove a movie clip from external movieclip

    Hi, what should I do if I want to remove a clip inside a external movieclip. In the external clip, I have a clip called "pic_mc". Inside that, I have a button called"close_btn". When I click it, I want to make pic_mc disappear.

    This is the script I wrote inside pic_mc

    close_btn.onPress = function(){
    _parent.pic_mc.removeMovieClip();
    }

    When I click on it, nth happens. Does anyone know what going on?

  2. #2
    Senior Learner garion1's Avatar
    Join Date
    Dec 2001
    Location
    South Africa
    Posts
    483

    It won't work

    Hi

    removeMovieClip() will only remove a movie clip instance created with:
    1. duplicateMovieClip()
    2. MovieClip.duplicateMovieClip()
    3. MovieClip.createEmptyMovieClip()
    4. MovieClip.attachMovie()


    Rather leave your MC 'pic_mc' in the library and assign it the instance name 'pic_mc' in linkage. Then, use attachMovie() to add it to the stage and use removeMovieClip() to remove it with your button.
    "A day without laughter is a day wasted." - Charlie Chaplin

  3. #3
    Senior Member
    Join Date
    May 2004
    Posts
    627
    Thank you very much. I change to attached movie first. it seems not working.

    Can anyone give me a hand?

    here is the following I use to attached the movie on the first frame

    attachMovie("3346456456", "pic_mc", this.getNextHighestDepth(), {_x:0, _y:-5})

  4. #4
    Senior Learner garion1's Avatar
    Join Date
    Dec 2001
    Location
    South Africa
    Posts
    483
    Here you go. Look at my code and the symbols in the library.

    Your code is just written wrong:
    attachMovie("3346456456", "pic_mc", this.getNextHighestDepth(), {_x:0, _y:-5})

    should read:
    attachMovie("pic_mc", "3346456456", this.getNextHighestDepth(), {_x:0, _y:-5})

    where '3346456456' is the MovieClip you are attaching 'pic_mc' to.
    Attached Files Attached Files
    Last edited by garion1; 02-13-2008 at 06:16 AM.
    "A day without laughter is a day wasted." - Charlie Chaplin

  5. #5
    Senior Member
    Join Date
    May 2004
    Posts
    627
    thanks, that work

    I have got 1 more question.

    When I put that by x, y method to position I used before by drag and drop the movieclip, I only see the bottom right part of the clip. so I think Flash measure from the middle of the clip.

    How to do if I want to attach the movieclip by the topleft side rather than the middle of the clip?

    You have given me a right direction, man

  6. #6
    Senior Learner garion1's Avatar
    Join Date
    Dec 2001
    Location
    South Africa
    Posts
    483
    All I did was center my content in the clip (pic_mc).

    Just open pic_mc and realign everything to 0,0 i.e. to the right of and below the center marker.
    "A day without laughter is a day wasted." - Charlie Chaplin

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