home *** CD-ROM | disk | FTP | other *** search
/ Computer Active 2010 August / CA08.iso / Multimedija / shufflr.air / ShufflrClient.swf / scripts / com / althea / client / shufflr / controller / LoadNextViewCommand.as < prev    next >
Encoding:
Text File  |  2010-06-23  |  2.6 KB  |  78 lines

  1. package com.althea.client.shufflr.controller
  2. {
  3.    import com.althea.client.shufflr.*;
  4.    import com.althea.client.shufflr.controller.errors.ApplicationError;
  5.    import com.althea.client.shufflr.model.*;
  6.    import flash.utils.*;
  7.    import mx.collections.ArrayCollection;
  8.    import mx.logging.ILogger;
  9.    import mx.logging.Log;
  10.    import mx.logging.LogEventLevel;
  11.    import mx.utils.ObjectProxy;
  12.    import org.puremvc.as3.multicore.interfaces.*;
  13.    import org.puremvc.as3.multicore.patterns.command.*;
  14.    import org.puremvc.as3.multicore.patterns.observer.*;
  15.    
  16.    public class LoadNextViewCommand extends SimpleCommand
  17.    {
  18.       private var writeLog:ILogger;
  19.       
  20.       public function LoadNextViewCommand()
  21.       {
  22.          super();
  23.          var _loc1_:String = getQualifiedClassName(this).replace("::",".");
  24.          this.writeLog = Log.getLogger(_loc1_);
  25.       }
  26.       
  27.       override public function execute(param1:INotification) : void
  28.       {
  29.          var notifyStr:String = null;
  30.          var noteBody:Object = null;
  31.          var result:Object = null;
  32.          var link:String = null;
  33.          var viewData:ArrayCollection = null;
  34.          var errObj:ApplicationError = null;
  35.          var note:INotification = param1;
  36.          try
  37.          {
  38.             notifyStr = note.getType();
  39.             noteBody = Object(note.getBody());
  40.             result = noteBody.dataObj;
  41.             link = noteBody.link;
  42.             viewData = new ArrayCollection();
  43.             if(result.rss.channel.item == null)
  44.             {
  45.                viewData = null;
  46.             }
  47.             else if(result.rss.channel.item is ArrayCollection)
  48.             {
  49.                viewData = result.rss.channel.item as ArrayCollection;
  50.             }
  51.             else if(result.rss.channel.item is ObjectProxy)
  52.             {
  53.                viewData.addItem(result.rss.channel.item);
  54.             }
  55.             if(notifyStr == "userTags" || notifyStr == "currUserstags")
  56.             {
  57.                sendNotification(notifyStr,result,link);
  58.             }
  59.             else if(result.rss.channel.item)
  60.             {
  61.                sendNotification(notifyStr,result.rss.channel.item,link);
  62.             }
  63.             else
  64.             {
  65.                sendNotification(notifyStr,null,link);
  66.             }
  67.          }
  68.          catch(err:Error)
  69.          {
  70.             writeLog.fatal("XML data error : " + err.getStackTrace());
  71.             errObj = new ApplicationError(LogEventLevel.FATAL,7500,"XML Data");
  72.             sendNotification(ApplicationFacade.ERROR,errObj);
  73.          }
  74.       }
  75.    }
  76. }
  77.  
  78.