Announcement

Collapse
No announcement yet.

ScaleForm ButtonBar

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Do you mean "CLIK_itemClick" instead of "CLIK_itemPress" for the uScript portion of the above code? I used a button bar and wasn't able to receive events on a listener for "CLIK_itemPress"

    I saw the itemClick event in the User Guide pdf but I haven't found a list of these events in UDK. Is the standard to prefix the events listed in the CLIK User Guide Doc (AS2 in my case) with "CLIK_"?

    Leave a comment:


  • replied
    Here is Frame 1 from the timeline I am working with.
    Code:
    _global.gfxExtensions = true;
    import flash.external.ExternalInterface;
    
    var arrNames:Array = new Array();
    var _lbl1;
    var _lbl2;
    
    //Sets up initial clip
    function initClip(Void):Boolean
    {
        //Catch Labels
    	_lbl1 = Object(this).lblDeptName;
    	_lbl2 = Object(this).lblSelect;
    	//Set Visibility
    	hideLabels();
    
    	if ((mcMain != null) && (mcButtonBar != null))
    	{
    		return true;
    	}
    	else
    	{
    		return false;
    	}
        //Attach Event Handlers
    	mcButtonBar.addEventListener("itemClick", this, "onItemClick");
    }
    function setArray(val:Array):Void
    {
     	var count:Number;
    	var len:Number;
    	len = val.length;
    	for (count = 0; count < len; count++)
    	{
    		arrNames.push(val[count]);
    	}
    	mcButtonBar.dataProvider = arrNames;
    }
    function hideLabels(Void):Void
    {
    	_lbl1._visible = false;
    	_lbl2._visible = false;
    }
    function onItemClick(event:Object):Void
    {
    	//Create Button Bar Funtionality
    	trace(event.target);
    	trace(event.target._name);
    	trace(event.target.selectedIndex);
    }
    Here is frame 2 where the actual flash starts working.

    Code:
    var bTest:Boolean = initClip();
    var bTest2:Boolean = attachHandlers();
    var temp:Array = new Array("Button 1", "Button 2", "Button 3", "Button 4");
    setArray(temp);
    trace("Stage Binding: " + bTest);
    if (mcButtonBar.dataProvider.length > 0)
    {
    	trace("Attached to DataProvider: " + true);
    }
    stop();
    N/M I found the problem. Should never have the return before the other code. lol

    Leave a comment:


  • replied
    First, set up the button bar's list of buttons:

    ActionScript 2.0 Code


    Code:
    var buttons:Array = ["Home", "Forums", "Scaleform", "CLIK"];
    myButtonBar.dataProvider = buttons;
    Listening for button presses in a button bar can be achieved as follows:

    In UnrealScript:

    Code:
    myButtonBar.AddEventListener('CLIK_itemPress', onItemClick);
    
    function onItemClick(GFxClikWidget.EventData ev) 
    {
        `log("##### Selected Item's parent: "@ev.target.GetString("_name"));
        `log("##### GetObject: "@ev.target.GetObject("dataProvider"));
        `log("##### Selected Index (Button Number Pressed): "@ev.target.GetFloat("selectedIndex"));
    }
    In ActionScript 2:

    Code:
    myButtonBar.addEventListener("itemClick", this, "onItemClick");
    
    function onItemClick(event:Object) 
    {
        trace(event.target);
        trace(event.target._name);
        trace(event.target.selectedIndex);
    }

    Leave a comment:


  • started a topic ScaleForm ButtonBar

    ScaleForm ButtonBar

    I have been reviewing scaleform but haven't found any documentation in regards to the button bar.

    So in AS 3.0 this is how I would add the event.

    Code:
    function handleClick(e:ItemClickEvent):void
    {
        trace("Button " + e.index + " was clicked");
    }
    
    mcBBar.addEventListener(ItemClickEvent, handleClick);
    But seeing as this is AS 2.0 that method doesn't work.

    This doesn't work for me either
    Code:
    function handleClick(evt):void
    {
        trace("Button " + e.index + " was clicked");
    }
    mcBBar.addEventListener("ItemClickEvent", this, "handleClick"); //Should Create Event Handler attached to the button bar.
    
    function attachHandlerTest(void):void
    {
       var Count:Number = mcBBar.dataProvider.length;
       for(var intX = 0; intX < Count; intX++)
       {
          mcBBar["clip" + Count].itemClick = function() { trace("Click me") ; }
    
       }
    
    }
    So if anyone knows where I could look for more information about this class. It would be greatly appreciated.
Working...
X