Flex 4 <s:Rect/> height limit of 10,000?

In my post about vertical scroll speed I show a code example of a scroller with several nested groups. A typical design of websites these days is to have a content area in the middle with an ever-expanding height and some sort of repeating background or colors on the sides – Just look at the layout of the majority of blogs, including my own.

Writing a flex app with the same design where you can scroll a lot of content vertically with a solid background color is a pretty typical use-case, but you will quickly find a limitation with using the primitive class Rect as a background: maxHeight = 10,000.

Read more…

Advertisements

Simple TLF Text Editor

I found a great TLF editor that is simple and to the point, it is under the MIT license, and is of course open source.

I don’t remember the combination of search terms to find it, but I’ve looked for something like this before and was unable to find it despite it being written in Q3 last year. The other examples that I’ve seen are way too heavy or are just plain bad.

Flex 4 Vertical Scroll Speed

May 18, 2011 9 comments

By default, scrolling content when using the Scroller component occurs very slowly – Even down to 1px per event.

Try running the following example:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
	<s:Scroller width="100%" height="100%">
		<s:Group width="100%" height="100%">
			<s:Group width="100%" height="100%">
				<s:VGroup width="100%" height="100%" horizontalAlign="center">
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
					<s:Label text="I need to be scrolled, man!" height="50"/>
				</s:VGroup>
				<s:layout>
					<s:VerticalLayout paddingBottom="100" paddingLeft="100" paddingRight="100" paddingTop="100"/>
				</s:layout>
			</s:Group>
		</s:Group>
	</s:Scroller>
</s:Application>

In order to bring scrollable content using a Scroller up to normal web standards (say 50px or 100px per event) with a setup like the above, you have to override the VScrollbar and assign a custom skin to the scroller that uses the override.

Read more…

Categories: Flex 4 Examples

SkinnableTextBase focusManager runtime error popup

May 5, 2011 4 comments

When you show a popup in Flex in a mobile environment, defined as the style “interactionMode” being set to InteractionMode.TOUCH in this context, that is based on a component that does not implement the mx.managers.IFocusManagerContainer interface, you will receive a runtime error when the user taps the control that is to receive focus.

Lets pretend you have a custom component that is based on <s:Group/>:

Read more…

DropdownList labelDisplay tooltip

February 22, 2011 1 comment

If you would like to have the DropdownList display a tooltip for the selected item on the labelDisplay component, you have to override the spark DropDownList and set the tooltip on the DropDownList itself rather than the label display.

package
{
	import mx.core.mx_internal;
	
	import spark.components.DropDownList;
	
	use namespace mx_internal;
	
	public class DropDownList extends spark.components.DropDownList
	{
		public function DropDownList()
		{
			super();
		}
		
		override mx_internal function updateLabelDisplay(displayItem:*=null):void
		{
			super.updateLabelDisplay(displayItem);
			
			if ( labelDisplay != null )
			{
				toolTip = labelDisplay.text;
			}
		}
	}
}

Making sure your air application exits (?:when using ApplicationUpdater(?:UI)?)?

December 30, 2010 Leave a comment

One of our desktop applications had the requirement of providing an auto-update feature. We turned to the built in framework of ApplicationUpdaterUI to fill that requirement, but interestingly enough the form would sometimes not show at all after calling initialize and then our application wouldn’t actually exit when the main window was closed by the user and no other windows were visible.

The symptom of the application not exiting was because I was listening for the INITALIZED and ERROR events on the application updater with weak references and no other references to the updater existed. Thus, sometimes, the updater UI wouldn’t show up at all. Despite the form not showing up sometimes, the native window was actually created, so when the main window closed, the application didn’t actually exit and had to be shut down via the OS (e.g. task manager/force quit) – ouch.

Once I realized what was going on and added strong referenced listeners, I could still make the problem occur by simply closing the application updater UI dialog or by pressing the cancel button – stupid.

Read more…

Flash cookies

July 1, 2010 4 comments

I wanted more than to just be able to delete their cookies, but to be able to view what information websites were storing about my surfing habits. I know where the cookies live, I know how to open them up, and I want to be able to view them all at once.

If you don’t know about “flash cookies”, you need to go get informed.

I thought it would be ironic to build an adobe air application to find and remove the cookies; and it is done.

Read more…