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

change instance by using string

New Here ,
Oct 09, 2017 Oct 09, 2017

hi everyone,

Im trying to change the alpha of an instance by code

I did this code (and many many others but it doesn't work)

//global Var

var logoName = "";

//open popup window

this.WazeBtn.addEventListener("click", WazeText.bind(this));

function WazeText(event){

logoName = "WazeXY";

this.PopUp.WazeXY.alpha = 1;

}

//hide instance in popup window

this.PopUp.Exit.addEventListener("click", PopUp_close.bind(this));

function PopUp_close() {

this.PopUp.logoName.alpha = 0; // this line doesn't work

}

I will love some help with this problem

many thanks.

250
Translate
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

LEGEND , Oct 09, 2017 Oct 09, 2017

It will work like this:

function PopUp_close() {

  this.PopUp[logoName].alpha = 0; // this line doesn't work

}

Translate
LEGEND ,
Oct 09, 2017 Oct 09, 2017

It will work like this:

function PopUp_close() {

  this.PopUp[logoName].alpha = 0; // this line doesn't work

}

Translate
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
New Here ,
Oct 09, 2017 Oct 09, 2017

Colin thank you vary much!! I struggled with this line for hours

Translate
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
LEGEND ,
Oct 09, 2017 Oct 09, 2017
LATEST

You're actually changing an instance by using a variable, not a string (literal).

Translate
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