
Untitled
By: a guest on
Apr 18th, 2012 | syntax:
None | size: 0.95 KB | hits: 9 | expires: Never
Wordpress XML-RPC publishing in AS3
private function publish():void {
var sel:CuratorBlog=blogSelect.selectedItem;
publisher=new WPService(sel.url, sel.login, sel.password);
publisher.addEventListener(WPServiceEvent.NEW_POST, postAdded);
var p:Post=new Post();
p.dateCreated=publishDate.selectedDate;
p.title=txtTitle.text;
p.mt_keywords=txtTags.text;
p.mt_allow_comments=1;
p.mt_allow_pings=1;
p.description=htmlText; //This is obtained from a richText control. And yes, I have tested that it is being assigned properly
publisher.posts.newPost(p, true);
btnPublish.enabled=false;
cursorManager.setBusyCursor();
}
private function postAdded(e:WPServiceEvent):void {
var postId:String=(e.data as String);
Alert.show(blogSelect.selectedItem.url + "?p=" + postId);
publisher.removeEventListener(WPServiceEvent.NEW_POST, postAdded);
cursorManager.removeBusyCursor();
btnPublish.enabled=true;
}