okay this is sort of complicated:
I have a character, which has a shadow. The AS places them both, and then moves them. I can’t get the shadow to move though!
Here is what happens:
[AS]//sets the enemy type…
setEnemyArray = new Array();
setEnemyArray = [“bat”, “dog”];
_root.setEnemy = setEnemyArray[Math.floor(Math.random()*setEnemyArray.length)];
/sets objName which is used to set the shadow. So objName = setEnemy = dog or bat/
_root.objName = _root.setEnemy;
/Here the shadowName is set, = objName+ShadowMC, meaning dogShadowMC…/
_root.shadowName = objName+“ShadowMC”;
_root.attachMovie(“shadow_mc”, _root.shadowName, _root.shadowDepth, {_x:setObjX, _y:setObjY-adjustY+80});
/Later it makes the shadow move…/
moveObject(_root.setEnemy+“ShadowMC”, newX, newY);
/…Using this/
// function move object
function moveObject(objectToMove, newX, newY) {
objectToMove.onEnterFrame = function() {
this._x -= (this._x-newX).5;
this._y -= (this._y-newy).5;
};
}
[/AS]
Now when I trace _root.setEnemy+“ShadowMC”, I get ‘batShadowMC’ (or dog or whatever). But it’s not moving the shadow, and I don’t know why! I don’t think it’s actually going to the moveObject function, I tried to trace something and it came up with nothing… why? Is it having trouble knowing what to move? Is my AS right?