Archive for October, 2008

Resizing Scrollbars in Flex

I had to create bigger scrollbars, for a flex project which had to run on touchscreens. Their isn’t a real style or property which enables you to do this, but thanks to programmatic skinning, it is quite easy.

First of all, create a class which extends mx.skins.halo.ScrollTrackSkin. In this class, you override the measuredWidth() and updateDisplayList() functions:

override public function get measuredWidth():Number
{
	return 50;
}
 
override protected function updateDisplayList(w:Number, h:Number):void
{
	super.updateDisplayList(50, h);
}

After that, create a class which extends mx.skins.halo.ScrollThumbSkin. In this class, you have to provide the same methods:

override public function get measuredWidth():Number
{
	return 50;
}
 
override protected function updateDisplayList(w:Number, h:Number):void
{
	super.updateDisplayList(50, h);
}

The last class you have to create, is for the scrollbar arrows. This class extends mx.skins.halo.ScrollArrowSkin. Again, you have to override some methods: measuredWidth, measuredHeight and updateDisplayList:

override public function get measuredWidth():Number
{
	return 50;
}
 
override public function get measuredHeight():Number
{
	return 50;
}
 
override protected function updateDisplayList(w:Number, h:Number):void
{
	super.updateDisplayList(50, 50);
}

The final step, is to link these classes in your css file:

ScrollBar
{
    trackSkin: ClassReference("com.mydomain.BigScrollTrackSkin");
    downArrowDisabledSkin: ClassReference("com.mydomain.BigScrollArrowSkin");
    downArrowDownSkin: ClassReference("com.mydomain.BigScrollArrowSkin");
    downArrowOverSkin: ClassReference("com.mydomain.BigScrollArrowSkin");
    downArrowUpSkin: ClassReference("com.mydomain.BigScrollArrowSkin");
    thumbDownSkin: ClassReference("com.mydomain.BigScrollThumbSkin");
    thumbOverSkin: ClassReference("com.mydomain.BigScrollThumbSkin");
    thumbUpSkin: ClassReference("com.mydomain.BigScrollThumbSkin");
    upArrowDisabledSkin: ClassReference("com.mydomain.BigScrollArrowSkin");
    upArrowDownSkin: ClassReference("com.mydomain.BigScrollArrowSkin");
    upArrowOverSkin: ClassReference("com.mydomain.BigScrollArrowSkin");
    upArrowUpSkin: ClassReference("com.mydomain.BigScrollArrowSkin");
}

Programmatic skinning allows you to do even more, you can completely control the layout, and drawing of the components through code.

Good luck!

Flash On The Beach 2008

Awesome.

I got back from the conference yesterday, feeling both inspired and depressed (because it’s over again). We got to see a lot of great sessions, and I think most of us returned with a lot of new ideas, starting with reserving 20 minutes each day to play around :-)

It all started with Rob Chiu’s impressive sequence, which perfectly set the tone for the next 3 days:

The Flash plugin is required to view this object.

These were the sessions I attended after that:

Monday:

  • Richard Galvan – Flash Now and in the Future: Some new, and some old stuff on the Flash platform
  • Marco Casario – Mash-up widgets with Adobe AIR: Showed us how easy it is to incorporate API’s in your AIR apps
  • Branden Hall – Brilliant Ideas that I’ve Blatantly Stolen: Inspired me to (code-)play some more with Flash itself.
  • Geoff Stearns – YouTube Lessons Learned: Interesting to see some background info on one of the most used swfs on the internet. Saw some funny youtube video’s aswell :-P
  • Erik Natzke – Beyond the Knowledge: The Art of Play: One of my last year’s favorites, showed some more background on how some of the drawing was done.
  • James Paterson – Modulating a Lot: This guy creates some CRAZY WEIRD interactive animations. One of this year’s drug addicts.

Tuesday:

  • Mike Downey – The business side of AIR: how to sell your clients on AIR apps
  • Jeremy Thorp – Emergence
  • Grant Skinner – Things Every ActionScript Developer Should Know: Great to see that Grant is telling the same that we are teaching our students
  • Jam Session: Keith, Mario, Joa, Andre and Carlos each did a 10 minute session showing us a selection of the stuff they do
  • Lee Brimelow – Platform Jiu-Jitsu: Saw some cool wrestling video’s, linked to Flash platform idea’s
  • Robert Hodgin – The Best 8 to 12 Hours of my Life: Personally made the book store sell out their Processing books last year :-)

Wednesday:

  • Geoff Lillemon – Stop and Smell the Internet with Geoff Lillemon and Anita Fontaine: Really weird (but cool), Tim Burton style fine art.
  • Andre Michelle – Adobe made some noise! Andre is one of my favorite speakers, the stuff he does with audio in actionscript is crazy.
  • Koen de Weggheleire – Play With Pixels, bitmap manipulation with AS3: co-owner of Happy Banana, funny session about matrices and bitmapdata.
  • Mario Klingemann – Here be Pixels: This guy blows my balls of every year. The way he solves certain problems is just crazy…
  • Jonathan Harris – The Art of Surveillance and Self-Exposure: Stood in front of 800 flashers, saying there hasn’t been made a masterpiece in flash yet…

Thank you John & the FOTB team to throw another great conference, thanks to all the speakers for inspiring me (see you in Miami?) and thanks to my employer for giving me a chance to attend FOTB08!