App one of fiftytwo posted December 31, 2007
Posted by therush in AIR, Flash, Flex.add a comment
Hello World,
I posted on my site (FiftyTwo Apps) some of the preliminary information for the first of what will be many smal apps. I call it the FlexTimer.
http://www.fiftytwoapps.net/index.cfm
Ciao
FiftyTwo Apps is a Go! December 30, 2007
Posted by therush in AIR, Adobe, ColdFusion, Flash, Flex, SQL.7 comments
Hello World,
Ever year so many people make New Year’s resolutions. Well I am no exception. This year I have dedicated myself to create fifty two apps. And thus was born the FiftyTwoApps web site.
For the next fifty two weeks I will create fifty two apps – from conception to completion, from design to delivery. You will be able to follow my progress as I design, develop, document, test, and deliver each app to … well, all of you. I will make available the full source of each app, a summary of each of the development tasks, time spent on each task, resources used, and lessons learned. Every Monday I will begin work on a new app and one week later, by Sunday at midnight, I will upload the completed app onto the FiftyTwoApps web site. During the week I will publish my progress on the site so you can see where I am in the process.
So visit the site often – if you wish. Starting Monday December 31st I will begin the first of the fifty two apps,
the FlexTimer. I hope to see you there. The next fifty two weeks will be a wild ride.
Ciao
Toast-Style Alert Window December 17, 2007
Posted by therush in AIR.Tags: air toast-style alert window flex
6 comments
Hello World,
I read a very interesting post today from Rich Tretola on his Everything Flex blog about creating an AIR AlertWindow Component (Toast Style). Go on over to his blog and take a look. It has some very useful material. I decided I would learn from his example and attempt to incorporate what he’s done into something I was doing. I ran into a few obstacles but a few posts later I came up with another version of the AS class he created. I give my thanks to him and Josh (another developer who commented on Rich’s blog) for helping me with what I am presenting below:
Here is the modified class:
package
{
import flash.events.*;
import flash.utils.Timer;
import mx.containers.Canvas;
import mx.controls.Button;
import mx.controls.TextArea;
import mx.core.Window;
import mx.events.FlexEvent;
public class AlertWin extends Window
{
private var _showTimer:Timer;
private var _delayTimer:Timer;
private var _hideTimer:Timer;
private var _delayTime:int;
private var _message:String;
private var _width:int;
private var _height:int;
public function AlertWin() {
this.maximizable = false;
this.resizable = false;
this.minimizable = false;
// alternate, none, standard, utility
this.systemChrome = "none";
// lightweight, normal, utility
this.type = "lightweight"
this.addEventListener(FlexEvent.CREATION_COMPLETE, completeHandler);
}
public function completeHandler(event:FlexEvent):void {
this.nativeWindow.x = flash.display.Screen.mainScreen.bounds.width - (this.width + 20);
this.nativeWindow.y = flash.display.Screen.mainScreen.bounds.height - 20;
this.horizontalScrollPolicy = "off";
this.verticalScrollPolicy = "off";
_showTimer = new Timer(10,0);
_showTimer.addEventListener("timer", showTimerHandler);
_showTimer.start();
}
public function show(message:String, title:String = "", delayTime:int=2, width:int=200, height:int=150): void {
_delayTime = delayTime;
this.width = width;
this.height = height;
var cnv:Canvas = new Canvas();
cnv.width = width;
cnv.height = height;
cnv.horizontalScrollPolicy = "off";
cnv.verticalScrollPolicy = "off";
var ta:TextArea = new TextArea();
ta.text = message;
ta.width = width;
ta.height = height;
var btn:Button = new Button();
btn.label = "My Message";
btn.setStyle("right", "5");
btn.setStyle("bottom", "45");
cnv.addChild(ta);
cnv.addChild(btn);
this.addChild(cnv);
this.open();
}
private function showTimerHandler(event:TimerEvent):void {
this.nativeWindow.y -= 10;
if(this.nativeWindow.y <= (flash.display.Screen.mainScreen.bounds.height - (this.nativeWindow.height + 10))){
_showTimer.stop();
_delayTimer = new Timer(1000,_delayTime);
_delayTimer.addEventListener("timer", delayTimerHandler);
_delayTimer.start();
}
}
private function delayTimerHandler(event:TimerEvent):void {
var t:Timer = Timer(event.target);
if(t.currentCount == _delayTimer.repeatCount){
_hideTimer = new Timer(20,999);
_hideTimer.addEventListener("timer", hideTimerHandler);
_hideTimer.start();
}
}
private function hideTimerHandler(event:TimerEvent):void {
if(!this.nativeWindow.closed) {
this.nativeWindow.y += 10;
if(this.nativeWindow.y >= (flash.display.Screen.mainScreen.bounds.height-20)){
this.close();
_hideTimer.stop();
}
} else {
_hideTimer.stop();
}
}
}
}
And here is my implementation;
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:Script>
<![CDATA[
import AlertWin;
private var myAlertWin:AlertWin = new AlertWin();
private function init():void {
myAlertWin.show("My Alert Message\nLine 2");
}
]]>
</mx:Script>
</mx:WindowedApplication>
Thanks Guys!Ciao


