Hello Guest

Author Topic: tk2dUIScrollableArea OnClickUIItem questions  (Read 3760 times)

layola

  • Newbie
  • *
  • Posts: 5
    • View Profile
tk2dUIScrollableArea OnClickUIItem questions
« 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 ?

gary-unikronsoftware

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 74
    • View Profile
Re: tk2dUIScrollableArea OnClickUIItem questions
« Reply #1 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.
« Last Edit: September 16, 2013, 10:58:50 am by gary-unikronsoftware »