Copy link to clipboard
Copied
Hi! I'm making a custom "dressup" type flash game as a gift for someone. I have little coding experience, but I'm quite far along now.
My current problem is: I'd like one button to change the blend mode of multiple objects - and the objects are placed inside different components. I've tried two methods, but both return as "TypeError: Error #1010: A term is undefined and has no properties." Previously, the button would only have one of those events and affected one object - back then it worked perfectly fine.
Method 1:
darkskin.addEventListener (MouseEvent.CLICK, bodyscreen);
darkskin.addEventListener (MouseEvent.CLICK, eyesscreen);
darkskin.addEventListener (MouseEvent.CLICK, mouthscreen);
function bodyscreen (event:MouseEvent):void
{
MovieClip(parent).skin_MC.lightskin.blendMode = BlendMode.SCREEN;
}
function eyesscreen (event:MouseEvent):void
{
MovieClip(parent).eyes_MC.eyes.blendMode = BlendMode.SCREEN;
}
function mouthscreen (event:MouseEvent):void
{
MovieClip(parent).mouth_MC.mouth.blendMode = BlendMode.SCREEN;
}
Method 2:
darkskin.addEventListener (MouseEvent.CLICK, bodyscreen);
function bodyscreen (event:MouseEvent):void
{
MovieClip(parent).skin_MC.lightskin.blendMode = BlendMode.SCREEN;
MovieClip(parent).eyes_MC.eyes.blendMode = BlendMode.SCREEN;
MovieClip(parent).mouth_MC.mouth.blendMode = BlendMode.SCREEN;
}
I'm trying to do the same with an alpha slider as well, same result. The code is "MovieClip(parent).skin_MC.lightskin.alpha = body_alpha_slider.value/10;", with all the three movieclip locations as well.
there's no difference between method 1 and method 2 that would cause that error.
ie, you did something else to cause the problem. tick 'permit debugging' (file>publish settings>swf) to see which line number is causing the error.
Copy link to clipboard
Copied
there's no difference between method 1 and method 2 that would cause that error.
ie, you did something else to cause the problem. tick 'permit debugging' (file>publish settings>swf) to see which line number is causing the error.
Copy link to clipboard
Copied
Ah, hang on... I see. The instance name for "eyes_MC" was written with all lowercase letters. I suppose capitalization matters in coding, eh?
Thank you for your answer! Enabling debugging helped find what was wrong 😃
Copy link to clipboard
Copied
correct: case counts. as3 is case-sensitive so eyes_mc is not the same as eyes_MC
Copy link to clipboard
Copied
I'll know that now =). Thanks for helping and hope I didn't waste your time! I'm still really new to this.
Copy link to clipboard
Copied
you're welcome.
p.s. it only wastes time when people misrepresent their situation. you didn't do that so no need for an apology.