Topic: cgi-bin problems
hi,
been playing around with flite which seems to work quite well (some voices are far to slow but kal16 and the time one are fine).
so i was trying to make a simple clock widget that speaks the time, just by extending the sampleclock.fla on the wiki.
i made a perl script based on others around the forum to serve up the crossdomain.xml file and run flite_time with the current time as an argument and it works fine just putting the url into my browser (get a valid crossdomain.xml and the speaking works). but i can't for the life of me work out how to get flash to trigger it.
if i load the flash in my browser and enable policy file logging it says "Error: Ignoring policy file at http://192.168.1.43/cgi-bin/custom/speak?POLICY due to meta-policy 'master-only'." which i guess is due to the changes in flash 9/10 so won't be wrong for the chumby?
by adding touch calls in my cgi script i can see that when run on the chumby (either from chumby.com or via chumbyflashplayer.x) the policy file is grabbed, but the second file is never requested (though the "CLICK" trace is written).
what am i doing wrong? any ideas?
my cgi-bin script:
chumby:/psp/cgi-bin# cat speak
#! /usr/bin/perl
#
# get the arguments in the URL
#
$request = $ENV{'QUERY_STRING'}; # get the URL parameters
$request =~ s/\%20/ /g; # unencode spaces - may need other later
@fields = split/\?/, $request; # split into seperate arguments
$fields[0] = uc($fields[0]); # convert to upper case
if ($fields[0] eq "TIMENOW") #say the current time
{
my $test= system("/bin/touch /psp/nowtime");
($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime();
my $rc = system("/psp/usr/bin/flite_time $hour:$minute");
print "content-type:text\/html\r\n\r\n";
print "done=true\r\n\r\n";
}
if ($fields[0] eq "POLICY") # URL get policy
{
my $test= system("/bin/touch /psp/policy");
# send the crossdomain policy file
print "Content-type:text\/xml\r\n\r\n";
print "<\?xml version=\"1.0\"\?>\r\n\r\n";
print "<cross-domain-policy>\n";
print " <allow-access-from domain=\"\*\" \/>\n";
print "<\/cross-domain-policy>\n";
}
and the addition to the sampleclock.fla:
this.onMouseDown = function() {
System.security.loadPolicyFile("http://192.168.1.43/cgi-bin/custom/speak?POLICY")
var speak:XML = new XML();
speak.load("http://192.168.1.43/cgi-bin/custom/speak?TIMENOW")
trace("CLICK");
};