PDA

View Full Version : A remove movie clip problem


Malignus
01-05-2007, 08:56 PM
I'm having a sort of a strange problem. In both multiplayer and single player, I use swapdepths commands on all of the character movieclips, then remove them either when they die or when the battle ends.

In single player, this does not result in any permanent change to the battle; a player may then go back and replay it however much he likes, and all of the characters will be there again when he does so.

This isn't turning out that way in multiplayer, however--once an MC of a certain instance name is dead, it's dead eternally. The removed MCs won't return even if I send the player to another scene and have him return; not even if I stick blank keyframes on the character layer before the battle loads. The game "remembers" that these MCs been removed and won't show them again. In fact, it won't even show different MCs that happen to have the same instance name in another multiplayer battle. I'm at a loss as to what is causing this to occur in multiplayer but not single player.

Does anyone have any ideas as to what might cause that to happen? :confused:

Jared
01-05-2007, 09:09 PM
Are you removing the movieclips with the removeMovieClip method or are you getting rid of them through some other method. Also are the movieclips being attached onto the stage when you start a battle?

Malignus
01-05-2007, 09:20 PM
They aren't attached via AS, no--but they are swapdepthed. And yeah, I'm using removeMovieClip().

(Incidentally, after messing around with it for the past hour and a half, I finally fixed the problem, though I still have absolutely no clue what was causing it in the first place.)

doomlord
01-07-2007, 10:47 PM
the nooby way which is how i'd do it if i was having this problem is just move it to ._x 800 like off the stage even tho im so bad i dont even know if you can do that heh but rest of the time i use removeMovieClip method but seeing you have that problem and if you were desperate id try my way

Matt
01-08-2007, 05:24 AM
the nooby way which is how i'd do it if i was having this problem is just move it to ._x 800 like off the stage even tho im so bad i dont even know if you can do that heh but rest of the time i use removeMovieClip method but seeing you have that problem and if you were desperate id try my way
GAH don't do that in a big game or you well have lag city!

Logic
01-08-2007, 02:37 PM
You should really dynamically attach the movieclips using ActionScript and then remove then with ActionScript as needed instead of placing them ahead of time if they are able to be changed during the course of the game.

If you really got desperate for an easier method though, you could just hide them:

myInstance._visible = false;

Malignus
01-08-2007, 02:50 PM
I know I should just use attachMovie, but unfortunately my attempts so far to rewrite the code on the character movieclips so that it runs from the main timeline have failed.

Logic
01-08-2007, 03:06 PM
And I'm guessing changing now would require a major coding overhaul so keep working how you have been. In future coding endeavors you'll know what to do then so you won't have to deal with this ;)

Jacob
01-08-2007, 03:23 PM
duplicateMovieClip() is not that different than attachMovie(). You just make sure the linkage is on, delete the original clip and alter a couple similar parameters.

Of course if you were using onClipEvents on the original or a similar bad practice then it does make it a little more difficult to change than normal.

doomlord
01-09-2007, 03:54 AM
professionals say onClipEvent is bad practice but noobs like myself don't understand the complicated way

Matt
01-09-2007, 05:26 AM
What complicated way?
yourmc.onEnterFrame=function(){
}
That way?

Jared
01-09-2007, 09:47 AM
professionals say onClipEvent is bad practice but noobs like myself don't understand the complicated way
I'm not a professional and I would rather shoot myself than use onClipEvents. Once you gone oop you never look back.

arkhan
01-09-2007, 10:29 AM
but jared..you must understand..it all comes in time for everyone..AS1 is just easyer for any beginer..you cant push as3 concepts on to someone who will simply not grasp it..and the fact they dont grasp it, doesnt justify not helping them...you should, however, slowly teach good practices and other things.

Jared
01-09-2007, 11:06 AM
But many of you all are still programming in flash5 for all intents and purposes by using onclipevents. It's just not a oo way of doing things.
If I had to look through countless movieclips for code I would probably have given up flash a long time ago. Having all of the code existing on the timeline is not only better, but all of you're code is right their for you to see. And you don't have to keep clicking on countless movieclips to view what code that object is using.
And you can still program in AS 1.0 and not use onclipevents and it would still be better by the way. It's not like you have to start learning AS 3.0 to start learning the right way to do things.

Jacob
01-09-2007, 01:11 PM
but jared..you must understand..it all comes in time for everyone..AS1 is just easyer for any beginer..you cant push as3 concepts on to someone who will simply not grasp it..and the fact they dont grasp it, doesnt justify not helping them...you should, however, slowly teach good practices and other things.

Thats not an AS 3.0 concept. In fact you cant use onEnterFrame in AS 3.0. Its an AS 2.0 method thats been around for quite a few flash versions and its a very simple concept.

arkhan
01-09-2007, 08:39 PM
you both missed the point here..what I was trying to say is, doesnt really matter if its better practice, if the people you are trying to help simply dont understand the concept..it comes with time and experience..you surelly should try to teach the good practices, but its bein a while, jared was around just saying people shopuldnt use onClipEvent..and just not helping at all..

I dont know jared, but for some time you are around..I know you are a good scripter, but recently you are just not helping as much, because you are refusing to answer things, and just blaming it all on onClipEvents..you actually traced the source of a bug, and said it was onClipEvent on some other post..

Jacob
01-09-2007, 08:51 PM
How to not use onClipEvents has been explained over an over. Its very simple, its just that some people are lazy or stubborn.

I do know what you are saying about his comments though. Saying the source of the problem is onClipEvents for every question when the actual post has nothing to do with it is not helpful. It should be brought up as a recommendation, but not blamed for the problem every time. He sometimes just sees "onClipEvent", stops there and gets distracted :D.

Jared
01-09-2007, 10:28 PM
you both missed the point here..what I was trying to say is, doesnt really matter if its better practice, if the people you are trying to help simply dont understand the concept..it comes with time and experience..you surelly should try to teach the good practices, but its bein a while, jared was around just saying people shopuldnt use onClipEvent..and just not helping at all..

I dont know jared, but for some time you are around..I know you are a good scripter, but recently you are just not helping as much, because you are refusing to answer things, and just blaming it all on onClipEvents..you actually traced the source of a bug, and said it was onClipEvent on some other post..
Yes well projects due take priority. And the reason I always say that is because I wish for people would stop using them.
Everybody is teaching everybody else the wrong way of doing things. And its just prolonging the use of a bad practice when everybody shouldn't be using it.

doomlord
01-10-2007, 09:24 PM
In defence of bad people like me it's just easier and I actually think it's neater. My timeline code is always all over the place but if i use onClipEvent on the few mc's i have then i know what codes those mc's need but i'm not good in flash so go ahead. Most people that even touch flash or remotely use it it takes them a long time to get onClipEvent out of there systems just help us now and teach us better scripting so when comes later we drop it naturally just saying its bad practice and giving us complicated scripts on timelines just makes us lazier and steal scripts off the internet.

phdrummer
01-10-2007, 09:40 PM
yeah, i still use a lot of On Clip events. I mean, i dont not use OnClip events, i find it easier, and neater.

Malignus
01-10-2007, 09:42 PM
How to not use onClipEvents has been explained over an over. Its very simple, its just that some people are lazy or stubborn.

I don't especially feel like rewriting tens of thousands of lines of code right now. I don't think that makes me lazy or stubborn.

arkhan
01-10-2007, 10:08 PM
oh great..I just started a discussion..I should have just PMd jared for it..
mind we not continue this after I say this?
jared, you are a good scripter, but you should be more helpful, even if not using the best practices..I think that, in this forums, we are not teaching AS to people, rather than helping them learn..so, we can try to teach good practices, but if he dont understand it right away, just put in an alternative he understands..I tryied some times to teach things someone wasnt ready to learn..they just quit programing...

also, think about a big team..somenthing around 4~7 programers..and you join in in the middle of the project, with the deadline setled and tight..most times you will find many many things you say "hey, this could be a lot better", but its necessary to carry on some mistakes to avoid losing precious rewriting time..

I sware that, if TBC tryed to force OOP on me back in 2003 when i joined in, theres just no way I would be here nowdays..it takes much time and many examples to actually learn how to use new concepts..we cant expect anyone who just started to grasp it at once..

Jared
01-10-2007, 10:19 PM
Honestly if people aren't welling to put in the time and effort to learn how to do things the right way than programming isn't for them.
Sure it can take time and effort. But in the end its always worth it.

Jacob
01-14-2007, 02:50 PM
Things take time to learn. A Flash forum is meant to help people advance, not to make yourself look good or constantly put down others and point out constantly how they use onClipEvents and you dont. You are not a professional and certainly not the best coder here, not by a long shot. I could probably insult code you write all day long, but there is not point in that. So it would be nice it you could start contributing more properly if you really want people to learn. People are just getting irritated at hearing the same thing over and over, without getting help. Thats all.

Matt
01-14-2007, 03:24 PM
Honestly if people aren't welling to put in the time and effort to learn how to do things the right way than programming isn't for them.
Sure it can take time and effort. But in the end its always worth it.

IT IS NOT THE RIGHT WAY TO DO IT. It is mearly an optional and in most cases cleaner way but not maditory. You have to start somewhere and starting with the harder code first just wont work!
If you were them you would be like "Do even harder stuff! I don't even know how to use this simple stuff yet! Slow down"
We aren't computers and can't always just learn soemthing or break a habit just like that. Yes it takes time and effort but you have to up to it. You can't start with the big. Start with the small.

doomlord
01-14-2007, 07:58 PM
Honestly if people aren't welling to put in the time and effort to learn how to do things the right way than programming isn't for them.
Sure it can take time and effort. But in the end its always worth it.
the "right" way? there's no right way to programming just as long as it looks good and qualifies as what you intended it to be. Instead of *****ing about it being bad practice then teach people it and spread the word.
Programming isn't for me yet i do it and it's fun but programming definetaly isn't for those people who want a game-maker to make a game without scripting which is what i used to do. If you ever want to be good at something it takes alot of time and effort like you said and it is worth it in the end and... yeah.
off topic:
the thing that annoys me is the people that want the quick route past people who practice or they think their good when they just copied some guys script/method.
okay sorry if i annoyed you i'll shutup in this thread from now on

Jacob
01-14-2007, 08:03 PM
Actually there is a right way to programming.

Though this is not a forum of professionals and people not using the "right way" doesnt justify not helping them.

phdrummer
01-14-2007, 09:37 PM
i find onClipEvents cleaner, you want movement code for a guy, place it on him, you want AI, place it on the enemy instead of jumbling it all together and having to scroll through pages of frame code

Jacob
01-15-2007, 12:49 AM
i find onClipEvents cleaner, you want movement code for a guy, place it on him, you want AI, place it on the enemy instead of jumbling it all together and having to scroll through pages of frame code

Thats because you are inexperienced. You think that because you only screw around with a couple clips and limited functionality. Trust me, they are horrible and the worst way to do it. No good flash coder would be caught dead using them anymore. They kill engine versatility and OOP.

doomlord
01-15-2007, 01:15 AM
off topic
jjcorreia i just found another thing i don't know, OOP! and i could go on with a list of what i don't know about in coding but you'd get bored

Malignus
01-15-2007, 01:15 AM
They kill engine versatility and OOP.

I still don't really understand OOP, but I can testify that using onClipEvents has definitely limited my multiplayer engine. If it weren't just an additional thing I stuck in the game as sort of a bonus to enhance the game's life, I'd be out there rewriting the code as we speak. As it is, I might end up doing that anyway for single player. :(

doomlord
01-15-2007, 01:31 AM
Man your good coder coz you made a popular game, wish i could do something like that ;(

Jacob
01-15-2007, 02:01 AM
I still don't really understand OOP, but I can testify that using onClipEvents has definitely limited my multiplayer engine. If it weren't just an additional thing I stuck in the game as sort of a bonus to enhance the game's life, I'd be out there rewriting the code as we speak. As it is, I might end up doing that anyway for single player. :(

You will love it once you learn it. You will feel like you are liberated. Its like a coders dreamworld and it makes you very proud to build things.

doomlord
01-15-2007, 02:16 AM
really i don't even know what OOP stands for thats how dumb i am

Jacob
01-15-2007, 03:40 AM
really i don't even know what OOP stands for thats how dumb i am

Object Oriented Programming