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

  1. package com.althea.client.shufflr.model
  2. {
  3.    import com.althea.client.shufflr.ApplicationFacade;
  4.    import flash.filesystem.File;
  5.    import flash.filesystem.FileMode;
  6.    import flash.filesystem.FileStream;
  7.    import flash.utils.getQualifiedClassName;
  8.    import mx.logging.ILogger;
  9.    import mx.logging.Log;
  10.    import org.puremvc.as3.multicore.patterns.proxy.Proxy;
  11.    
  12.    public class SourceSiteProxy extends Proxy
  13.    {
  14.       public static const NAME:String = "SourceSiteProxy";
  15.       
  16.       private var writeLog:ILogger;
  17.       
  18.       private var version:Number = 0.1;
  19.       
  20.       private var sourceTitle:String = "";
  21.       
  22.       public function SourceSiteProxy(param1:Object = null)
  23.       {
  24.          super(NAME,param1);
  25.          var _loc2_:String = getQualifiedClassName(this).replace("::",".");
  26.          this.writeLog = Log.getLogger(_loc2_);
  27.       }
  28.       
  29.       public function getSourceSiteTitle() : void
  30.       {
  31.          var file:File = null;
  32.          var fileStream:FileStream = null;
  33.          var sourceSiteXML:XML = null;
  34.          try
  35.          {
  36.             file = File.applicationDirectory.resolvePath("assets/xmldata/SourceSite.xml");
  37.             if(file)
  38.             {
  39.                fileStream = new FileStream();
  40.                fileStream.open(file,FileMode.READ);
  41.                sourceSiteXML = XML(fileStream.readUTFBytes(fileStream.bytesAvailable));
  42.                fileStream.close();
  43.                if(sourceSiteXML)
  44.                {
  45.                   this.sourceTitle = sourceSiteXML.child("title").children()[0].toString() as String;
  46.                   this.sendNotification(ApplicationFacade.SOURCE_SITE_TITLE,this.sourceTitle);
  47.                }
  48.                else
  49.                {
  50.                   sendNotification(ApplicationFacade.SOURCE_SITE_TITLE,"");
  51.                }
  52.             }
  53.             else
  54.             {
  55.                sendNotification(ApplicationFacade.SOURCE_SITE_TITLE,"");
  56.             }
  57.          }
  58.          catch(errObj:Error)
  59.          {
  60.             sendNotification(ApplicationFacade.SOURCE_SITE_TITLE,"");
  61.          }
  62.       }
  63.    }
  64. }
  65.  
  66.