Latest Projects
Click To View »

  • Smithville Music Festival Website.<br \><a href="http://smithvillemusicfestival.org" target="_blank">http://smithvillemusicfestival.org</a>
  • That Little Paper, La Grange, Texas - Online and Print Classifieds<br /><a href="http://thatlittlepaper.com" target="_blank">http://thatlittlepaper.com</a>
  • La Cabana Restaurant in Smithville, Texas<br /><a href="http://lacabanasmithville.com" target="_blank">http://lacabanasmithville.com</a>
  • Mosaic Artist Stephanie Shroyer<br /><a href="http://ifalltopieces.net" target="_blank">http://ifalltopieces.net</a>
  • City of Smithville website<br \>
<a href="http://www.ci.smithville.tx.us" target="_blank">http://www.ci.smithville.tx.us</a>
S7 Blog > September 2010 > XML Flash Banner in Kentico

XML Flash Banner in Kentico

I was having problems with incorporating a bit of Flash I had with one of my Kentico websites. I posted this on the forum and got one general answer to the problem and a couple of other responses from people having the same sort of problem. Along the way I came up with a solution, which I will describe here.The problem I was having with the Flash and the default Flash webpart for Kentico was this. The Flash I wanted to use pulled images, text and links from an xml file, but the way it was programmer these were not passed as normal parameters. I had used this Flash banner on a regular aspx site before. To simplify using it on that site I used a control called ASPNetFlash that I got from a website by the same name. The control is licensed. You can download a demo which will display a link back to the makers site to test it. The license is very reasonable. I purchased a developer license for  USD $99.00 (30 day money-back guarantee). What I got was a dll file, a license file that goes in the bin folder of the application you are using it on and some code examples. You can download this application at - http://www.aspnetflash.com/aspnetflash_Download_Free_Trial.aspx.

So once I had this I needed to get it incorporated in to Kentico. The first part was to figure out where to put the Flash, image and xml files for this. I ended up using the media library, setting up a directory structure for the control just like a normal installation for a regular aspx site.

Next, I dropped the dll and the license file in the bin folder of my Kentico application. After that I created two files for an inline control; Flash.ascx and the code behind Flash.ascx.cs. The code is below.

  Inline Conrol:

<!--Control Language="C#" AutoEventWireup="true" CodeFile="Flash.ascx.cs" Inherits="CMSInlineControls_Flash"-->
<!--Register Assembly="ASPNetFlash.NET3" Namespace="ASPNetFlash" TagPrefix="ASPNetFlash"-->
<aspnetflash:flash id="Flash1" width="630px" enableviewstate="false" enabled="true" movieurl="/SMF/media/Flash/banner.swf" height="185px" datasourceid="XmlDataSource1" basepath="/smf/media/Flash/" backcolor="White" runat="server">
<htmlalternativetemplate> </htmlalternativetemplate> </aspnetflash:flash> <asp:xmldatasource id="XmlDataSource1" runat="server" datafile="/smf/media/Flash/banner_asset/data.xml"> </asp:xmldatasource>

Code Behind:


using System;
using System.Collections.Generic;
using System.Linq; using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class CMSInlineControls_Flash : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e)
 {
 }
 }


I placed these two files in the CMSInlineControls folder in my Kentico installation. After that I returned to the CMS desk. I allready had a web part zone in place for this so I simply placed a User Contol web part in the zone and gave it the path to the Flash.axcx file and saved everything.


Inline Control  Web Part Configuration

Once everything was in place I restarted the site. You can see the results at http://smithvillemusicfestival.org . I did this on a live site, you could also do this in Visual Studio and rebuild the site.
This gave me a rotating banner with links. It did not have all the features of a full fledged ad banner setup, but it has everything I need on this particular site. I could track click throughs with bit.ly links if I needed to do some basic reporting. I can easily add images by simply uploading an image to the appropriate folder in the Media Library and then editing the xml file and updating it using the update function in the Media Library. This setup is not limited to just banners. You can use this with slideshow Flash, or almost any other Flash that requires you to pass parameters to it via either xml or a database. The beauty of the ASPNet Flash control is that it creates an asp.net data source for the Flash movie making it very flexible. It also includes a way of including and alternative HTML template if you want to be able to show something should Flash not be enabled on the visitors browser. The control automatically detects Flash.
This does have a drawback in that the paths are hard coded in the control, meaning that for different instances you would have to have a different set of files. It is so simple to set this up though that this is not a very big drawback.
I hope some of you will find this useful. Thanks for reading.

Posted: 9/23/2010 3:11:47 PM by Les Warren | with 0 comments



Trackback URL: http://www.s7mediadesign.com/trackback/89956e49-3443-45b4-8b95-23149c35ffcd/XML-Flash-Banner-in-Kentico.aspx

Comments
Blog post currently doesn't have any comments.
Leave comment Subscribe



 Security code