simplylezz
11-21-2002, 05:11 AM
I have been trying to create a collapsible directory structure with a folder movie clip that is supposed to duplicate itself into children when it is clicked on. I have created an instance of the mc and called it 'parent'. In the instance's actions i have placed the following code:
onClipEvent (load) {
i = 1;
}
onClipEvent (mouseUp) {
if (this.hittest(_root._xmouse,_root._ymouse,true)) {
duplicateMovieClip (this, "child"+i, i);
setProperty ("child"+i, _y, this._y+this._yscale);
i += 1;
}
}
However, at runtime, it takes three mouse-up actions for the child to be ceated the first time (child created on the fourth click). On the fifth click, the child disappears, but reappears on click no. 6, and so on.
Also, putting a 'trace("child no."+i)' statement before the i+=1 produces an ever increasing series of haphazard numbers, as follows:
CLICK #1: child no.1
CLICK #2: child no., child no.2
CLICK #3: child no.1, child no.3
CLICK #4: child no.1, child no.1, child no.4 (Child appears here)
CLICK #5: child no.1, child no.1, child no.2' child no.5 (Child disappears now)
...etc...
What am I doing that's so wrong? Um... I'm using Flash 5. The fla file is attached with this post.
onClipEvent (load) {
i = 1;
}
onClipEvent (mouseUp) {
if (this.hittest(_root._xmouse,_root._ymouse,true)) {
duplicateMovieClip (this, "child"+i, i);
setProperty ("child"+i, _y, this._y+this._yscale);
i += 1;
}
}
However, at runtime, it takes three mouse-up actions for the child to be ceated the first time (child created on the fourth click). On the fifth click, the child disappears, but reappears on click no. 6, and so on.
Also, putting a 'trace("child no."+i)' statement before the i+=1 produces an ever increasing series of haphazard numbers, as follows:
CLICK #1: child no.1
CLICK #2: child no., child no.2
CLICK #3: child no.1, child no.3
CLICK #4: child no.1, child no.1, child no.4 (Child appears here)
CLICK #5: child no.1, child no.1, child no.2' child no.5 (Child disappears now)
...etc...
What am I doing that's so wrong? Um... I'm using Flash 5. The fla file is attached with this post.