Home

See also:

SWF Scout library

SWF Scout library is an ActiveX programming library for SWF flash movies generation library from Visual C++, Visual Basic, Visual Basic.NET, ASP and ASP.NET. Can use existing SWF flash movies as templates for new flash movie generation.

read more

RSS2HTMLPro.asp

ASP source code script to convert multiple RSS and Atom feeds into HTML. Provides ability to filter RSS feeds.

read more

 



Tutorial

How to display RSS/XML news feed in Flash movie using ASP script and SWF Scout library

You can download the source code of this example here: asp_rss2flash.zip

This page provides information on free script that generates creeping line like Flash movie displaying news from remote RSS feed using SWF Scout library and ASP.

This script can be used free of charge on any ASP or ASP.NET web-server and generate Flash movie from RSS feed. To generate Flash movie that displays RSS/XML feed you have to have SWF Scout library installed on you ASP/ASP.NET web-server

RSS2flash.ASP script:

<%
Response.Expires = -1

' =========== RSS2HTML.ASP for ASP/ASP.NET ==========
' copyright 2005-2008 (c) www.Bytescout.com
' version 1.25, 24 January 2007
' ===============================================
' ##############################################################
' ####### CHECK OUR COMMERCIAL PRODUCTS FOR ASP/ASP.NET: #######
' RSS2HTMLPro.asp [ http://bytescout.com/rss2htmlpro.html ]- convert multiple RSS feeds into HTML with advanced keywords and phrases based filtering
' SWF Scout [ http://bytescout.com/swfscout.html ]- create, read, modify flash movies (SWF)
' SWF SlideShow Scout [ http://bytescout.com/swfslideshowscout.html ]- convert JPEG,PNG,BMP into slideshow flash (SWF) with effects
' PDFDoc Scout [ http://bytescout.com/pdfdocscout.html ]- generate PDF documents with security options
' Bytescout.PDF [ http://bytescout.com/bytescoutpdf.html ]- write, read, modify PDF documents within .NET applications
' Bytescout.XLS [ http://bytescout.com/bytescoutxls.html ]- write, read, modify XLS (Excel) documents without Excel installed
' ##############################################################

' =========== configuration =====================
' ##### URL to RSS Feed to display #########
URLToRSS = "http://bytescout.blogspot.com/feeds/posts/default?alt=rss"

' ##### max number of displayed items #####
MaxNumberOfItems = 7

' ##### Main template constants
MainTemplateHeader = "<table>"
MainTemplateFooter = "</table>"
' #####

' ######################################
Keyword1 = "" ' Keyword1 = "tech" - set non-empty keyword value to filter by this keyword
Keyword2 = "" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too
' #################################

' ##### Item template.
' ##### {LINK} will be replaced with item link
' ##### {TITLE} will be replaced with item title
' ##### {DESCRIPTION} will be replaced with item description
' ##### {DATE} will be replaced with item date and time
' ##### {COMMENTSLINK} will be replaced with link to comments (if you use RSS feed from blog)
' ##### {CATEGORY} will be replaced with item category
ItemTemplate = "<tr><td><strong>{DATE}</strong><br/><strong>{CATEGORY}<br/></strong><a href=" & """{LINK}""" & ">{TITLE}</a><BR>{DESCRIPTION}</td></tr>"

 

Sample Generated Flash Movie:

 ' ##### Error message that will be displayed if not items etc
  ErrorMessage = "Error has occured while trying to process " &URLToRSS & "<BR>Please contact web-master"

Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
xmlHttp.Open "GET", URLToRSS, false
xmlHttp.Send()
RSSXML = xmlHttp.ResponseText

Set xmlDOM = Server.CreateObject("MSXML2.DomDocument.3.0")
xmlDOM.async = False
xmlDOM.validateOnParse = False
xmlDom.resolveExternals = False

If not xmlDOM.LoadXml(RSSXML) Then
ErrorMessage = "Can not load XML:" & vbCRLF & xmlDOM.parseError.reason & vbCRLF & ErrorMessage
End If

Set xmlHttp = Nothing ' clear HTTP object

Set RSSItems = xmlDOM.getElementsByTagName("item") ' collect all "items" from downloaded RSS

RSSItemsCount = RSSItems.Length-1

' if not <item>..</item> entries, then try to get <entry>..</entry>
if RSSItemsCount = -1 Then
Set RSSItems = xmlDOM.getElementsByTagName("entry") ' collect all "entry" (atom format) from downloaded RSS
RSSItemsCount = RSSItems.Length-1

End If

Set xmlDOM = Nothing ' clear XML


' writing Header
if RSSItemsCount > 0 then
Response.Write MainTemplateHeader
End If

j = -1

For i = 0 To RSSItemsCount
Set RSSItem = RSSItems.Item(i)

for each child in RSSItem.childNodes

Select case lcase(child.nodeName)
case "title"
RSStitle = child.text
case "link"
If RSSLink = "" Then
If child.Attributes.length>0 Then
RSSLink = child.GetAttribute("href")
if (RSSLink <> "") Then
if child.GetAttribute("rel") <> "alternate" Then
RSSLink = ""
End If
End If
End If ' if has attributes
If RSSLink = "" Then
RSSlink = child.text
End If
End If
case "description"
RSSdescription = child.text
case "content" ' atom format
RSSdescription = child.text
case "published"' atom format
RSSDate = child.text
case "pubdate"
RSSDate = child.text
case "comments"
RSSCommentsLink = child.text
case "category"
Set CategoryItems = RSSItem.getElementsByTagName("category")
RSSCategory = ""
for each categoryitem in CategoryItems
if RSSCategory <> "" Then
RSSCategory = RSSCategory & ", "
End If

RSSCategory = RSSCategory & categoryitem.text
Next
End Select
next

' now check filter
If (InStr(RSSTitle,Keyword1)>0) or (InStr(RSSTitle,Keyword2)>0) or (InStr(RSSDescription,Keyword1)>0) or (InStr(RSSDescription,Keyword2)>0) then

j = J+1

if J<MaxNumberOfItems then
ItemContent = Replace(ItemTemplate,"{LINK}",RSSlink)
ItemContent = Replace(ItemContent,"{TITLE}",RSSTitle)
ItemContent = Replace(ItemContent,"{DATE}",RSSDate)
ItemContent = Replace(ItemContent,"{COMMENTSLINK}",RSSCommentsLink)
ItemContent = Replace(ItemContent,"{CATEGORY}",RSSCategory)

Response.Write Replace(ItemContent,"{DESCRIPTION}",RSSDescription)
ItemContent = ""
RSSLink = ""
End if
End If

Next

' writing Footer
if RSSItemsCount > 0 then
Response.Write MainTemplateFooter
else
Response.Write ErrorMessage
End If

' Response.End ' uncomment this for use in on-the-fly output
%>

 
2) Download example from asp_RSS2Flash.zip Unpack files to root folder of your web-server. (This folder is C:\Inetpub\wwwroot\ by default if you use Internet Information Service (IIS) on Windows 2000 and XP)

3) Now open "http://localhost/rss2flash.html" (or "http://<your_webserver_name>/rss2flash.html") in Internet Explorer browser. You will see HTML page with Flash movie generated from RSS provided in URLtoRSS variable in RSS2Flash.ASP script above (this flash movie below is for static and for demo only). When you will use the script on ASP/ASP.NET web-server it will generate dynamic flash movie that will download and display latest version of RSS feed):
 

Here is an example of RSS2Flash.ASP script in action.
The following parameters are used:

URLToRSS = "http://rssnewsapps.ziffdavis.com/tech.xml"
MaxNumberOfItems = 10

FlashTextAlign = "left"
FlashTextColor = "#000000"
FlashLinkColor = "#0000FF"
FlashFontSize = 6
FlashFontName = "Verdana"

FlashWidth = 300 ' width
FlashHeight = 600 ' height
FlashStartOffset = 100 ' offset for initial show

FlashFramesPerSecond = 10

This flash movie was generated using of RSS2Flash.ASP script based on SWF Scout library

SWF Scout is an ActiveX programming library for SWF flash movies generation library from Visual C++, Visual Basic, Visual Basic.NET, ASP and ASP.NET. Can use existing SWF flash movies as templates for new flash movie generation.

IMPORTANT NOTE: this flash movie is static but when you will run script on web-server it will always generate swf flash movies with the latest version of RSS feed.

 

You can download the source code of this example here: asp_rss2flash.zip

See also:

SWF Scout library

Products  |  Download  |  Purchase  |  Support  |  Contacts  |  Testimonials |  

ByteScout, 2003-2008. All other company and product names may be trademarks of their respective companies. Privacy Statement