Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 18th, 2012  |  syntax: None  |  size: 0.95 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Wordpress XML-RPC publishing in AS3
  2. private function publish():void {
  3.     var sel:CuratorBlog=blogSelect.selectedItem;
  4.     publisher=new WPService(sel.url, sel.login, sel.password);
  5.     publisher.addEventListener(WPServiceEvent.NEW_POST, postAdded);
  6.  
  7.     var p:Post=new Post();
  8.     p.dateCreated=publishDate.selectedDate;
  9.     p.title=txtTitle.text;
  10.     p.mt_keywords=txtTags.text;
  11.     p.mt_allow_comments=1;
  12.     p.mt_allow_pings=1;
  13.     p.description=htmlText; //This is obtained from a richText control. And yes, I have tested that it is being assigned properly
  14.  
  15.     publisher.posts.newPost(p, true);
  16.  
  17.     btnPublish.enabled=false;
  18.     cursorManager.setBusyCursor();
  19. }
  20.  
  21. private function postAdded(e:WPServiceEvent):void {
  22.     var postId:String=(e.data as String);
  23.     Alert.show(blogSelect.selectedItem.url + "?p=" + postId);
  24.     publisher.removeEventListener(WPServiceEvent.NEW_POST, postAdded);
  25.     cursorManager.removeBusyCursor();
  26.     btnPublish.enabled=true;
  27. }