2D Toolkit Forum

2D Toolkit => Support => Topic started by: layola on September 16, 2013, 04:47:29 am

Title: tk2dUIScrollableArea OnClickUIItem questions
Post by: layola on September 16, 2013, 04:47:29 am
tk2dUIScrollableArea  OnClickUIItem  questions

hi,I want to ask how to add click Event of tk2dUIScrollableArea's child item?
here what I do is not right ?
the result is show  always the first  one on click ?
Code: [Select]
  tk2dUIItem item= autoScrollableArea.GetComponent<tk2dUIItem>();

  item.OnClickUIItem += onClickUIItem;

  void onClickUIItem(tk2dUIItem item)
    {

        Debug.Log("click!");

       var sprite= item.GetComponentInChildren<tk2dSprite>();//alway is the first itemui get this event .


     


anything wrong ?
Title: Re: tk2dUIScrollableArea OnClickUIItem questions
Post by: gary-unikronsoftware on September 16, 2013, 10:20:48 am
Hi,

Basically for child UIItems you need the 'Child of Another UIItem' box checked.  Check out the '5 - ScrollableArea' example in the TK2DROOT > tk2dUI_demo  folder to see this in action.