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 !!
Printable View
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 !!
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
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.
You have duplicated a clip and blocked_mc is on top of block2.Quote:
block_mc.duplicateMovieClip("block2", _root.getNextHighestDepth());
blocked_mc.swapDepth(block2);
I hope I helped,
zach_297
You can actually put the movieclip underneath everything else with:
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.Code:block_mc.duplicateMovieClip("block2", -16384);
/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....
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?
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?
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...
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?Quote:
good thing is, the error comes in rarely now...
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 :)
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? :)
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?
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 :)
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.Quote:
Originally Posted by Zirclesoft
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);
var clip = "jack";
_root.mc1.mc2[jack].gotoAndPlay(2);
when you say that, it means that MC jack is inside MC2 and MC2 is inside MC1 right?
but i dont get the var clip = "jack";
what does it mean on _root.mc1.mc2[jack].gotoAndPlay(2);
oh yeah, what if a random script keeps on running?
cause my random script is on the same frame...and my timeline runs there occasionally
so is there any chance that it could be the one causing the problem?
sorry, there was a typo in that
it should be,
that stores a string with the name of the movie clip (jack) in a variable named clip. it then uses this variable to target the clip jack inside mc2 (which is itself inside mc1)Code:var clip = "jack";
_root.mc1.mc2[clip].gotoAndPlay(2);
what is the code in the random script?
ohhh can you explain to me the use of the part where it uses []?
what does var mean? can i put _root. to it?
oh the random code? here, its placed on frame 10
code:
//random value between character's min attack and max attack
damagetotal = _root.maxattack-_root.minattack;
_root.damagevalue = Math.round(Math.random()*damagetotal+_root.minatta ck);
//random chance if attack misses or hits
damagerate = random(100);
if (damagerate>=_root.misschance) {
_root.attack = _root.damagevalue;
} else {
_root.attack = "Miss";
}
//a special attack that does times 3.5 the normal damage
_root.SPECIALattack = Math.round(_root.damagevalue*3.5);
_root.misschance = 0;
there...but i dont understand why that would cause errors..but i think it does
thx!
oh if forgot the main values!! here they are
_root.misschance = 10;
_root.minattack = 100;
_root.maxattack = 200;
hey dudes
umm i recently tested my flash game again....
and i am convinced that there is something wrong with my random script
but i just dont know what!!!
can any1 help me? theres an example there already for a basis of my script
thx!
There is nothing in the code posted that could cause Flash player to need to abort the script.
so if its not in the script, then it has something to do with my variables and MCs...
thanks ill go check it out!