Skip to main content
October 7, 2009
Question

Can't apply buttonMode to MovieClip?

  • October 7, 2009
  • 1 reply
  • 1087 views

I am trying to apply buttonMode to a movie clip like this:

pathToThumb.getChildAt(i).buttonMode = false;

and am getting the following error.

1119: Access of possibly undefined property buttonMode through a reference with static type flash.display:DisplayObject.

I am setting up that button like this:

var thumbHolder:MovieClip = new MovieClip();

thumbHolder.id = loadingCount;

thumbHolder.name = "thumb" + loadingCount;

MovieClip(root).slideMenuHolder_mc.slideMenu.thumbs_mc.addChild(thumbHolder);

Why is that and how can I change it?

Thank you!!!

This topic has been closed for replies.

1 reply

Inspiring
October 7, 2009

buttonMode is a Sprite property but getChildAt() return a DisplayObject. So you need to cast the returned displayObject to MovieClip like this:

MovieClip( pathToThumb.getChildAt(i) ).buttonMode = false;

October 7, 2009

I see. Great, thank you! This works!