Visualizzazione dei risultati da 1 a 3 su 3

Discussione: caricamento variabili

  1. #1
    Utente di HTML.it L'avatar di nestore
    Registrato dal
    Feb 2002
    Messaggi
    458

    Urgente!!! IN locale SI in REMOTO NO!!!!!

    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;
    }
    }

  2. #2
    A parte che tanto è inutile che posti tutto 'sto codice perché dubito che qualcuno si metterà a studiarselo tutto, in ogni caso la cosa più ovvia che mi viene in mente e se il percorso della pagina .cfm da cui prendi i valori è giusto anche in remoto e se sì se hai provato se ti restituisce dei valori > 0.

    Io credo che il problema sia proprio da ricercare in una di queste due possibilità, poiché il tuo grafico viene generato con i metodi di disegno di Flash MX che logicamente non disegnano niente se non hanno dei valori su cui appoggiarsi.

  3. #3
    Utente di HTML.it L'avatar di nestore
    Registrato dal
    Feb 2002
    Messaggi
    458
    niente scusa...........problema risolto............colpa del browser!!!!!!!!!!!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.