ho un problema con uno script che genera tramite funzioni matematiche un grafico a torta.....se lo testo all'interno di una pagina in locale funziona ma se lo metto sul server e lancio la pagina mi apre un filmato di flash vuoto...cosa devo fare? il codice del fla è questo:
stop();
loadVariables("var.cfm","_level0");
amounts = new Array(); wedgename = new Array;
_level0.onData = function (){
//Creo l'array dei dati
amounts = valori.split(",");
wedgename = nomi.split(",");
// array dei colori (ne posso aggiungere quanti ne voglio)
colours = new Array;
colours[0]="0xff0000";colours[1]="0x00ff00";colours[2]="0x0000ff"
colours[3]="0xffff00";colours[4]="0x00ffff";colours[5]="0xff00ff"
colours[6]="0x990000";colours[7]="0x009900";colours[8]="0x000099"
colours[9]="0x999900";colours[10]="0x009999";colours[11]="0x990099"
// parametri
var extrudelabels=true
var radius=100 // circle radius
var labelradius= radius * .8 // this is overridden later on if extrudelabels is true. Otherwise you'll want to set it here.
var roundplaces = 1 // number of decimal points in the wedge label
var centerpointx=200 // x of center of circle
var centerpointy=200 // y of center of circle
var linewidth=2
var outlinecolour = "0x000000"
var minwedgesize = 40 // in degrees, the size of a wedge big enough for the label to go inside
var angleoffset=90 // by default, the pie begins in the east. This offset rotates the whole pie, in degrees, CCW. A value of 90 starts the pie at "north"
// initialize vars
var fromangle=0
var toangle=0
var totalamount=0
// get total
for (zz=0;zz<=amounts.length;zz++){
totalamount = totalamount + Number(amounts[zz])
}
fromangle=0
// loop through array
for (z=0;z<amounts.length;z++){
toangle = fromangle + ((amounts[z]/totalamount)*360)
// create a new clip
_root.createEmptyMovieClip ("wedge" add z, 1);
with (_root.wedge add z){
// draw into the clip
beginFill (colours[z%colours.length], 100); // fill colour, alpha
lineStyle (linewidth, outlinecolour, 100); // line width, colour, and transparency
moveTo (centerpointx, centerpointy);
for (i=fromangle-(angleoffset+1);i<toangle-angleoffset;i++){
lineTo (radius*Math.cos(Math.PI/180 * i)+centerpointx, radius*Math.sin(Math.PI/180 * i)+centerpointy);
}
endFill();
}
// draw label
_root.attachmovie("wedgelabel","wedgelabel"+z, z+10)
thingname = eval("wedgelabel"+z)
thingname.labeltext = roundme((amounts[z]/totalamount)*100,roundplaces) + "%";
thingname.wedgename = wedgename[z]
var bisect = fromangle + ((toangle-fromangle)/2) -angleoffset // bisecting angle of wedge
// this code adds some aesthetic placement to the labels
if (extrudelabels){
if (((amounts[z]/totalamount)*360)>minwedgesize){ // it's a big slice
labelradius = radius *.6 // put the label inside the slice
}else{
labelradius = radius *1.3 // put it outside the slice
// draw a line pointing to the wedge
_root.createEmptyMovieClip ("line" add z, z+30);
with (_root.line add z){
// draw into the clip
beginFill (0xffffff, 0); // fill colour, alpha
lineStyle (1, 0x000000, 100); // line width, colour, and transparency
moveTo (radius*.7*Math.cos(Math.PI/180 * bisect)+centerpointx,radius*.7*Math.sin(Math.PI/180 * bisect)+centerpointy);
lineTo (radius*1.1*Math.cos(Math.PI/180 * bisect)+centerpointx, radius*1.1*Math.sin(Math.PI/180 * bisect)+centerpointy);
endFill();
}
}
}
thingname._x = labelradius * Math.cos(Math.PI/180 * bisect)+centerpointx
thingname._y = labelradius * Math.sin(Math.PI/180 * bisect)+centerpointy
fromangle=toangle
}
function roundme(num, places){
return Math.round(num * (Math.pow(10,places)))/(Math.pow(10,places))
}
function normalize (x, y) {
x = x%y;
if (x<0) {
x = y+x;
}
return x;
}
}

Rispondi quotando
