I highly recommend it as well.

As a simple example, I might want to enhance the List component to 
autoscroll to the selected item upon selection. Simply create a class 
'AutoscrollList.as' that you can then use that class in your MXML 
<ui:AutoscrollList />.  (code included below)

Like others, I don't use it when I add one or two UI centric functions 
to a UI class.

Cheers,
-D


package ui
{
    import mx.controls.List;

    public class AutoscrollList extends ExtendedList
    {
       
        override public function set selectedIndex( value:int ):void
        {
            super.selectedIndex = value;
            scrollToSelected();
        }
       
        override public function set selectedItem( value:Object ):void
        {
            super.selectedItem = value;
           
            scrollToSelected();
        }
       
        override public function set dataProvider( value:Object ) : void
        {
            super.dataProvider = value;
            scrollToSelected();
        }
       
        public function scrollToSelected() : void
        {
            // TRICKY: Delay the invocation to avoid redraw bugs 
starting in 2.0.1
            if ( selectedIndex >= 0 )
            {
                callLater( scrollToIndex, [ selectedIndex ] );           
            }
            //this.scrollToIndex( selectedIndex );
        }
       
       
    }
}


ben.clinkinbeard wrote:
>
> I am undecided as to whether or not I want to use the code behind
> method for my MXML files and figured I would see what others are
> doing. I am currently just using Script blocks at the top of my files
> to do event handling, initialization, etc but some of them are getting
> pretty big.
>
> So what are others doing? No AS in your MXML files, no code behind, a
> mixture of the two?
>
> Thanks,
> Ben
>
>  

Reply via email to