• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

One button affecting multiple movieclips

Community Beginner ,
Feb 07, 2018 Feb 07, 2018

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.

TOPICS
ActionScript

Views

400

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 07, 2018 Feb 07, 2018

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.

Votes

Translate

Translate
Community Expert ,
Feb 07, 2018 Feb 07, 2018

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 07, 2018 Feb 07, 2018

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 😃

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 07, 2018 Feb 07, 2018

Copy link to clipboard

Copied

correct:  case counts. as3 is case-sensitive so eyes_mc is not the same as eyes_MC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 07, 2018 Feb 07, 2018

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 07, 2018 Feb 07, 2018

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines