Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Trying to Incorporate CF into FlashMap (color U.S. States based on MySQl Query)

Posted on 2005-03-18
15
Medium Priority
?
169 Views
Last Modified: 2010-04-03
Can u help?
Initially posed (and still open) this question in coldfusion section ... but i think this is a flash issue ... so ... [see http://www.experts-exchange.com/Web/WebDevSoftware/ColdFusion/Q_21355456.html]


I have a flash map - written for me sometime ago but never take advantage of.
It was originally working in .php but I need it to work in CFM (many reasons).

The flashmap calls a CF code that queries my MySQL database by state ... and returns - based on result - a specific color for each state within the flash map.

For some reason the flashmap does not want to accept (???) the values returned by the coldfusion page.  if I run the coldfusion on it's own ... to test for errors... it returns the values (outputs to the screen) just fine! So I feel good that the coldfusion part is correct.

Any ideas?

The flash map's frame code:
---------------------------------

myVars = new LoadVars ();
myVars.load("opinion_flash.cfm");

myvars.onload = function () {

myColor = new Color(AK); myColor.setRGB(myVars.AK);
myColor = new Color(AL); myColor.setRGB(myVars.AL);
myColor = new Color(AR); myColor.setRGB(myVars.AR);
myColor = new Color(AZ); myColor.setRGB(myVars.AZ);
myColor = new Color(CA); myColor.setRGB(myVars.CA);
myColor = new Color(CO); myColor.setRGB(myVars.CO);
myColor = new Color(CT); myColor.setRGB(myVars.CT);
myColor = new Color(NE); myColor.setRGB(myVars.NE);
myColor = new Color(DE); myColor.setRGB(myVars.DE);
myColor = new Color(FL); myColor.setRGB(myVars.FL);
myColor = new Color(GA); myColor.setRGB(myVars.GA);
myColor = new Color(HI); myColor.setRGB(myVars.HI);
myColor = new Color(IA); myColor.setRGB(myVars.IA);
myColor = new Color(ID); myColor.setRGB(myVars.ID);
myColor = new Color(IL); myColor.setRGB(myVars.IL);
myColor = new Color(IN); myColor.setRGB(myVars.IN);
myColor = new Color(KS); myColor.setRGB(myVars.KS);
myColor = new Color(KY); myColor.setRGB(myVars.KY);
myColor = new Color(LA); myColor.setRGB(myVars.LA);
myColor = new Color(MA); myColor.setRGB(myVars.MA);
myColor = new Color(MD); myColor.setRGB(myVars.MD);
myColor = new Color(ME); myColor.setRGB(myVars.ME);
myColor = new Color(MI); myColor.setRGB(myVars.MI);
myColor = new Color(MN); myColor.setRGB(myVars.MN);
myColor = new Color(MO); myColor.setRGB(myVars.MO);
myColor = new Color(MS); myColor.setRGB(myVars.MS);
myColor = new Color(MT); myColor.setRGB(myVars.MT);
myColor = new Color(NC); myColor.setRGB(myVars.NC);
myColor = new Color(ND); myColor.setRGB(myVars.ND);
myColor = new Color(NH); myColor.setRGB(myVars.NH);
myColor = new Color(NJ); myColor.setRGB(myVars.NJ);
myColor = new Color(NM); myColor.setRGB(myVars.NM);
myColor = new Color(NV); myColor.setRGB(myVars.NV);
myColor = new Color(NY); myColor.setRGB(myVars.NY);
myColor = new Color(OH); myColor.setRGB(myVars.OH);
myColor = new Color(OK); myColor.setRGB(myVars.OK);
myColor = new Color(OR); myColor.setRGB(myVars.OR);
myColor = new Color(PA); myColor.setRGB(myVars.PA);
myColor = new Color(RI); myColor.setRGB(myVars.RI);
myColor = new Color(SC); myColor.setRGB(myVars.SC);
myColor = new Color(SD); myColor.setRGB(myVars.SD);
myColor = new Color(TN); myColor.setRGB(myVars.TN);
myColor = new Color(TX); myColor.setRGB(myVars.TX);
myColor = new Color(UT); myColor.setRGB(myVars.UT);
myColor = new Color(VA); myColor.setRGB(myVars.VA);
myColor = new Color(VT); myColor.setRGB(myVars.VT);
myColor = new Color(WA); myColor.setRGB(myVars.WA);
myColor = new Color(WI); myColor.setRGB(myVars.WI);
myColor = new Color(WY); myColor.setRGB(myVars.WY);
myColor = new Color(WV); myColor.setRGB(myVars.WV);
}


the coldfusion code [opinion_flash.cfm]
---------------------------------------------

<cfscript>

function sC(x) { // Function used to set color
  if (x LT 0)  return "FF0000";
  else if (x GT 0) return "0000FF";
  else return "FFFFFF";
}
</cfscript>
<cfquery name="flashmap" datasource="fred">
  SELECT * FROM usa_map
   WHERE mapReason = 'BUSH'
   ORDER BY state
</cfquery>
<cfoutput query="flashmap">#FlashMap.State# = 0x#sC(FlashMap.Value)#&
</cfoutput>



the simple test htm page that loads the flashmap swf file
-----------------------------------------------------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="375" height="250">
  <param name="movie" value="opinion_map.swf">
  <param name=quality value=high>
  <embed src="dynamic_map_final.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="375" height="250"></embed>
</object>
</body>
</html>




The flashmap displays BLACK color for each state ... which would suggest the values passed to states are zero!? i.e. crap!?

Thanks for any help!
R.
0
Comment
Question by:rcbuchanan
  • 8
  • 7
15 Comments
 
LVL 27

Expert Comment

by:negatyve
ID: 13581566
Before all, try:

myColor.setRGB(parseInt(myVars.AK, 16));
0
 

Author Comment

by:rcbuchanan
ID: 13582065
Negatyve:
Thanks ...
tried:

myVars = new LoadVars ();
myVars.load("opinion_flash.cfm");

myvars.onload = function () {

myColor = new Color(AK); myColor.setRGB(myVars.AK);
myColor = new Color(AL); myColor.setRGB(myVars.AL);
myColor = new Color(AR); myColor.setRGB(myVars.AR);
myColor = new Color(AZ); myColor.setRGB(myVars.AZ);
myColor = new Color(CA); myColor.setRGB(myVars.CA);
myColor = new Color(CO); myColor.setRGB(myVars.CO);
myColor = new Color(CT); myColor.setRGB(myVars.CT);
myColor = new Color(NE); myColor.setRGB(myVars.NE);
myColor = new Color(DE); myColor.setRGB(myVars.DE);
myColor = new Color(FL); myColor.setRGB(myVars.FL);
myColor = new Color(GA); myColor.setRGB(myVars.GA);
myColor = new Color(HI); myColor.setRGB(myVars.HI);
myColor = new Color(IA); myColor.setRGB(myVars.IA);
myColor = new Color(ID); myColor.setRGB(myVars.ID);
myColor = new Color(IN); myColor.setRGB(parseInt(myVars.IL, 16));
myColor = new Color(IN); myColor.setRGB(myVars.IN);
myColor = new Color(KS); myColor.setRGB(myVars.KS);
myColor = new Color(KY); myColor.setRGB(myVars.KY);
myColor = new Color(LA); myColor.setRGB(myVars.LA);
myColor = new Color(MA); myColor.setRGB(myVars.MA);
myColor = new Color(MD); myColor.setRGB(myVars.MD);
myColor = new Color(ME); myColor.setRGB(myVars.ME);
myColor = new Color(MI); myColor.setRGB(myVars.MI);
myColor = new Color(MN); myColor.setRGB(myVars.MN);
myColor = new Color(MO); myColor.setRGB(myVars.MO);
myColor = new Color(MS); myColor.setRGB(myVars.MS);
myColor = new Color(MT); myColor.setRGB(myVars.MT);
myColor = new Color(NC); myColor.setRGB(myVars.NC);
myColor = new Color(ND); myColor.setRGB(myVars.ND);
myColor = new Color(NH); myColor.setRGB(myVars.NH);
myColor = new Color(NJ); myColor.setRGB(myVars.NJ);
myColor = new Color(NM); myColor.setRGB(myVars.NM);
myColor = new Color(NV); myColor.setRGB(myVars.NV);
myColor = new Color(NY); myColor.setRGB(myVars.NY);
myColor = new Color(OH); myColor.setRGB(myVars.OH);
myColor = new Color(OK); myColor.setRGB(myVars.OK);
myColor = new Color(OR); myColor.setRGB(myVars.OR);
myColor = new Color(PA); myColor.setRGB(myVars.PA);
myColor = new Color(RI); myColor.setRGB(myVars.RI);
myColor = new Color(SC); myColor.setRGB(myVars.SC);
myColor = new Color(SD); myColor.setRGB(myVars.SD);
myColor = new Color(TN); myColor.setRGB(myVars.TN);
myColor = new Color(TX); myColor.setRGB(myVars.TX);
myColor = new Color(UT); myColor.setRGB(myVars.UT);
myColor = new Color(VA); myColor.setRGB(myVars.VA);
myColor = new Color(VT); myColor.setRGB(myVars.VT);
myColor = new Color(WA); myColor.setRGB(myVars.WA);
myColor = new Color(WI); myColor.setRGB(myVars.WI);
myColor = new Color(WY); myColor.setRGB(myVars.WY);
myColor = new Color(WV); myColor.setRGB(myVars.WV);
}


and no luck. [yes, IL does have a value to test]

Any more ideas? :-)

R.
0
 
LVL 27

Expert Comment

by:negatyve
ID: 13583488
myVars = new LoadVars ();
myVars.load("opinion_flash.cfm");

myvars.onload = function ()
{
      trace(myVars.AK)// what does it trace?
}
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:rcbuchanan
ID: 13585923
N,
Ok, placed your code into the frame code on the flash movie and I get nothing.
Zilch.  No reaction despite the same black flash map.

Any ideas?
R
0
 
LVL 27

Expert Comment

by:negatyve
ID: 13585963
So it doesn't trace at least "undefined"?
0
 

Author Comment

by:rcbuchanan
ID: 13586002
Excuse my stupidity but where might I see this 'undefined' value returned?
I'm a newbie.  I took your code ... and placed into the frame's code on flash ... then published as a .swf and run.

The visual reaction : just the same U.S. map with each state in black.
No messages etc.,

Is there a way to test the code without publishing, and thus checking your 'undefined' question?

R.
0
 
LVL 27

Expert Comment

by:negatyve
ID: 13586104
Ah, ok, don't worry. You should see it in the Output panel, in testing mode. Inside flash, press Ctrl + Enter, then this pane should automatically popup showing you something..
0
 

Author Comment

by:rcbuchanan
ID: 13586117
ah!... bingo.
Then yes, ... in test movie mode ... the debug window pops up and I do indeed get 'undefined' every 5 seconds or so!
bugger!

Is that what u expected? ... does this mean it's not communicating /w the CF?
R.
0
 
LVL 27

Expert Comment

by:negatyve
ID: 13586259
It means that you cannot reach the cf page or that it's not returning good values. If you load the cfm page in the browser, what kind of output does it generate?
0
 

Author Comment

by:rcbuchanan
ID: 13586325
Hmm. when I run the cfm page ... I get this:

AA=#0000FF&AE=#0000FF&AK=#0000FF&AL=#0000FF&AP=#0000FF&AR=#FF0000&AS=#FF0000&AZ=#0000FF&CA=#FF0000&CO=#FF0000&CT=#FF0000&DC=#0000FF&DE=#0000FF&FL=#FF0000&FM=#CCCCCC&GA=#0000FF&GU=#0000FF&HI=#FF0000&IA=#FF0000&ID=#0000FF&IL=#FF0000&IN=#FF0000&KS=#0000FF&KY=#0000FF&LA=#0000FF&MA=#0000FF&MD=#0000FF&ME=#0000FF&MH=#0000FF&MI=#FF0000&MN=#CCCCCC&MO=#0000FF&MP=#0000FF&MS=#0000FF&MT=#FF0000&NC=#0000FF&ND=#0000FF&NE=#FF0000&NH=#FF0000&NJ=#FF0000&NM=#FF0000&NV=#0000FF&NY=#FF0000&OH=#FF0000&OK=#0000FF&OR=#FF0000&PA=#FF0000&PR=#FF0000&PW=#0000FF&RI=#0000FF&SC=#CCCCCC&SD=#0000FF&ST=#CCCCCC&TN=#FF0000&TX=#0000FF&UT=#0000FF&VA=#FF0000&VI=#FF0000&VT=#FF0000&WA=#FF0000&WI=#FF0000&WV=#FF0000&WY=#0000FF
The file is located in the root of the web page.
i.e. http://www.fred.com/

should I instead call the file as:
myVars.load("c:\web\fred\opinion_flash.cfm"); ? - as in referring to the physical location on the web server?

R.
0
 
LVL 27

Accepted Solution

by:
negatyve earned 2000 total points
ID: 13586364
Ok.

1. You should make it output:

AA=0000FF&AE=0000FF&AK=0000FF&AL=0000FF&

instead of

AA=#0000FF&AE=#0000FF&AK=#0000FF&AL=#0000FF&

2. Use my code:

ie:  myColor.setRGB(parseInt(myVars.AK, 16));

3. Use an absolute path to call the page:

ie: http://localhost/yourpage.cfm

ie: http://www.fred.com/


0
 

Author Comment

by:rcbuchanan
ID: 13586391
Yes. I've done all these ... and still no bloody luck.
I gave up. :-)

Thanks. Will readdress problem in the days ahead.
Appreciate ur help.
R
0
 
LVL 27

Expert Comment

by:negatyve
ID: 13586492
Wait, we can do it.. :)

Could you show me your fla?
0
 

Author Comment

by:rcbuchanan
ID: 13586500
Thanks, I truly appreciate ... but I found an alternative - and will walk away from this attempt.
the alternative is https://www.flamignon.com

shows flash maps (US and EU) via XML - which I'll have better luck with, I hope.

R.
0
 
LVL 27

Expert Comment

by:negatyve
ID: 13586578
That's ok, cheers! :)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to how to record live broadcast.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question