A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: Movie clip inside a Movie clip

  1. #1
    Your Mom Is A Registered User
    Join Date
    Jul 2004
    Posts
    42

    Movie clip inside a Movie clip

    I have a problem with a game I am making. I have several Movie Clips within a movie clip. Each is in a seperate frame. I want the movie clip inside the movie clip to play and the parent movie clip to stay at the frame it is at. But the frame of the outer movie clip needs to be changed by a variable. I have tried many things, but none of them work.
    Here is what I have tried:
    1. Each movie clip has 1 frame. The actions of the frame are stop() if (_global.Qaction == 1) gotoAndStop(_global.action). Inner movie clip has no actions.
    Results: does not change frames
    2. Each movie clip has 1 frame. The action of the frame is gotoAndPlay(_global.action)
    Results: Inner movie clips are always on frame 1
    3. Each movie clip has 2 frames. The action of the frame is gotoAndPlay(_currentframe) The action of the movie clip is if (_global.Qaction == 1) _parent.gotoAndPlay(_global.action)
    Results: Plays through the parent Movie Clip
    4. Each movie clip has 2 frames. The action of the frame is gotoAndPlay(_currentframe-1) The action of the movie clip is if (_global.Qaction == 1) _parent.gotoAndPlay(_global.action*2)
    Results: does not change frames
    5. Each movie clip has 2 frames. The actions of the frame areis gotoAndPlay(_currentframe-1) and if (_global.Qaction == 1) _parent.gotoAndPlay(_global.action*2)
    Results: does not change frames

  2. #2
    Flasher
    Join Date
    Jun 2005
    Posts
    1,365
    Try the "if" action.

  3. #3
    Your Mom Is A Registered User
    Join Date
    Jul 2004
    Posts
    42
    uh if u read my message u wud have seen i used it in everything i tried.

  4. #4
    Flasher
    Join Date
    Jun 2005
    Posts
    1,365
    Oh, sorry I didn't read the whole thing.

  5. #5
    Learn more, know less.
    Join Date
    Jul 2004
    Posts
    169
    Question: Will the variable for the parent frame be determined by a button press or another action of some sort?

    I think I can solve your issue if you haven't already, but I need to know more. Can you explain the way the game is supposed to work in terms of user input, or can you provide a file?

  6. #6
    Your Mom Is A Registered User
    Join Date
    Jul 2004
    Posts
    42
    wait just a sec, I can give you the current .fla file, its slightly different, i was trying something else, and it different, but it doesnt work
    How come Normal Mode Script is harder to use than Expert Mode.

  7. #7
    Your Mom Is A Registered User
    Join Date
    Jul 2004
    Posts
    42
    Here it is:
    Attached Files Attached Files
    How come Normal Mode Script is harder to use than Expert Mode.

  8. #8
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    On(Release) ---- [watever this 1 is]
    _Root.MC.play -----[plays the MC watever layer it's on!]
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  9. #9
    Your Mom Is A Registered User
    Join Date
    Jul 2004
    Posts
    42
    On(Release) ---- [watever this 1 is]
    _Root.MC.play -----[plays the MC watever layer it's on!]
    what? I dont understand this at all. Pleaze elaborate.
    Last edited by QRS_III; 10-02-2005 at 02:55 PM. Reason: question might not have been clear
    How come Normal Mode Script is harder to use than Expert Mode.

  10. #10
    Learn more, know less.
    Join Date
    Jul 2004
    Posts
    169

    Ok, let's try again.

    Ok, I have gone through your script and tried it out.

    First comment, 12fps is real friggin' slow, you can get away with a lot more than that...it'll give you smoother motion.

    Now that I'm familiar with your swf, what exactly are you having trouble with? I noticed that pressing "left" makes the guy fall off the screen.

    Some aspects of your code don't seem to make sense...maybe because they're typos or something, maybe because I just don't get it. For example you have a variable called _global.nactions a bunch of times, but yet that variable doesn't correspond to anything and wasn't initialized like the others.

    However, I think I get the jist of what you're trying to do. You want the MasterBob MC to go to a certain position when right, left, up, down, etc. are pressed, along with some other code to be executed, yes?

    First off, some of your code won't work on the "you" MC because there are many frames in that MC and your code needs to execute every frame, not just when it returns to frame 1, know what I'm saying? You can only do that with an MC that has one frame, total.

    There is an easier way that will save you a lot of stress:

    First, take your man MC with all the different positions, and put it in a new, empty MC..call it ManContainerMC or something. DO NOT put anything else in this MC and make ONLY one frame. You will no longer need the frame actions in your manMC, except to stop(); it at the appropriate times.

    THEN, forget about all of your _global.actions stuff. Just delete it. On the ManContainerMC, make it check to see if the keys are pressed on (enterFrame). Since there is only one frame in the containerMC, it will be checking constantly. If they are pressed, do the appropriate movements (_root.ManContainerMC._x +=walkspeed, etc.) and just add _root.ManContainer.Man.gotoAndPlay("rightStand") or whatever for each key.

    Make sure to include an else statement at the end that restores the man to his default position if nothing is pressed.

    That should do the trick.

    Let me know if that's confusing or explained poorly.

  11. #11
    Your Mom Is A Registered User
    Join Date
    Jul 2004
    Posts
    42
    thank you, this may help
    1. _global.nactions is a variable i was using to debug it, I shud have deleted it.
    2. _global.action variable will be vital later in a part I havent made yet so i cant delete it
    3. movement already works fine i dont need your help on that(thank you NEway tho)

    what do you mean by put stop(); in the "appropriate times"? what are the appropriate times?
    How come Normal Mode Script is harder to use than Expert Mode.

  12. #12
    Your Mom Is A Registered User
    Join Date
    Jul 2004
    Posts
    42
    nvm i fiixed it w/out using NE of your suggestions
    How come Normal Mode Script is harder to use than Expert Mode.

  13. #13
    Your Mom Is A Registered User
    Join Date
    Jul 2004
    Posts
    42
    all I did was change the actions in the frame to:
    gotoAndPlay((_global.action-1)*10+1);

    thank you for noticing nactions and suggesting upping the frame rate to 20 fps
    How come Normal Mode Script is harder to use than Expert Mode.

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