Wednesday, September 29, 2010

Cube Effect



<?xml version="1.0" encoding="utf-8"?>
<mx:Application 
  xmlns:mx="http://www.adobe.com/2006/mxml"
  xmlns:components="com.pfp.components.*" 
  xmlns:views="com.pfp.rsscube.views.*"
  creationComplete="init()"
  layout="vertical" width="100%" height="100%" backgroundColor="#ffffff" viewSourceURL="srcview/index.html" borderStyle="solid" backgroundGradientAlphas="[0.0, 0.11]" backgroundGradientColors="[#FFFFFF, #FFFFFF]">
  <mx:Style source="yflexskin.css" />
  <mx:Style source="style.css" />
  <mx:Script>
    <![CDATA[
      import com.pfp.rsscube.models.MainModel;
      import com.adobe.viewsource.ViewSource;
      
      [Bindable]
      private var model:MainModel = MainModel.GetInstance();
      
      private function init():void
      {
        var srcUrl:String = Application.application.parameters.srcUrl;
        if(srcUrl)
          ViewSource.addMenuItem(this, srcUrl);
      }
    ]]>
  </mx:Script>
  <components:CubeStack id="cube" 
    selectedSide="{model.cubeSide}">
    <views:FeedList name="Front"  width="794"/>
    <views:RssFeedSide name="Left" 
    RssSource="http://feeds.feedburner.com/Mashable?format=xml"/>
    <views:RssFeedSide name="Back" 
      RssSource="http://feeds.engadget.com/weblogsinc/engadget"/>
    <views:RssFeedSide name="Right" 
      RssSource="http://feeds.gawker.com/lifehacker/full"/>
    <views:TopPanel name="Top" />
    <views:BottomPanel name="Bottom" />
  </components:CubeStack>
</mx:Application>

<--------------------Bottom Panel------------------>

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="794" height="450" borderStyle="solid">
  <mx:borderSkin>@Embed(source='../../../../pics/group-wallpaper_1024x768.jpg')</mx:borderSkin>
  <mx:Script>
    <![CDATA[
      import mx.core.Application;
      import flash.net.navigateToURL;
      import com.pfp.rsscube.models.MainModel;
      
      [Bindable]
      private var model:MainModel = MainModel.GetInstance();
      
      private function gotoSource():void
      {
        var req:URLRequest = new URLRequest(Application.application.parameters.srcUrl);
        navigateToURL(req, "_self");
      }
    ]]>
  </mx:Script>
  <mx:Button 
    top="3" right="3" height="20" label="MUMBAI INDIANS" 
    click="model.cubeSide = 'Front'" />
</mx:Canvas>
<-------------FeedList------------------->

<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
  width="794" height="450" borderStyle="solid">
  <mx:borderSkin>@Embed(source='../../../../pics/Sachin1_1280x800.jpg')</mx:borderSkin>
  <mx:Script>
    <![CDATA[
      import com.pfp.rsscube.models.MainModel;
      
      [Bindable]
      private var model:MainModel = MainModel.GetInstance();
    ]]>
  </mx:Script>
  <mx:Label 
    text="Choose The Team:" fontSize="18" fontWeight="bold" color="#FFFFFF"/>
  <mx:Button 
    label="DELHI DARDEVIL" 
    click="model.cubeSide = 'Right'" width="147" />
  <mx:Button 
    label="DELHI DARDEVIL" 
    click="model.cubeSide = 'Left'" width="149" />
  <mx:Button 
    height="20" label="SUPER KINGS" 
    click="model.cubeSide = 'Bottom';" width="149"/>
  <mx:Button 
    height="20" label="KNIGHT RIDERS" 
    click="model.cubeSide = 'Top';" width="150"/>
</mx:VBox>

<-----------------RssFeedSide------------------->

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas 
  xmlns:mx="http://www.adobe.com/2006/mxml"
  xmlns:views="com.pfp.rsscube.views.*" 
  width="794" height="450"
  creationPolicy="all"
  horizontalScrollPolicy="off"
  verticalScrollPolicy="off" borderStyle="solid" borderSkin="@Embed(source='../../../../pics/wp-V-Sehwag.jpg')">
  <mx:Script>
    <![CDATA[
      import com.pfp.rsscube.vos.RssItem;
      import mx.collections.ArrayCollection;
      import com.pfp.rsscube.models.MainModel;
      import mx.rpc.events.ResultEvent;
      
      [Bindable]  
      private var rssItems:ArrayCollection;
      
      [Bindable]
      private var feedName:String;
      
      public function set RssSource(value:String):void
      {
        if(!value)
          return;
          
        rssService.url = value;
        rssService.send();
      }
      
      private var model:MainModel = MainModel.GetInstance();
      
      private function handleRss(event:ResultEvent):void
      {
        var items:Object = event.result.rss.channel.item;
        feedName = event.result.rss.channel.title;
        
        rssItems = new ArrayCollection();
        var item:RssItem;
        
        for(var i:int = 0; i < items.length; i++)
        {
          if(i == 15)
            break;
          
          item = new RssItem();
          item.title = items[i].title;
          item.link = items[i].guid.value;
          item.author = items[i].creator;
          item.date = items[i].pubDate;
          rssItems.addItem(item);
        }
      }
      
    ]]>
  </mx:Script>
  <mx:HTTPService id="rssService" result="handleRss(event)" />
  <mx:Label x="5" text="{feedName}" styleName="FeedTitle" />
  <mx:Button 
    top="2" right="2" height="20" label="KNIGHT RIDERS" 
    click="model.cubeSide = 'Top';"/>
  <mx:Button 
    bottom="3" left="3" height="20" label="MUMBAI INDIANS" 
    click="model.cubeSide = 'Front'"/>
  <mx:Button 
    right="2" bottom="2" height="20" label="SUPER KINGS" 
    click="model.cubeSide = 'Bottom';"/>
</mx:Canvas>

<-------------------------Rss Post---------------------->

<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%">
  <mx:Script>
    <![CDATA[
      import flash.net.navigateToURL;
      import com.pfp.rsscube.vos.RssItem;
      
      [Bindable]
      private var rssdata:RssItem;
    
      override public function set data(value:Object):void
      {
        rssdata = value as RssItem;
        
        author.text = "Written by " + rssdata.author;
        if(rssdata.date)
          author.text += (", " + rssdata.date); 
      }
      
      private function followPostLink():void
      {
        var req:URLRequest = new URLRequest(rssdata.link);
        navigateToURL(req, "_self");
      }
    ]]>
  </mx:Script>
  <mx:Label 
    styleName="RssTitle" text="{rssdata.title}" 
    truncateToFit="true" maxWidth="350"
    click="followPostLink()" useHandCursor="true"
    buttonMode="true" mouseChildren="false" />
  <mx:Label id="author" styleName="RssAuthor"/>
</mx:VBox>

<-----------------Top Panel-------------------->

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" 
  width="794" height="450" borderStyle="solid" borderSkin="@Embed(source='../../../../pics/03_1024x768.jpg')">
  <mx:Script>
    <![CDATA[
      import com.pfp.rsscube.models.MainModel;
      
      [Bindable]
      private var model:MainModel = MainModel.GetInstance();
    ]]>
  </mx:Script>
  <mx:Button 
    bottom="3" right="3" height="20" label="MUMBAI INDIANS" 
    click="model.cubeSide = 'Front'" />
</mx:Canvas>
<<---------------------------------------AND ADD CUBE ACTION SCRIPT FILES---------------------->>

     

No comments:

Post a Comment