4 Replies - 917 Views - Last Post: 21 June 2017 - 07:37 AM

#1 naturalpuppy   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 21-June 17

getting errors when trying to show/hide a list

Posted 21 June 2017 - 07:17 AM

hi! i'm trying to show and hide a list when certain buttons are pressed but i keep getting errors. i was wondering if i could get a little help. i'm new to this so please bear with me.

the list hides when the first button is pressed:

import fl.controls.List;

var list:List = new List();
list.setSize(300,100);
list.move(320,220);

addChild(list);

phonebutton.addEventListener(MouseEvent.CLICK, fl_Phone);

function fl_Phone(event:MouseEvent):void
{
	list.visible = false;
	phone.gotoAndStop(1);
	phone.visible = true;
}


when the first button is pressed, it opens the phone movie clip. and then inside the phone movie clip, there is another button that is supposed to hide the clip and show the list again.

closephonebutton.addEventListener(MouseEvent.CLICK, fl_ClosePhone);

function fl_ClosePhone(event:MouseEvent):void
{
	this.visible = false;
	MovieClip(root).list.visible = true;
}


this causes an error 'TypeError: Error #1010: A term is undefined and has no properties.'. does anyone have any ideas as to why this may be happening? i tried accessing the list from the main timeline instead by writing an if statement so that whenever the phone clip is shown, the list should disappear, but this didn't do anything. it was probably written wrong!

if (phone.visible == true) {
	
	list.visible = false;
}

else if (phone.visible == false) {
	
	list.visible = true;
}


please let me know if anyone knows where the errors are coming from or if there's a better way to write this code. the whole reason i want to hide the list is because it shows up on top of everything else, and as far as i've seen from researching, there's no way to put a component on a specific layer within the canvas. please correct me if i'm wrong! thank you in advance.

Is This A Good Question/Topic? 0
  • +

Replies To: getting errors when trying to show/hide a list

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15308
  • View blog
  • Posts: 61,389
  • Joined: 12-June 08

Re: getting errors when trying to show/hide a list

Posted 21 June 2017 - 07:19 AM

Please copy/paste your errors here.
Was This Post Helpful? 0
  • +
  • -

#3 naturalpuppy   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 21-June 17

Re: getting errors when trying to show/hide a list

Posted 21 June 2017 - 07:23 AM

View Postmodi123_1, on 21 June 2017 - 07:19 AM, said:

Please copy/paste your errors here.


the error i got was "TypeError: Error #1010: A term is undefined and has no properties."
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15308
  • View blog
  • Posts: 61,389
  • Joined: 12-June 08

Re: getting errors when trying to show/hide a list

Posted 21 June 2017 - 07:25 AM

I saw that above. That's the entire message? No stack trace, other info, etc?
Was This Post Helpful? 0
  • +
  • -

#5 naturalpuppy   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 21-June 17

Re: getting errors when trying to show/hide a list

Posted 21 June 2017 - 07:37 AM

View Postmodi123_1, on 21 June 2017 - 07:25 AM, said:

I saw that above. That's the entire message? No stack trace, other info, etc?


it only tells me that the error happens at itemmenu_fla::phone_110/fl_ClosePhone()

otherwise there are no other errors in the output box. i traced the name inside the phone clip and got "phone phonelist phonemenu". i tried writing MovieClip(root).phonelist.list instead but that didn't work either.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1