-
<?xml version="1.0" encoding="utf-8"?>
-
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()" width="420" height="541" xmlns:component="component.*" borderColor="#FBFBFB" themeColor="#F7F9FB" horizontalScrollPolicy="off" verticalScrollPolicy="off">
-
<mx:Script>
-
<![CDATA[
-
import mx.controls.List;
-
import mx.events.FlexEvent;
-
import mx.collections.ArrayCollection;
-
import mx.containers.VBox;
-
import mx.controls.Text;
-
import mx.core.Container;
-
import flash.display.Sprite;
-
import flash.events.Event;
-
import data.db.SettingManager;
-
import blog.read.ReadList;
-
import blog.read.ReadContents;
-
import blog.read.ReadComment;
-
-
import mx.controls.Alert;
-
import component.LoginPanel;
-
import blog.write.WriteContents;
-
import component.CompleteButton;
-
import blog.login.BlogLogin;
-
import com.adobe.air.notification.NotificationClickedEvent;
-
import com.adobe.air.notification.Purr;
-
import com.adobe.air.notification.AbstractNotification;
-
import com.adobe.air.notification.Notification;
-
-
public var resultList:XML;
-
public var resultContents:XML;
-
public var resultComments:XML;
-
-
private var Postwrite:WriteContents = new WriteContents();
-
private var settingManager:SettingManager;
-
-
public var tmpObj:Object;
-
private const iconURL: String = "128_128.png";
-
private var bmp: Bitmap = null;
-
private var count:uint;
-
private var timer:Timer;
-
private var purr:Purr = new Purr(1);
-
-
-
private function init():void
-
{
-
settingManager = new SettingManager();
-
-
tmpObj = new Object();
-
-
-
login_mc.addEventListener(MouseEvent.CLICK, onLoginhandler);
-
-
-
-
-
-
}
-
private function completeHandler(evt:Event):void{
-
-
bmp = Bitmap(Loader(evt.target.loader).content);
-
purr.setIcons([bmp.bitmapData], "This is tooltip");
-
var m: NativeMenu = new NativeMenu();
-
m.addItem(new NativeMenuItem('Show'));
-
m.addItem(new NativeMenuItem('Close'));
-
purr.setMenu(m);
-
showNoti("새글이 올라왔습니다.");
-
}
-
-
private function ioErrorHandler(evt:Event):void{
-
-
}
-
-
-
private function showNoti(str:String):void{
-
var icon:Bitmap = bmp;
-
purr.addTextNotificationByParams("DaumDesktop for DevDay", str, AbstractNotification.BOTTOM_RIGHT, 5, icon);
-
-
}
-
-
private function onSendhandler(evt:MouseEvent):void
-
{
-
Postwrite.contentsWrite(post_mc.title_txt.text,post_mc.contents_txt.text,"tag");
-
-
}
-
private function onLoginhandler(evt:MouseEvent):void
-
{
-
var popLogin:LoginPanel = new LoginPanel();
-
popLogin.x = 90;
-
popLogin.y = 100;
-
addChild(popLogin);
-
-
}
-
public function onCompleteHandler(event : Event) : void {
-
var loader:Loader = new Loader();
-
loader.load(new URLRequest(iconURL));
-
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
-
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
-
-
timer = new Timer(3000, 1);
-
timer.addEventListener(TimerEvent.TIMER,
-
function(e:TimerEvent):void{
-
purr.alert(NotificationType.INFORMATIONAL, NativeApplication.nativeApplication.activeWindow);
-
});
-
-
-
resultList = event.target.respond_list;
-
drawList();
-
event.target.removeEventListener(Event.COMPLETE, onCompleteHandler);
-
}
-
-
private function drawList():void{
-
var kItem:XML = new XML();
-
for(var i:int = 0;i < resultList.item.length();i++){
-
var kVBox:VBox = new VBox();
-
kItem = resultList.item[i];
-
kVBox.label = kItem.date + " : " + kItem.title + " [" + kItem.commentCnt + "]";
-
kVBox.width = 400;
-
kVBox.name = kItem.link;
-
kVBox.addEventListener(FlexEvent.SHOW,viewPostHandler);
-
listAccordion.addChild(kVBox);
-
-
if(i == 0){
-
getPost(kItem.link);
-
}
-
}
-
}
-
-
private function viewPostHandler(evt:FlexEvent):void{
-
getPost(evt.target.name);
-
}
-
-
private function getPost(_link:String):void{
-
if(tmpObj[_link]) return;
-
-
var rc:ReadContents = new ReadContents();
-
settingManager.loadData();
-
rc.contentsread(settingManager.name, _link.split("/")[4]);
-
rc.addEventListener(Event.COMPLETE, onCompleteGetPostHandler);
-
//trace(_link);
-
tmpObj[_link] = true;
-
}
-
-
private function onCompleteGetPostHandler(event : Event):void {
-
//trace(event.target.respond_contents);
-
resultContents = event.target.respond_contents;
-
var kText:Text = new Text();
-
kText.text = resultContents.elements('description');
-
listAccordion.selectedChild.addChild(kText);
-
event.target.removeEventListener(Event.COMPLETE, onCompleteGetPostHandler);
-
showNoti(kText.text);
-
}
-
-
-
]]>
-
</mx:Script>
-
<mx:TabNavigator id="tab_mc" x="10" y="34" width="400" height="500">
-
<mx:Canvas id="read_mc" label="Post" width="100%" height="100%">
-
<mx:Accordion id="listAccordion" x="10" y="10" width="379" height="446">
-
-
</mx:Accordion>
-
-
</mx:Canvas>
-
-
<mx:Canvas id="write_mc" label="Write" width="100%" height="100%">
-
<component:PostEditor id="post_mc" x="10" y="9"/>
-
</mx:Canvas>
-
</mx:TabNavigator>
-
<mx:Button id="login_mc" x="354" y="29" label="Login"/>
-
<mx:Label x="10" y="8" text="Daum bloger assistence on AIR" fontWeight="bold"/>
-
-
</mx:WindowedApplication>