[AS2] Is confused about a path to a MC
So er... I made a MC, and called it 'waterdrop' on the stage. Now I have a MC that's linkage name is 'snow', and within the Waterdrop MC I use attachMovie to add the 'snow' to the scene. Simple.
However, it all messes up around here:
Code is from Control MC within 'waterdrop' MC
Code:
onClipEvent(enterFrame) {
var i2 = _root.getNextHighestDepth();
attachMovie("snow","snow"+i2,i2);
with (_root.waterdrop["snow"+i2]) {
_x = 425+40-80*Math.random();
_y = 90+45-90*Math.random();
_rotation = 60*Math.random();
_xscale = _yscale = 30*Math.random();
_alpha = 100;
}
_root.waterdrop["snow"+i2].onEnterFrame = function() {
with (this) {
_x += _xscale/13;
_y -= _yscale/30;
_alpha -= 2;
if (_x>896 || _y>672 || _alpha<0) {
this.removeMovieClip();
}
}
}
updateAfterEvent();
}
This piece of code works great if it's started by _root.onEnterFrame = function() and use the _root["snow"+i2] path to locate, but if I adapt it to above code, Flash Player tells me that it can't find the specified object for the With(){...}
Can anyone correct this code for me?
Oh, notes:
It basically attaches the clip at a random position near the (425,90), and then let it float sideways on a 1:3 gradient, gradually losing alpha and then getting removed if it drifts out of sight OR if it is transparent.