summaryrefslogtreecommitdiff
path: root/bPod/com/feeds
diff options
context:
space:
mode:
Diffstat (limited to 'bPod/com/feeds')
-rw-r--r--bPod/com/feeds/FeedButton.as36
-rw-r--r--bPod/com/feeds/FeedItemButton.as59
-rw-r--r--bPod/com/feeds/FeedItemScroller.as17
-rw-r--r--bPod/com/feeds/FeedItemSelectionSystem.as64
-rw-r--r--bPod/com/feeds/FeedScroller.as16
-rw-r--r--bPod/com/feeds/FeedSelectionSystem.as32
-rw-r--r--bPod/com/feeds/ProcessRSS.as1
7 files changed, 225 insertions, 0 deletions
diff --git a/bPod/com/feeds/FeedButton.as b/bPod/com/feeds/FeedButton.as
new file mode 100644
index 0000000..d8d1ed2
--- /dev/null
+++ b/bPod/com/feeds/FeedButton.as
@@ -0,0 +1,36 @@
+import mx.utils.Delegate;
+import mx.transitions.easing.*;
+import mx.transitions.Tween;
+import com.events.EventBroadcaster;
+
+import com.keywords.KeywordButton;
+
+class com.feeds.FeedButton extends KeywordButton {
+
+ private var username_mc:MovieClip;
+ private var backing:MovieClip;
+ private var initialAlpha:Number;
+ private var overlay:MovieClip;
+
+ private function makeButton(_val:Object):Void {
+
+ overlay._visible = false;
+ initialAlpha = backing._alpha;
+ title_mc.title_txt.text = _val.name;
+
+ super.setPosition();
+ }
+
+ private function handleRollOver():Void {
+ var tTween = new Tween(backing, "_alpha", Regular.easeOut, backing._alpha, 40, .4, true);
+ }
+
+ private function handleRollOut():Void {
+
+ if(visited) { var fadeVal:Number = initialAlpha; }
+ else { var fadeVal:Number = initialAlpha; }
+
+ var tTween = new Tween(backing, "_alpha", Regular.easeOut, backing._alpha, initialAlpha, .4, true);
+ }
+
+}; \ No newline at end of file
diff --git a/bPod/com/feeds/FeedItemButton.as b/bPod/com/feeds/FeedItemButton.as
new file mode 100644
index 0000000..8666253
--- /dev/null
+++ b/bPod/com/feeds/FeedItemButton.as
@@ -0,0 +1,59 @@
+import mx.utils.Delegate;
+import mx.transitions.easing.*;
+import mx.transitions.Tween;
+import com.events.EventBroadcaster;
+
+import com.threads.ThreadButton;
+
+class com.feeds.FeedItemButton extends ThreadButton {
+
+ private var username_mc:MovieClip;
+ private var alphabet_mc:MovieClip;
+ private var backing:MovieClip;
+ private var initialAlpha:Number;
+ private var overlay:MovieClip;
+
+ private function makeButton(_val:Object):Void {
+ title_mc.title_txt.autoSize = true;
+ title_mc.title_txt.text = _val.name;
+
+ if (title_mc._height > 26) {
+ title_mc.title_txt.autoSize = false;
+ title_mc.title_txt._height = 28.1;
+ }
+
+ initialAlpha = backing._alpha;
+
+
+ title_mc._y = (_y + _height / 2) - (title_mc._height / 2) ;
+
+ // backing._height = title_mc.title_txt._height;
+
+ this.cacheAsBitmap = true;
+ super.setPosition();
+ }
+
+
+ private function handleRollOver():Void {
+ var tTween = new Tween(backing, "_alpha", Regular.easeOut, backing._alpha, 40, .4, true);
+// makeWhite();
+ }
+
+ private function handleRollOut():Void {
+
+ if(visited) { var fadeVal:Number = initialAlpha; }
+ else { var fadeVal:Number = initialAlpha; }
+
+ var tTween = new Tween(backing, "_alpha", Regular.easeOut, backing._alpha, initialAlpha, .4, true);
+// makeBlack();
+ }
+
+ private function makeWhite():Void {
+ title_mc.title_txt.textColor =0xFFFFFF;
+ }
+
+ private function makeBlack():Void {
+ title_mc.title_txt.textColor =0x000000;
+ }
+
+}; \ No newline at end of file
diff --git a/bPod/com/feeds/FeedItemScroller.as b/bPod/com/feeds/FeedItemScroller.as
new file mode 100644
index 0000000..960d5c2
--- /dev/null
+++ b/bPod/com/feeds/FeedItemScroller.as
@@ -0,0 +1,17 @@
+import com.oop.ScrollingMenuFrame;
+
+class com.feeds.FeedItemScroller extends ScrollingMenuFrame
+{
+ var intRate:Number = 20; // scroller speed
+
+ public function doLoad(_dataArray:Array ):Void {
+
+
+ holder_mc.attachMovie("FeedItemSelectionSystem", "feeds", 1000);
+ holder_mc["feeds"].doInit(_dataArray, "FeedItemButton" );
+
+// holder_mc._x = 0; // use as needed! this puts the horiz scroller back in view
+ holder_mc._y = 0; // when a keyword tile is clicked.
+ }
+
+}; \ No newline at end of file
diff --git a/bPod/com/feeds/FeedItemSelectionSystem.as b/bPod/com/feeds/FeedItemSelectionSystem.as
new file mode 100644
index 0000000..e928f73
--- /dev/null
+++ b/bPod/com/feeds/FeedItemSelectionSystem.as
@@ -0,0 +1,64 @@
+import com.threads.ThreadSelectionSystem;
+import com.services.BuckyServices;
+
+class com.feeds.FeedItemSelectionSystem extends ThreadSelectionSystem {
+
+ private var itemsPerRow:Number = 1;
+ private var vertSpace:Number = 1;
+
+ public function doAction():Void {
+
+ var theItem:Object = systemData[getCurrentSelection()];
+
+ var theDesc:String = stripTags (theItem.desc);
+
+/* if (theDesc.length <= 1 )
+ trace ( stripTags (theItem.desc) );
+ else
+ trace (theItem.link ); */
+
+
+ getURL (theItem.link , "_blank");
+
+
+/* for (var prop in theItem) {
+ trace (prop + " : " + theItem[prop]);
+ }*/
+ }
+
+
+ private function stripTags (s:String):String
+ {
+ var gay:Boolean = false;
+
+ var a:Array = s.split ("");
+ var b:Array = new Array ();
+
+ for (var i = 0; i < a.length; i++)
+ {
+ if (a[i] == '<')
+ {
+ gay = true;
+ }
+ else if (a[i] == '>')
+ {
+ gay = false;
+ }
+ else if (!gay)
+ {
+ b.push (a[i]);
+ }
+ }
+
+/* var final:String = b.join("");
+
+ trace ("final == " + final);
+
+ return final;
+*/
+ return b.join ("");
+
+
+ }
+
+}; \ No newline at end of file
diff --git a/bPod/com/feeds/FeedScroller.as b/bPod/com/feeds/FeedScroller.as
new file mode 100644
index 0000000..2b3d835
--- /dev/null
+++ b/bPod/com/feeds/FeedScroller.as
@@ -0,0 +1,16 @@
+import com.oop.ScrollingMenuFrame;
+
+class com.feeds.FeedScroller extends ScrollingMenuFrame
+{
+ var intRate:Number = 20; // scroller speed
+
+ public function doLoad( _dataArray:Array ):Void {
+ trace ( "FeedScroller: doLoad");
+ holder_mc.attachMovie("FeedSelectionSystem", "feeds", 1000);
+ holder_mc["feeds"].doInit(_dataArray, "FeedItemButton" );
+
+// holder_mc._x = 0; // use as needed! this puts the horiz scroller back in view
+ holder_mc._y = 0; // when a keyword tile is clicked.
+ }
+
+}; \ No newline at end of file
diff --git a/bPod/com/feeds/FeedSelectionSystem.as b/bPod/com/feeds/FeedSelectionSystem.as
new file mode 100644
index 0000000..56ef7c4
--- /dev/null
+++ b/bPod/com/feeds/FeedSelectionSystem.as
@@ -0,0 +1,32 @@
+import com.feeds.ProcessRSS;
+import com.services.BuckyServices;
+import com.events.EventBroadcaster;
+import com.keywords.KeywordSelectionSystem;
+
+class com.feeds.FeedSelectionSystem extends KeywordSelectionSystem {
+
+ private var vertSpace:Number = 1;
+ private var theArray:Array;
+
+ private var newFeed:ProcessRSS;
+
+ private function doAction():Void {
+ return;
+// trace ( "FeedSelectionSystem: doAction");
+ eraseExistingSpinners();
+ startButtonSpinner();
+ theArray = new Array();
+ newFeed = new ProcessRSS (theArray, BuckyServices.rssProxy);
+ newFeed.loadFeed (selectedData().feed);
+ EventBroadcaster.getInstance().addEventListener("feedListMade", this);
+ }
+
+ private function feedListMade():Void {
+
+ BuckyServices.feedThreadsMC.doLoad( newFeed.target_txt , "FeedItemButton" );
+ EventBroadcaster.getInstance().broadcastEvent("switchToFeedThreadsView", this);
+ eraseExistingSpinners();
+
+ }
+
+}; \ No newline at end of file
diff --git a/bPod/com/feeds/ProcessRSS.as b/bPod/com/feeds/ProcessRSS.as
new file mode 100644
index 0000000..1c09d8d
--- /dev/null
+++ b/bPod/com/feeds/ProcessRSS.as
@@ -0,0 +1 @@
+import mx.utils.Delegate; import mx.controls.TextArea; import com.events.EventBroadcaster; class com.feeds.ProcessRSS { //declare public properties: //the TextArea component which will display the information public var target_txt:Array; //the address of the PHP proxy script public var proxyURL:String; //declare private properties: private var _xml:XML; private var items:Array; private var senderObj:LoadVars; private var loaderID:Number; //constructor function ProcessRSS (target:Array, proxy:String) { target_txt = target; proxyURL = proxy; _xml = new XML(); _xml.ignoreWhite = true; _xml.onLoad = Delegate.create(this, onLoadEvent); } private function onLoadEvent(success:Boolean):Void { if (success) { //terminate any running intervals clearInterval(loaderID); // target_txt.text = "<p>Click a headline to open that entry in a new window.</p><br>"; //populate "items" array items = getNodes(_xml, "item"); displayContent(items); } else { // target_txt.text = "<p>XML failed to load.</p>"; } } public function loadFeed(feedURL:String):Void { //initialization: //terminate any running intervals clearInterval(loaderID); //start with an empty array - replace any previous content items = new Array(); //clear any previous text // target_txt.text = ""; //reset scroll position of TextArea component // target_txt.vPosition = 0; //create LoadVars Object senderObj = new LoadVars(); //assign a value to a property of the LoadVars Object senderObj.rss = feedURL; /* The LoadVars.sendAndLoad method conveniently accepts an XML Object as its target. We can send a string (url) to the PHP proxy script and get an XML document back. */ senderObj.sendAndLoad(proxyURL, _xml, "GET"); /* Use setInterval to monitor load progress every 25 milliseconds. Pass the XML document whose download progress you wish to monitor as the 4th argument. Ue of "this" in "this.loaderID" is critical for telling the loadingFeedback() method in what scope to find the XML object. Thanks to Colin Moock for the code this is based loosely on. */ this.loaderID = setInterval(this, "loadingFeedback", 25, _xml); } /* getNodes(): a recursive method for "walking" the XML tree searching for a match to a node name. This is based on an ActionScript 1 XML prototype by Peter Hall. The method returns an array of all XML nodes that match "name". It is used to populate the "items" array with all nodes in the rss document named "item". Note that a node of nodeType 3 is a text node (a string). We don't want to waste time with that now, so the script skips them. */ private function getNodes(node:XMLNode, name:String):Array { var nodes:Array = new Array(); var c:XMLNode = node.firstChild; while (c) { if (c.nodeType != 3) { if (c.nodeName == name) { nodes.push(c); } nodes = nodes.concat(getNodes(c, name)); } c = c.nextSibling; } return nodes; } /* displayContent() is the method responsible for extracting the data I am interested in (the text content of title, link and description) and formatting it for the TextArea component. */ private function displayContent(source:Array):Void { var entries:Number = source.length; var currentNode:XMLNode; var tempTitle:String; var tempLink:String; var tempDescription:String; for (var i:Number = 0; i<entries; i++){ currentNode = source[i]; tempTitle = extractContent(currentNode, "title"); tempLink = extractContent(currentNode, "link"); tempDescription = extractContent(currentNode, "description"); var oneEntry:String = "<headline><a href='"+ tempLink+"' target='_blank'>"+tempTitle+ "</a></headline><p>"+ tempDescription+"</p><br>"; var tmpObj:Object = new Object(); tmpObj.name = tempTitle; tmpObj.link = tempLink; tmpObj.desc = tempDescription; target_txt.push (tmpObj); // target_txt.text += oneEntry; } EventBroadcaster.getInstance().broadcastEvent("feedListMade", null); } /* extractContent() is a modified version of getNodes(). Like getNodes(), it searches the source node recursively for a match to "name", but what it returns when it does find a match is the text content of that node. */ private function extractContent (source:XMLNode, name:String):String { var nodeTxt:String = ""; var c:XMLNode = source.firstChild; while (c) { if (c.nodeType != 3) { if (c.nodeName == name) { nodeTxt = c.firstChild.nodeValue; } nodeTxt += extractContent(c, name); } c = c.nextSibling; } return nodeTxt; } //the progress monitor called by setInterval private function loadingFeedback(xmlObj:XML):Void { var amtLoaded:Number = xmlObj.getBytesLoaded(); if (amtLoaded <= 4){ // target_txt.text = "<p>Requesting Data...</p>"; } else { // target_txt.text = "<p>Loaded: "+ Math.floor(amtLoaded/1024) + " kilobytes</p>"; } } } \ No newline at end of file