NEVER MIND -- MY BAD: how to make two nested movie clips work as variables
I animate, Sorry I posted this. I was using the wrong library instance to experiment on, so please ignore this question. The code below works just fine and both console.log(currentPetals) and console.log(currentHitArea) give the correct variable name. I'm blushing all over the place. Thanks.
Zaffer
Hi Animate,
I have nested two movie clips (petals_mc and hitArea_mc) inside another movie clip (currentFlower). I do need two different nested movie clips in a flower -- one for rotation registration and one to try to manually make a hittest. While console.log(currentPetals) always gives a variablename, console.log(currentHitArea) is always undefined. Here's my code. Any help will be appreciated.
Zaffer
let currentFlower;
let currentPetals;
let currentHitArea;
this.redButton_btn.addEventListener("click", positionRedFlower.bind(this));
function positionRedFlower()
{
const redFlower_mc = new lib.redFlower();
this.addChild(redFlower_mc);
redFlower_mc.x = 75;
redFlower_mc.y = 200;
redFlower_mc.addEventListener("pressmove", moveSomeFlower.bind(this));
}
function moveSomeFlower(e)
{
currentFlower = e.currentTarget;
pt = exportRoot.globalToLocal(e.stageX, e.stageY);
e.currentTarget.x = pt.x;
e.currentTarget.y = pt.y;
currentPetals = currentFlower.petals_mc;
currentHitArea = currentFlower.hitArea_mc;
console.log(currentPetals);
console.log(currentHitArea);
}
