-
MC duplication
hello,
ive noticed that when you duplicate movie clips, you are able to set that depth of the MC, but on what layer is it produced?
can you assign on what layer it goes?
thx !!
"Are those gummy worms? Can I have some?"
"Nevermind, I just saw one move by itself..."
-
Well depth and layers arent exactly the same thing. You can have many things in the same layer but there can only be one thing on a single depth at the same time.
The shapes and symbols put to stage during edit starts out with a depth of -16383.
/Mirandir
-
A solution
It is always produced on the first layer blocking everything under it. To make other things on top you have to use "swapDepths" on a movieclip to define a higher depth for it.
block_mc.duplicateMovieClip("block2", _root.getNextHighestDepth());
blocked_mc.swapDepth(block2);
You have duplicated a clip and blocked_mc is on top of block2.
I hope I helped,
zach_297
I have Macromedia Flash 8.
How about you?
-
You can actually put the movieclip underneath everything else with:
Code:
block_mc.duplicateMovieClip("block2", -16384);
Also I forgot to mention that movieclips and buttons add an empty depth level above them so you can fit an attached/duplicated movieclip between it and anything above it. However shapes, textfields and graphic symbols doesn't does not do that.
/Mirandir
-
ohh i get it!!
so even if the Mc are on the top layer, ill just put -16384!
or i can just swap it...hey now theres an option
thx dudes!
But ive recently had a new problem
this error sometimes comes up...but it also is getting frequent
these are not the exact words...but its quite similar
"A script in the falsh movie is making/can make your system computer
slow or malfunction, abort the scripts?"
whats wrong?
does this mean i have too many scripts or is there a script
that can actually cause this?
please help!! it can really bug me cause at one point in my flash game
it freezes....
"Are those gummy worms? Can I have some?"
"Nevermind, I just saw one move by itself..."
-
Senior Member
That error is most often caused by accidently creating an infinite loop. this could be something like a for or while loop that never reaches its exit condition or if you have code attached to a movie clip that is being duplicated that itself causes a new duplicate of the clip to be made.
-
but i never had any script in my movie that as a "for" and a "while"
script there... all i have are if and then statements on frames and MCs...
so what does this mean?
"Are those gummy worms? Can I have some?"
"Nevermind, I just saw one move by itself..."
-
Senior Member
you're duplicating movie clips though? is it possible you're causing the error by duplicating clips that themselves cause new clips to be created?
-
no i dont think so, the script that makes the Mc duplicate is in a frame
that only runs once...oh yeah i got the error again, here it is exactly:
A script in this movie is causing flash to run slowly. If it continues to run, your computer may become unresponsive. Do you want to abort the script?
yeah...im still figuring it out to
i think i should use the debugger?
"Are those gummy worms? Can I have some?"
"Nevermind, I just saw one move by itself..."
-
Senior Member
Can you attach the file? An error in the script is almost certainly causing an infinite loop somewhere, but it's hard to tell without seeing the code.
-
ohhh but the file is very very big
about 2000+ kbs...cause its actually an RPG game kinda like the ones
with final fantasy games...
im making the battle scenes....
but the thing's all messed up so its gonna take a while to
view where the script is goin wrong..
any suggestions?
oh sorry,i replied only today, im busy with my band
good thing is, the error comes in rarely now...
"Are those gummy worms? Can I have some?"
"Nevermind, I just saw one move by itself..."
-
Senior Member
good thing is, the error comes in rarely now...
would you be able to add some debugging messages into the movie to try to pinpoint where the code that's causing the error is?
-
hah umm i dont know how to use debug as i am a noob...
but perhaps if you dont mind, enlightening me with debugging?
tnx
"Are those gummy worms? Can I have some?"
"Nevermind, I just saw one move by itself..."
-
Senior Member
the trace function is something you can use to output messages while your movie is running in test movie mode (control > test movie)
you can use
trace("some message goes here");
to find out where you are in the code. more usefully you can also use this as a basic check for the value of variables at different times, for example,
trace("myVariable = " + myVariable);
by placing these kind of statements throughout your code you might be able to better target the area in your code that's causing the error.
-
hmmm yeah i think that can help!
im quite suspicious about a certain script i made....
cause thats the part where it normally has the error come up
ill try that! so, what you mean is that, when a script with trace has
an error, the output will stop on that traced script?
oh yeah, i have a new question...i thought i might just put it here
so i wont be bothering the other posts:
is there a way to call on different instance names?
like i wanna call on mc1, mc2, mc3, mc4, mc5, mc6 at the same time
and make them do the same thing i want them to (like have all of them go to and stop at frame 1)
i thought of using something like for var i = 1; i<5; i++
so any ideas?
"Are those gummy worms? Can I have some?"
"Nevermind, I just saw one move by itself..."
-
Senior Member
No, trace won't stop the script but it can be used to check where you are in the code and check the values of variables at different times.
Yes, a for loop would be a good way to send all the clips mc1, mc2 etc to stop at frame 1.
Code:
for (var i = 1; i < 7; ++i) {
this["mc" + i].gotoAndStop(1);
}
-
ohh so i noticed that in your script, there a "this" command
so i should put that in an MC containing different MCs inside
(so, im commanding MCs inside an MC.... )
so variables can also be considered as something that can cause errors?
oh yeah, that multiple MC calling thingy, wont that cause major lag
in a computer? say if i had 50 MCs do the same thing at once?
"Are those gummy worms? Can I have some?"
"Nevermind, I just saw one move by itself..."
-
Senior Member
Using "this" in a script attached to a frame creates a reference to the timeline that contains the script, so if you placed the following in a frame of your movie,
this.mc.gotoAndPlay(2);
(assuming the clip existed) it would play the clip mc found in that frame.
if a variable has an unexpected/incorrect value it could cause errors. for example if a part of your script is expecting a variable to contain a reference to a movie clip and at some point earlier in the script you accidently stored a number in the variable. it is likely that when the script reaches the part where it is expecting to be dealing with a movie clip that it will fail.
Looping through 50 clips probably wouldn't cause any noticable lag.
-
hmm ive noticed something
i have this frame, and my timeline runs on it occasionally
theres a variable there, _root.baseattackvalue = 9999999
now i was wondering that if my timeline keeps on going to that
it keeps on reminding that _root.baseattackvalue is 9999999
can that cause an error? (erhm, your probably wondering why i have damage for up to 9999999...hey im just having fun!)
and also, in that frame, i have a script that calls for a random script
i think thats another factor
ohh wait, i have so many questions....sorry! i need to learn...hehe
ive heard its possible to attribute to a variable an instance name
like here is an instance name "jack" = _root.jackvariable
can i put that i a pathname? like _root.Mc1.Mc2._root.jackvariable.gotoAndDoStuff(1) ;?
thanks dude
"Are those gummy worms? Can I have some?"
"Nevermind, I just saw one move by itself..."
-
Senior Member
Originally Posted by Zirclesoft
hmm ive noticed something
i have this frame, and my timeline runs on it occasionally
theres a variable there, _root.baseattackvalue = 9999999
now i was wondering that if my timeline keeps on going to that
it keeps on reminding that _root.baseattackvalue is 9999999
can that cause an error?
it wouldn't cause flash player to abort the script. the only thing that may be a problem is if you're expecting to see that value change as the movie progresses. if it is continually reset to it's original value you won't see the change.
if you have a clip with the instance name jack inside mc2, which is itself inside mc1 you could do something like this,
var jackClip = _root.mc1.mc2.jack;
jackClip.gotoAndPlay(2);
or something like this,
var clip = "jack";
_root.mc1.mc2[jack].gotoAndPlay(2);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|