dcsimg
A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: load mc with mc ??

Hybrid View

  1. #1
    Senior Member
    Join Date
    Jul 2002
    Posts
    430

    load mc with mc ??

    i have an mc with a button inside of it with this code:

    on (rollOver) {
    gotoAndPlay(2);
    }
    on (rollOut) {
    gotoAndPlay(6);
    }


    how do I add so when you click, it loads another MC into the scene ? do I need to put another mc or button with action on it on top of this mc inside the scene instead of the MC itself ?

  2. #2
    How should I know!? Biff Tanon's Avatar
    Join Date
    Jun 2001
    Posts
    748
    Hi!
    Lets say your first MC is called ClipOne.
    You have your button that you talk about inside of ClipOne. When you click the button you want another MC to load inside of ClipOne right?
    All you have to do is create another empty MC to hold the external swf file, and give that empty MC an instance name. Lets say you called it ClipTwo.
    So on your button you would need this:
    code:

    on(release) {
    loadMovie("yourSWF.swf", _root.ClipOne.ClipTwo);
    }



    Hope that helps!
    [something cool goes here]

  3. #3
    Senior Member
    Join Date
    Jul 2002
    Posts
    430
    not really. Basically I have a website and created an mc with a button inside of it with the code I posted. now I have the mc on the stage and what I want to happen is when I click this mc, another mc will load/play on the main timeline in the site.

  4. #4
    How should I know!? Biff Tanon's Avatar
    Join Date
    Jun 2001
    Posts
    748
    Ok,
    The code for your button should be
    code:

    on(release) {
    loadMovie("movieName.swf", _root.containerName) {
    }


    That will load your new movie into a clip that is on the main stage.
    You just have to create the empty clip and give it a name. Then insert that name instead of "containerName"
    [something cool goes here]

  5. #5
    Senior Member
    Join Date
    Jul 2002
    Posts
    430
    so the only way to play an mc by pressing a button is to created in an external swf ??

  6. #6
    How should I know!? Biff Tanon's Avatar
    Join Date
    Jun 2001
    Posts
    748
    That is usually the best way yeah.
    I would just create a new file (swf) that had what you wanted for your MC that got loaded in when you click. It will give you far more contol over the clip if you load it in like that.
    Can you post your fla file and I can take a look?
    [something cool goes here]

  7. #7
    Senior Member
    Join Date
    Jul 2002
    Posts
    430
    here:
    pixelinsomnia.com/dl/cartoonsite.fla

    basically when you click that animated giraffe button, i want the MC called (giraffetalk) to play in my site.

  8. #8
    How should I know!? Biff Tanon's Avatar
    Join Date
    Jun 2001
    Posts
    748
    AHHHH I see what you are trying to do.
    Give me a sec and I will try to get something for ya.
    [something cool goes here]

  9. #9
    How should I know!? Biff Tanon's Avatar
    Join Date
    Jun 2001
    Posts
    748
    Well It's too large to upload so I will try to walk you through.

    Make a new layer (I called it giraffe) and put a keyframe on frame 106.
    Put your giraffetalk MC on the stage where/how you want it and give it an instance name of giraffe.
    Double click the giraffe MC and create a new later called actions. On the first and last frame put at stop(); action. Then scoot all of the tween of the giraffe over one frame. Follow? That way on the first frame nothing shows up untill you tell it to.
    Now, go back to the main timeline. On your button that you have the rollover scripts, put this on there:
    code:

    on(release) {
    _root.giraffe.gotoAndPlay(2);
    }



    See what we did?
    Let me know if you have any problems. Sorry for all of the confusion.
    [something cool goes here]

  10. #10
    Senior Member
    Join Date
    Jul 2002
    Posts
    430
    works ! thanks !!

  11. #11
    Senior Member
    Join Date
    Jul 2002
    Posts
    430
    my site is already over 700kb.. maybe i should have all my mc's load from an external swf.. the only problem is this will be a talking giraffe that tells a joke and so i'll need to do something clever when you click and are waiting for the giraffe to show up.

    One more question, anyway to code the script so it loads an MC from a total of 10 in order so first time you click it in the site, plays MC1, then next time you click it plays MC2 etc. untill it plays all 10 and goes back to MC1 again ??

  12. #12
    Senior Member
    Join Date
    Jul 2002
    Posts
    430
    any hints ?

  13. #13
    Senior Member
    Join Date
    Jul 2002
    Posts
    430
    please.......please

  14. #14
    Senior Member
    Join Date
    Jul 2002
    Posts
    430
    desperate....

  15. #15
    Senior Member
    Join Date
    Jul 2002
    Posts
    430
    ok now i setup a second scene and when I click the button, it won't play..
    actionscript says:

    on (release) {
    _root.giraffe.gotoAndPlay(2);
    }

    should the _root be changed once you use the button in a different scene ?? what should it say for scene2 then ?

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