Results 1 to 6 of 6
  1. #1
    MSgt. Shooter Person
    Join Date
    May 2011
    Posts
    65

    Default GFxClikWidget.EventData doesn't return correct results in AS3?

    after adding eventListeners in unrealscript (MPMenuList.AddEventListener('CLIK_itemPress',OnLi stItemClicked)) , I correctly get a call to OnListItemClicked(GFxClikWidget.EventData ev) , however, ev does not contain any valid results as ev.index,ev.target,ev.data are all = 0,

  2. #2
    MSgt. Shooter Person
    Join Date
    Dec 2008
    Location
    Paris, France
    Posts
    126

    Question

    I am experiencing the very same issue, using a ScrollingList in AS3. Whatever the event I link to my event handler in UScript, the event index is ALWAYS 0, no matter what I do playing around with my list.

    Code looks like this :
    Code:
    event bool WidgetInitialized (name WidgetName, name WidgetPath, GFxObject Widget)
    {
    	switch(WidgetName)
    	{
    		case ('MapList'):
    			MapListMC = GFxClikWidget(Widget);
    			MapListMC.AddEventListener('CLIK_itemRollOver', OnListItemClick); // rollover, click, press, whatever.
    			UpdateListDataProvider();
    			break;
    
    		case ('ExitButton') :
    			ExitButtonMC = GFxClikWidget(Widget);
    			ExitButtonMC.AddEventListener('CLIK_click', OnExit);
    			break;
    			
    		default: return Super.WidgetInitialized(Widgetname, WidgetPath, Widget);
    	}
    	return true;
    }
    
    function OnListItemClick(GFxClikWidget.EventData ev)
    {
    	// ev.index is ALWAYS == 0
    }
    I should mention that MapListMC.GetFloat("selectedIndex") get the correct result, but with a one-event lag : it's updated with the previous event's data.

    Please, what am I doing wrong ? Please don't tell me that this is broken... I see that we are not alone with this problem : http://forums.epicgames.com/threads/...S3-CLIK-Events
    Last edited by Gwen-HaŽl; 03-20-2012 at 05:09 PM. Reason: added comment
    DeepVoid, a free FPS project

  3. #3
    MSgt. Shooter Person
    Join Date
    Dec 2008
    Location
    Paris, France
    Posts
    126

    Default

    I know upping threads is bad, but this is really annoying.

    By the way, another approach to the problem works perfectly by using a dedicated button to get the result using MapListMC.GetFloat("selectedIndex")] . Why ?
    DeepVoid, a free FPS project

  4. #4

    Default

    In case people stumble on this thread, (I had the same problem) Matt posted up something that allowed me to work around the problem here:

    http://forums.epicgames.com/threads/...entData-in-AS3

    The EventData struct is still mostly 0/None/blank, but at least you can get data on the clicked/pushed CLIK widget...

  5. #5

    Default

    In case anyone was having the same problem that I was having, (needed the index of a pressed item in a scrolling list).

    The way I was able to pull the index out of the event was as this:

    Code:
    function listItemPressed(EventData a_stData)
    {
        `log("Index clicked on: " @ a_stData._this.GetInt("index"));
    }

  6. #6
    MSgt. Shooter Person
    Join Date
    Jan 2013
    Posts
    32

    Thumbs up

    Quote Originally Posted by ripper253 View Post
    In case anyone was having the same problem that I was having, (needed the index of a pressed item in a scrolling list).

    The way I was able to pull the index out of the event was as this:

    Code:
    function listItemPressed(EventData a_stData)
    {
        `log("Index clicked on: " @ a_stData._this.GetInt("index"));
    }
    Thanks! Saved me a lot of time.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.