Hi,
I'm working on a clients site and he wants a random flash piece. I have the flash all set and it works fine, but I just had a quick question. Does Flash allow you to input straight XML without using a .XML file? I want to randomize the images that the Flash piece uses, but I don't want to have to create more than one .XML file. Here is the code that I'm using :
CODE
<script language="JavaScript" type="text/javascript">
if (hasReqestedVersion) {
AC_FL_RunContent(
"src", "<%#Me.RootPath%>/images/jewelryflash/dynamic-jewelry.swf?rootPath=<%#Me.RootPath%>/images/jewelryflash/&xmlDoc=<%#Me.RootPath%>/images/jewelryflash/images.xml&speed=5",
"width", "596", "height", "238", "align", "", "id", "jewelry", "quality", "high", "bgcolor", "#FFFFFF", "name", "jewelry", "allowScriptAccess","sameDomain", "type", "application/x-shockwave-flash", "codebase", "https://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab", "pluginspage", "http://www.adobe.com/go/getflashplayer");
} else {
document.write('<acfwc:randomimage alternatetext="<%#Me.ImageAlt1%>" id="imgFlash" runat="server" relativeimagefolder="/images/jewelryflash/" width="596" height="238"></acfwc:randomimage>');
}
</script>
That works fine, and the images appear. But I'm wondering is if I can input XML without the use of a file. Some thing like this :
CODE
<script language="JavaScript" type="text/javascript">
if (hasReqestedVersion) {
AC_FL_RunContent(
"src", "<%#Me.RootPath%>/images/jewelryflash/dynamic-jewelry.swf?rootPath=<%#Me.RootPath%>/images/jewelryflash/&xmlDoc=<asp:literal id="litFlashXML" runat="server" />&speed=5",
"width", "596", "height", "238", "align", "", "id", "jewelry", "quality", "high", "bgcolor", "#FFFFFF", "name", "jewelry", "allowScriptAccess","sameDomain", "type", "application/x-shockwave-flash", "codebase", "https://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab", "pluginspage", "http://www.adobe.com/go/getflashplayer");
} else {
document.write('<acfwc:randomimage alternatetext="<%#Me.ImageAlt1%>" id="imgFlash" runat="server" relativeimagefolder="/images/jewelryflash/" width="596" height="238"></acfwc:randomimage>');
}
</script>
And the codebehind :
CODE
Me.litFlashXML.Text = "<images><image>aquamarine.jpg</image><image>fancy-sapphire.jpg</image><image>malaia-garnet.jpg</image><image>rhodolite.jpg</image><image>tanzanite.jpg</image><image>tourmaline.jpg</image><image>tsavorite.jpg</image></images>"
But when I do that, nothing shows up. The rendered HTML looks like it should work, so I'm wondering if what I'm doing is even possible. This is the rendered HTML :
CODE
<script language="JavaScript" type="text/javascript">
if (hasReqestedVersion) {
AC_FL_RunContent(
"src", "/LapigemsWebApp/images/jewelryflash/dynamic-jewelry.swf?rootPath=/LapigemsWebApp/images/jewelryflash/&xmlDoc=<images><image>aquamarine.jpg</image><image>fancy-sapphire.jpg</image><image>malaia-garnet.jpg</image><image>rhodolite.jpg</image><image>tanzanite.jpg</image><image>tourmaline.jpg</image><image>tsavorite.jpg</image></images>&speed=5",
"width", "596", "height", "238", "align", "", "id", "jewelry", "quality", "high", "bgcolor", "#FFFFFF", "name", "jewelry", "allowScriptAccess","sameDomain", "type", "application/x-shockwave-flash", "codebase", "https://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab", "pluginspage", "http://www.adobe.com/go/getflashplayer");
} else {
document.write('<img id="ctl00_MainContent_imgFlash" src="/LapigemsWebApp/images/jewelryflash/aquamarine.jpg" style="height:238px;width:596px;border-width:0px;" />');
}
</script>
My only other alternative is to create a page and have it create the XML dynamically, but I really don't want to create any more pages. Thanks for any help in advance.
~Camo
This post has been edited by CamoDeveloper: 23 Jun, 2009 - 10:29 AM