This blog isn't maintained anymore. Check out my current project, an agile/scrum management tool.

Wednesday, December 26, 2007

Customizing TileList selection

The mouse-hover and selection boxes in a Flex TileList only have styles for changing the colors. If you want more advanced things like changing the shape or having a border you'll need to extend the TileList class and override two methods.

drawSelectionIndicator - Draws the box around the currently selected item.
drawHighlightIndicator - Draws the box for the mouse-over item

public class RoundedSelectionTileList extends TileList
{
public function RoundedSelectionTileList()
{
super();
}

override protected function drawSelectionIndicator(
indicator:Sprite, x:Number, y:Number,
width:Number, height:Number, color:uint,
itemRenderer:IListItemRenderer):void
{
var g:Graphics = indicator.graphics;
g.clear();
g.beginFill(0x3f4c6b);
g.lineStyle(2,0x6e7c9d);
g.drawRoundRect(x,y,itemRenderer.width,height,15,15);
g.endFill();
}

override protected function drawHighlightIndicator(indicator:Sprite, x:Number, y:Number,
width:Number, height:Number, color:uint,
itemRenderer:IListItemRenderer):void
{
var g:Graphics = indicator.graphics;
g.clear();
g.beginFill(0x3f4c6b);
g.lineStyle(2,0x6e7c9d);
g.drawRoundRect(x,y,itemRenderer.width,height,15,15);
g.endFill();
}
}




Before:


After:
While you're in there, take a look at the other draw* protected methods. You can change most aspects of the control with those.

Friday, December 21, 2007

Spam 10k

Hit a new record today :(


Drawpad concepts

A while back I was contacted to do some work for an online drawpad application. I didn't end up getting that gig but I did play around with some ideas and came up with a few concepts for tools. They're nothing amazingly innovative or new, but they were fun to do. I really like the "Funky Pen 2." Clicky the image to play with them.

Monday, December 17, 2007

FB2 style constraints are back!

Check it out...


I upgraded to FB3 the day it came out and didn't even notice this until today, the old FB2 style of applying constraints is back! Yay! I had complained about it previously and it seems enough other people complained as well.

Yippy.

Sunday, December 16, 2007

Lazy day, playing with papervision

Snowed in today, so I took a few hours to play with some stuff I've been meaning to look into. I've been doing so much Flex/AIR work lately my fun side has been lacking.



First up was PaperVision3d.  Nothing spectacular, just playing with bitmaps on planes and moving the camera around. But that also gave me a chance to explore Tweener, which might become my tween engine of choice for AS3 until GO comes out. I rather liked using it.



http://rogue-development.com/experiments/HomePageMovie.swf



So , like I said it's nothing spectacular but if you want the source, it's listed below. One thing I still don't know how to do is determine how far away to put the camera from a 3d object so it will fill the screen.


package {
import caurina.transitions.Tweener;

import flash.display.Bitmap;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageQuality;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.MouseEvent;

import org.papervision3d.cameras.FreeCamera3D;
import org.papervision3d.materials.BitmapMaterial;
import org.papervision3d.objects.Plane;
import org.papervision3d.scenes.Scene3D;


[SWF(backgroundColor="#000000", frameRate="60")]
public class HomePageMovie extends Sprite
{
private var paperCanvas:Sprite;
private var camera:FreeCamera3D;
private var scene:Scene3D;

[Embed(source="screenshot1.png")]
private var ss1:Class;
[Embed(source="screenshot2.png")]
private var ss2:Class;
[Embed(source="screenshot3.png")]
private var ss3:Class;
[Embed(source="screenshot4.png")]
private var ss4:Class;
[Embed(source="screenshot5.png")]
private var ss5:Class;
[Embed(source="screenshot6.png")]
private var ss6:Class;
[Embed(source="screenshot7.png")]
private var ss7:Class;
[Embed(source="screenshot8.png")]
private var ss8:Class;

private var screenshotBitmaps:Array = [ss1,ss2,ss3,ss4,ss5,ss6,ss7,ss8];
private var screenshotPlanes:Array = [];

[Embed(source="background.png")]
private var backgroundImage:Class;

private var backgroundPlane:Plane;

public function HomePageMovie()
{
paperCanvas = new Sprite();
addChild(paperCanvas);

scene = new Scene3D( paperCanvas );

stage.addEventListener(Event.RESIZE, onStageResize);
stage.quality = StageQuality.MEDIUM;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;


camera = new FreeCamera3D();
//camera = new Camera3D();
camera.x = 0;
camera.y = 0;
camera.z = -200;
camera.zoom = 2;
camera.focus = 200;
//var stars:Stars = new Stars(new ColorMaterial(0xffffff) , paperCanvas);
//scene.addChild(stars);
var depth:Number = 0;

stage.addEventListener(MouseEvent.CLICK, onClick );

for each (var c:Class in screenshotBitmaps )
{
var bm:Bitmap = new c();
var mat:BitmapMaterial = new BitmapMaterial(bm.bitmapData);
mat.doubleSided = true;

var p:Plane = new Plane(mat ,0,0,4,4);
p.extra = {width:bm.width, height:bm.height};
p.x = Math.random() * 6000;
p.y = Math.random() * 6000;
p.z = Math.random() * 6000;
scene.addChild( p );
screenshotPlanes.push( p );
}



this.addEventListener( Event.ENTER_FRAME, loop3D );
relayout();

}

protected function onClick(e:MouseEvent):void
{
return;
if( stage.displayState == "fullScreen" )
{
stage.displayState = "normal"
}
else
{
stage.displayState = "fullScreen";
}

}

private function relayout() : void
{

screenshotPlanes.push( screenshotPlanes.shift() );
var i:Number = 0;

var p:Plane = screenshotPlanes[0];
Tweener.addTween( camera, { x:p.x , y:p.y , time:4 ,transition:"easeInOutCubic"} );
Tweener.addTween( camera, { z:Math.min(camera.z-1500,p.z-2500), time:2 ,transition:"easeOutQuart"} );

var d:Number = stage.stageWidth/p.extra.width;
Tweener.addTween( camera, { z:p.z - 200 * d, time:2, delay:2 ,transition:"easeInOutQuart"} );
Tweener.addTween( this, { onComplete:relayout, delay:6} );
}



private function loop3D(event:Event):void
{
scene.renderCamera( camera );
}



private function onStageResize(event:Event):void
{
paperCanvas.x = stage.stageWidth/2;
paperCanvas.y = stage.stageHeight/2;
}
}
}

Saturday, December 15, 2007

AIR Badge installer + swfobject + ExpressInstall

I've put together a page to install AgileAgenda using SWFObject with the ExpressInstall feature and the AIR Installation Badge.

This means people with a Flash Player less than 9.0.115 should be able to first upgrade their flash player, and then use the easy badge installation method for AIR + the application. I gave it a try on Firefox + Safari on OSX and IE + Firefox on WinXP, all of them with a 9.0.47 flash player and it all seemed to work well. The code also displays a message suggesting people install Flash player or install the AIR application manually if they don't have any version of Flash.

I've put together a small archive of the necessary files to make this work. It contains files from the swfobject guys released under the MIT license, and you can consider anything I wrote to make this work also under that license (which allows you to pretty much use it any way you like).

Thanks go to the swfobject guys, they really made this a no-brainer on how to implement!

Hope this helps some people.

Labels: , , ,

Friday, December 14, 2007

AgileAgenda - New Version

For those of you new here, AgileAgenda is a project scheduling application built on Adobe AIR.

There's a new version of AgileAgenda now available on the website.

It's been updated for AIR Beta 3, and includes a lot of bug fixes and minor enhancements, with a couple large feature improvements thrown in for good measure. You can read the list on the project blog.

The biggest change for me is file open/save dialogs work on OSX Leopard! Yay.

Labels: , ,

AIR Beta 3, Flash 9.0.63 requirement

Has anyone come up with an AIR badge installer that also incorporates the express install to upgrade flash?

Now that there's a 9.0.63 requirement on those badges, they're not that useful since most people aren't up to that version. It'd be nice to combine an automatic flash-upgrade with the badge.

I'll probably take a crack at it this weekend depending on how Christmas shopping goes, but I wouldn't complain if someone else figures it out first!

Edit: Apparently the requirement is 9.0.115, not 9.0.63. I think, or so says some, but I'm confused.

Wednesday, December 05, 2007

onSoundComplete broken in 9.0.r60 Leopard

Quick warning, Sound.onSoundComplete (AS2) is never called on OSX/Leopard with version 9.0.r60 of the flash plugin.  I'm not sure if it's all the time, or only under certain circumstances.  Most recent (9.0.r115) version of the plugin works fine.

Just blogging for anyone like me who goes to google to see if anyone else is experiencing a problem.

Tuesday, December 04, 2007

ObjectHandles 1.0.9 available for download

New version is up. It fixes the selectNone() bug, has the correct
metadata for events, and no longer creates event listeners on the
parent object for every single OH you instantiate.
I also added an updateAfterEvent call when things are getting moved,
it really made the motion a lot smoother, never thought it would
matter much.

http://code.google.com/p/flex-object-handles/downloads/list

ASDocs now posted as well, it's pretty sparse so it looks like I need to add
in a bunch of comments :)

http://rogue-development.com/objecthandles/asdocs/

-Marc

Labels: ,