Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: Re: FLASH: Can anyone help me with flash and Cold Fusion?
From: Mark Zukiwsky
Date: Thu, 2 Mar 2000 21:38:12 GMT

Hi Sarah,

Here's an example of a ColdFusion template that I'm using to get data
into Flash. I'm using the POST function in Flash to fetch my
variables. My Flash Post action is something like:

Set Variable: "baseURL" = "http://mark.foxmicro.net/flash/"
Set Variable: "CFtemplate" = "getMenuData.cfm"
Set Variable: "SiteID" = 1
Set Variable: "eof" = 0
Set Variable: "index" = 1
Load Variables (baseURL & CFtemplate, 0, vars=POST)
Go to and Play ("Check")

That calls the following ColdFusion template:
------------------------------------------------
<cfsetting showdebugoutput="no">
<cfsetting enablecfoutputonly="yes">
<cfcontent type="text/plain">

<!--- get training menu data, be sure to pass FORM.siteID --->
<cfquery name="flashtext" datasource="MyDatabase" dbtype="OLEDB">
SELECT busUnit, unitName, novaUnit, activeUnit
FROM UnitTBL
WHERE SiteID = #Trim(FORM.SiteID)#
ORDER BY novaUnit, unitName
</cfquery>

<!--- Convert query results into list --->
<cfset unitList = valueList(flashtext.busUnit)>
<cfset nameList = valueList(flashtext.unitName)>
<cfset novaList = valueList(flashtext.novaUnit)>
<cfset activeList = valueList(flashtext.activeUnit)>

<cfset unitReturn = "">
<cfset nameReturn = "">
<cfset novaReturn = "">
<cfset activeReturn = "">
<cfloop index = "unitIndex" from = "1" To = "#ListLen(unitList)#">
<cfset tempUnit = ListGetAt(unitList, unitIndex)>
<cfset unitX = "unit" & unitIndex>
<cfset tempName = ListGetAt(nameList, unitIndex)>
<cfset unitNameX = "unitName" & unitIndex>
<cfset tempNova = ListGetAt(novaList, unitIndex)>
<cfset companyX = "company" & unitIndex>
<cfset tempActive = ListGetAt(activeList, unitIndex)>
<cfset activeX = "active" & unitIndex>
<cfoutput>&#unitX#=#tempUnit#</cfoutput>
<cfoutput>&#unitNameX#=#URLEncodedFormat(tempName)#</cfoutput>
<cfoutput>&#companyX#=#tempNova#</cfoutput>
<cfoutput>&#activeX#=#tempActive#</cfoutput>
<cfoutput>#chr(13)#</cfoutput>
</cfloop>
<cfoutput>&unitCount=#flashtext.recordCount##chr(13)#</cfoutput>
<cfoutput>&eof=1</cfoutput>
------------------------------------------------

The above template would return output like:
------------------------------------------------
&unit1=1&unitName1=NOVA%20%2D%20Joffre%20Personnel&company1=True&active1=True
&unit2=11&unitName2=Coutts%20Electrical%20Ltd%2E&company2=False&active2=True
&unit3=3&unitName3=HATSCAN&company3=False&active3=True
&unit4=4&unitName4=Modern%20Plant%20Services&company4=False&active4=True
&unit5=10&unitName5=multimedia%20works&company5=False&active5=False
&unit6=12&unitName6=O%27Reilly%20Insulators%20Inc%2E&company6=False&ac
tive6=True
&unit7=2&unitName7=Quinn%20Contracting&company7=False&active7=True
&unitCount=7
&eof=1

Then in Flash I'd check whether the variables have been loaded by
checking the value that the value of eof = 1:

If (eof = 1)
Go to and Play ("Done")
Else
Go to and Play ("Check")
End If

After the variables have been loaded, I use this action to convert
the results to variables:

Loop While (index <= unitCount)
Set Variable: "tempUnitID" & index = Eval("unit" & index)
Set Variable: "tempUnit" & index = Eval("unitName" & index)
Set Variable: "tempCompany" & index = Eval("Company" & index)
Set Variable: "tempActive" & index = Eval("active" & index)
Set Variable: "index" = index + 1
End Loop
Go to and Play ("Display")

Now, depending on what you're doing in your display, the results
should display something like:

http://mark.foxmicro.net/flashmenu/

This example posts a random siteID to the ColdFusion template. To see
the data that is used to build this menu try:

http://mark.foxmicro.net/cf_flash/flashtest3.cfm?SiteID=1 or SiteID=11937

I hope this helps.

Mark Zukiwsky
Edmonton, Canada

flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flashforward2000 and The Flash Film Festival
"The World�s Premier Flash Solutions Conference and Expo"
March 27-29, Nob Hill Masonic Center, San Francisco, California

-Register before Feb 25 and save $200!!-- www.flashforward2000.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com


[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]