Flex - overriding scrollToIndex in HorizontalList to animate scrolling

Tags: , ,

I'm not posting how to do it for list, as that's not what i was working on - but it should be fairly straight forward and should use very similar (if not the same code).

 
override public function scrollToIndex(index:int):Boolean{
//super.scrollToIndex(index);
var newVPos:int;
var newHPos:int;
 
var firstIndex:int = scrollPositionToIndex(horizontalScrollPosition, verticalScrollPosition);
var numItemsVisible:int = ((listItems.length - offscreenExtraRowsTop - offscreenExtraRowsBottom) *
(listItems[0].length - offscreenExtraColumnsLeft - offscreenExtraColumnsRight));
if (index >= firstIndex + numItemsVisible || index < firstIndex)
{
newVPos = Math.min(indexToRow(index), maxVerticalScrollPosition);
newHPos = Math.min(indexToColumn(index), maxHorizontalScrollPosition);
 
try
{
iterator.seek(CursorBookmark.FIRST, scrollPositionToIndex(horizontalScrollPosition, verticalScrollPosition));
//super.horizontalScrollPosition = newHPos;
//super.verticalScrollPosition = newVPos;
 
var p:Parallel = new Parallel(this);
var ap:AnimateProperty = new AnimateProperty(this);
var ap2:AnimateProperty = new AnimateProperty(this);
ap.property = 'verticalScrollPosition';
ap2.property = 'horizontalScrollPosition';
 
ap.toValue = newVPos;
ap2.toValue = newHPos;
 
p.addChild(ap);
p.addChild(ap2);
 
p.play();
 
}
catch(e:ItemPendingError)
{
}
return true;
}
return false;
}
 

Flex - FlowContainer

Tags: , , ,


NEW VERSION OF COMPONENT RELEASED HERE

This is a project that I released a while ago when i was keeping the blog at blog.3r1c.net. I've since expanded and want to release it again, as I know people used it, and they may have lost the source.
This component allows you to flow child containers logically in a vertical or horizontal manner. Try to click the buttons inside the container, and watch how they animate to a larger size, and the rest of the items flow gracefully. In the following demo you can also adjust the vertical scroll position, horizontal scroll position, width and height of the container on the fly, and watch all of the children dynamically update.

Here is the source
and
Here is the demo

Feel free to use this in any project you want, but if you do gimme a link in here cuz I'd love to see it in the wild!

Thanks again and feel free to leave comments

Eric

MLB.TV PLAYER COVERED IN THE TIMES

Tags: ,

New York Times posted a great article about the player we've been diligently working on.  You can read it HERE.

Flex - Skinning the modal blocker in the PopUpManager

Tags: , , , ,

Please tell me if there is a better way to do this, as this is both a bit convolluted, complicated, and subject to change at any time. It also requires you to use two excluded classes, and an mx_internal variable. That being said, this is how I approached it.

        import mx.core.mx_internal;
	import mx.managers.PopUpManagerImpl;
	import mx.core.Singleton

	use namespace mx_internal;

       PopUpManagerImpl(Singleton.getInstance("mx.managers::IPopUpManager")).mx_internal::modalWindowClass = SomeClass;

Please note that you have to import and use mx_internal. You also have to import PopUpManagerImpl, as this is where the variable is defined. And you must also import Singleton, which is how the flex framework accesses singleton implementations within the framework. Once you've done this, you can access the 'modalWindowClass' mx_internal property on PopUpManagerImpl, and set it to your own modal class. When this is done, anytime you add a pop up, the modal blocker will use this class.

Any questions, or SUGGESTIONS on how to do this better, please comment below