dcsimg
A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Hi. Need Help loading an internal mc into an empty mc

  1. #1
    Junior Member
    Join Date
    Mar 2009
    Posts
    18

    Question Hi. Need Help loading an internal mc into an empty mc

    I have a button that each time it's being press, it will load a mc that's located in the library.
    The movie clip is text that's located in a mc, that i can fade in the text when the parent mc is called (meaning, text in a mc in a mc).

    How can I do this actrion, where each time the button is pressed the mc will load? tried a few things such as loadmovie, attachmovie, but some how it doesn't work for me.

    I gave my parent mc an instant and tried with the butoon calling it. didn't work.

    Any suggestions maybe?

    I M using AS2

    Thanks

  2. #2
    Junior Member
    Join Date
    Mar 2009
    Posts
    18
    Hey Guys No one has an answer??

  3. #3
    Senior Member
    Join Date
    Jan 2004
    Posts
    141
    Don't forget to add 'linkage' to your MC in the library. In the Library, right-click your MC, select 'Linkage'. Select the checkbox 'Export for Actionscript' and give it an identifier at the top. This 'Identifier' is the idName you use when you use attachMovie etc.....

  4. #4
    Junior Member
    Join Date
    Mar 2009
    Posts
    18
    Hi, Thanks for your reply.

    I know about the Linkage, but is it correct to write a script on the button that is located in a mc which is also in a mc as:

    on (release) {
    main.attachMovie("mc_mail","clip1",1);

    }

    Is this script correct?

    The mc_mail is the mc that is in the library.
    I also tried creating an empty mc, and calling the mc in the library into it, but also that didn't work for me, maybe the code was wrong as well.

    What code would you use to call an internal mc from a library?
    Thanks

  5. #5
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    just write the right path to 'main'. If 'main' is on the main timeline, and that button is 2 levels up, you may need to say _parent._parent.main

    gparis

  6. #6
    Junior Member
    Join Date
    Mar 2009
    Posts
    18
    Hi,

    Thanks for your help, I managed to load the unternal MC.

    I have a new problem though, When tring to unload it.
    I want that mc to unload when i press a dif button.
    I tried a few things:
    * removeMovieClip(_root.mc_emptymail);
    * removeMovieClip(this.emptymail);
    * mc_emptymail.removeMovieClip();

    The mc_emptymail is the empty mc I use for attaching the internal mc from the library.

    Thanks again for your help

  7. #7
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Post the working code you use to attach (not 'load' - that's confusing) and say if that 2nd button is at the same place than the 1st (so the path to the container is the same).

    gparis

  8. #8
    Junior Member
    Join Date
    Mar 2009
    Posts
    18
    Hi gparis,

    Thanks again for your reply.

    I have the 2 buttons on the same path, which is on the main time line. (they are both buttons located in a movie clip).

    the button For loading the mc from the library is:
    on (release) {
    unloadMovie(_root.photo.empty);
    mc_emptymail.attachMovie("mc_Mail","mc_Mail",0);
    }


    (the unload code i used is for clearing the loaded photo in the code below)

    The code for loading a pic and simultaneously unloading the mc mc_Mail (the mc I load from the library into the empty mc, mc_emptymail):

    on (rollOver) {
    loadMovie("Gallery/Adam_View.png", photo.empty);
    this.mc_emptymail.removeMovieClip();

    }


    I hope i was clear enough.
    Again, Thanks for your help

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