A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: [F8]Stuff from first fram sneaks to second

  1. #1
    Flash Incompetent ChaseNYC's Avatar
    Join Date
    Jun 2002
    Location
    new york city
    Posts
    693

    [F8]Stuff from first fram sneaks to second

    I cannot figure this out for the life of me, I have two frames, the first is my game, then when a level is beat it goes to the second frame but stuff from the first frame are appearing on the second frame without me placing it there, does anyone have any idea why?
    mmm signature

  2. #2
    Please, Call Me Bob trogdor458's Avatar
    Join Date
    Aug 2006
    Location
    Pensacola, FL
    Posts
    915
    eeg, youll have to give more than that
    i would think just delete all the stuff before switching a level, should solve your problem outright

  3. #3
    Flash Incompetent ChaseNYC's Avatar
    Join Date
    Jun 2002
    Location
    new york city
    Posts
    693
    well, not sure what info you want, there are a bunch of layer with a bunch of movie clips on frame one, one frame two there is one layer which is empty on frame 1 that I am just using for the second frame but all this stuff from other layers in the first frame just seem to not disappear with the gotoAndStop(2) code...

    what exactly do you mean by delete
    mmm signature

  4. #4
    Please, Call Me Bob trogdor458's Avatar
    Join Date
    Aug 2006
    Location
    Pensacola, FL
    Posts
    915
    you can remove movieclips just like you attached them
    if you never attached movieclips (and they are already there in your fla), then just check on the timeline to make sure they arent there

    one of my thoughts of what might have gone wrong was you having a layer with one keyframe covering what two keyframes accomplish in another layer, if you somehow attach the mc's to said layer, they would stay when you go to the next frame
    that would be because on one layer, its a different frame, on another, its the SAME frame

    oop, did i say that right?

  5. #5
    file not found Captain_404's Avatar
    Join Date
    Apr 2006
    Posts
    457
    I don't know if you've checked for this or not, but perhaps you're gotoAndStop(2); command just isn't working. Have you put a trace on the second frame to make sure it's really getting there?

    Also, if the problem persists, you can remove any mc by

    mc.swapDepths(10000);
    mc.removeMovieClip();

  6. #6
    Flash Incompetent ChaseNYC's Avatar
    Join Date
    Jun 2002
    Location
    new york city
    Posts
    693
    but but I don't want to remove any movie clips... because once they go to the second screen and buy powerups it goes back to the first frame and the game continues. you can see the problem here: http://www.geocities.com/ihrimtest/shooter.html, takes about 30-40 seconds of fighting enemies, then you will see problem... once you see last enemies wait like 5 seconds...

    separate note: why on earth does this game run soooo slow in browser... maybe i need to reboot my comp...

    edit: this is what the second frame looks like in flash:

    Last edited by ChaseNYC; 01-24-2007 at 08:39 PM.
    mmm signature

  7. #7
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    Quote Originally Posted by ChaseNYC
    separate note: why on earth does this game run soooo slow in browser... maybe i need to reboot my comp...
    Welcome to Flash, mate.
    http://www.birchlabs.co.uk/
    You know you want to.

  8. #8
    Flash Incompetent ChaseNYC's Avatar
    Join Date
    Jun 2002
    Location
    new york city
    Posts
    693
    no no you're supposed to help me with my problem... I thought "hmm should I post that seperate note? or is it just going to lead to people answering that question instead of the one thats making me pull my hair out..." and then decided to leave the comment in... HEEELPPPPPP
    mmm signature

  9. #9
    file not found Captain_404's Avatar
    Join Date
    Apr 2006
    Posts
    457
    It might help if you posted an .fla, sometimes, it's better if people can see and play around with it themselves.

  10. #10
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139
    well theings that carried over when i played were some stars. Are these stars created dynamically?

    debug the movie to see what movieclips are on stage

    Code:
    function findChildren(parent){
    	
    	trace("parent:"+parent)
    	
    	for(var i in parent){
    		
    		var child = parent[i]
    		
    		if(typeof child == "movieclip"){
    		
    			trace("		child:"+child)
    		
    			findChildren(child)
    		}
    	}
    }
    
    findChildren(_root)
    see what movieclips are on stage, so you can remove them if their not supposed to be there
    lather yourself up with soap - soap arcade

  11. #11
    Zombie Coder EvilKris's Avatar
    Join Date
    Jun 2006
    Location
    Fukuoka, Japan.
    Posts
    796
    If you don't want to remove any movie clips from the first frame, though some are still appearing, you can make them invisible with the _visible command.

    on the top of your second frame;

    _root.(mcname)._visible=false;

    If it's more than one mc that is appearing, I suggest you put them all in one main container mc, then make it invisible.

    The above code might not work if you didn't attach the movieclips dynamically but put them on the stage. Flash has an odd habit of setting the mc's you put on stage to negative depths (in other words you can't access them). You'll need to click on the movie clip on the first stage and then put this code in the movieclip to make it accessible.

    onClipEvent(load)
    {
    this.swapDepths(anything over 0);
    }

  12. #12
    skylogic.ca MD004's Avatar
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    366
    Have you been using swapDepths() ?
    Once I had a problem where I was using swapDepths on an MC on the stage and it worked fine until I changed frames, at which point the MC wasn't removed.... anyways, here's an excerpt from link that goes into detail about it:

    Quote Originally Posted by senocular
    Another problem, which may not be so obvious, is that concerning depth-swapped timeline instances. If you use swapDepths to bring a movieclip which was placed on the timeline in Flash out of the timeline zone and into a depth above 0, then in a timeline refresh, that clip will not be removed in Flash's clearing of the timeline instances and a new instance of that clip will be placed on the screen at its original depth, effectively duplicating it. Similarly, to avoid this, don't do it. Again, its safe in controlled timelines, but otherwise, its risky. Something to be aware of nonetheless.
    ~MD

  13. #13
    Zombie Coder EvilKris's Avatar
    Join Date
    Jun 2006
    Location
    Fukuoka, Japan.
    Posts
    796
    I don't like using swapDepth() but I need to sometimes in order to recognise nested mc's. There is no other way I know about.
    In fact, I'm amazed I haven't heard about this problem before, as like most people create my characters as a single mc containing nested mc's for the different moves/animations.
    If you dynamically attach the main mc to the stage during runtime, you can do a trace on hero_mc and get back "level0.hero_mc", but try doing a trace for say hero_mc.walk
    and it'll return undefined (and yes I name the instances).
    It's the weirdest thing.
    So you can't do something like hero_mc.walk.GotoAndStop(3);. It won't work.

    However, if you add the swapDepths() code to nested 'walk' clip, it becomes recognisable and the above works fine. Sometimes the swapDepths() code creates odd errors like the nested clip being available

    This might be bad coding practice, I don't know. I've tried to look on the net for other solutions will little results. The only other practical way I can think of avoiding swapDepths() would be to keep all of your frames on the same timeline or else set up your main mc's so that you never need to refer to the child nested mc's in any way.

  14. #14
    Flash Incompetent ChaseNYC's Avatar
    Join Date
    Jun 2002
    Location
    new york city
    Posts
    693
    wow thanks, woke up to all the answers I needed, the score and life bar at the top had some swap depth and one of the background stars was being created... I still don't see why the swap depth one would carry over but at least I know what the problem is and how to fix it...

    Thanks SO MUCH!

    ChaseNYC
    mmm signature

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