Jump to content

jkeith

Member
  • Posts

    2
  • Joined

  • Last visited

Posts posted by jkeith

  1. I wanted to share my experience with the new flash API issue, as I was able to get it to work at an event last night.  It was however not with a little editing of the .swf provided in the cook book and use of a link.  

     

    I found an interesting bit of information here - http://www.labnol.org/internet/twitter-rss-feed/28149/ 

     

    Following the instructions here, I was able to convert a Twitter Widget to my own RSS feed.  I then edited the Twitter.fla script:1 actions to this

     

    import flash.utils.Timer;
    import flash.events.TimerEvent;
    import flash.net.URLVariables;
    import flash.events.IOErrorEvent;
    
    //var qParam : String;		// Twitter tag to load, specified by "tag" parameter, if any
    var refreshTimer : Timer = new Timer(10000); // Poll server at this interval
    var isTag : Boolean = this.loaderInfo.parameters.hasOwnProperty("tag");
    
    /*	Provide either a user or tag parameter to determine whether to
    	display a twiotter feed related to a particular @user or #tag.
    	Do not include the @ or # in the user&/tag parameter string.
    */
    //if (this.loaderInfo.parameters.hasOwnProperty("from"))	// Originating user name 
    //	qParam = 'from:'+ this.loaderInfo.parameters['from'];
    //else if (isTag) // Hash tag case
    //	qParam = '#'+ this.loaderInfo.parameters["tag"];
    //else
    //	qParam = '#apple';	// Use this default tag if none specified
    //iFeedName.appendText(qParam);
    
    // Load feed for tag
    var rssLoader:URLLoader = new URLLoader();
    var url : String = "https://script.google.com/macros/s/AKfycbzMuIJZq4Fh0fvOEPhZOqfdvlUEXPwCXEHu2GS79wZvgrNVSN2J/exec";//+ 
    //	encodeURIComponent(qParam);
    if (isTag)	// Get only english results with that tag
    	url += "%20lang%3Aen";
    var rssURL:URLRequest = new URLRequest(url);
    rssLoader.addEventListener(Event.COMPLETE, rssLoaded);
    rssLoader.addEventListener(IOErrorEvent.IO_ERROR, rssFailed);
    
    
    // RSS feed data received - present it
    function rssLoaded(evt:Event):void {
    	var s = evt.target.data;
    	var rssXML : XML = XML(s);
    	var itemCount : uint = rssXML.channel.item.length();
    	var html : String = "";
    	for (var i : uint = 0; i < itemCount; ++i)
    		html += rssXML.channel.item[i].description + '<br/><br/>';
    	iFeedText.taLog.htmlText = html;
    	refreshTimer.start();
    }
    
    // RSS load failed - restart the timer so I'll retry again shortly
    function rssFailed(evt:IOErrorEvent):void {
    	refreshTimer.start();
    }
    
    function reload(evt : TimerEvent) : void {
    	rssLoader.load(rssURL);
    	refreshTimer.stop();
    	refreshTimer.reset();
    }
    
    refreshTimer.addEventListener(TimerEvent.TIMER, reload);
    rssLoader.load(rssURL);	// Perform first load
    
    

    Once I did this, I was able to follow the cookbook instructions to complete the rest, however, no parameters are entered because they are contained in the swf once created.  

     

    I hope someone finds this useful.

     

    Thanks!

×
×
  • Create New...