flash script emergency
- Started
- Last post
- 5 Responses
- cphunk
hey all. i'm in a really tight bind right now. hoping you can help.
i'm curious. does anyone know..... i'm duplicating these clips on the stage. 3 of them.
when a user presses the 2nd clip, for example, is there a way to TRACE that it WAS the second clip that they clicked on?
or if they click the third. to trace that it was the third duplicated clip they clicked on????
your help would be so much appreciated.
- dehryll0
on(release) {
trace("current clip: " + this)
}or
on(release) {
trace("current clip: " + this._name)
}
- shant0
yup, use the _name method in dehryll's post, and make sure you give them all instance names.
- jkosoy0
you may want to give the movie clips a naming convention as well, if you haven't already.
var i;
var number_of_clips = 3;for(i=1;i<=number_of_clips;i++)
{
clipToDup.duplicateMovieClip("ne... + i, i);
}then when you do the trace above, some simple string parsing will allow you to get a number (1,2 or 3 in this case) thats much easier to work with in AS.
_global.current_mc = 0;
on(release)
{
var this_mc_num;this_mc_num = this._name.split("_");
this_mc_num = Number(this_mc_num[this_mc_num.l...
trace(this_mc_num);
}
- shant0
or if you name them btn1, btn2, btn3 etc.
you can use:
_name.slice(-1) to get the last number.
- SmilingBuddh0
Lots of ways to skin this cat.
In the loop where you duplicate:
for (var i=0; i++; i<3) {
newmc = seed.duplicateMovie("thename" + i, i)
newmc.onPress = function() {
trace (this);
}
}