Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Community > Tech > problema action script flash mx
  Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
ste182
.arcimaestro.

User info:
Registered: Oct 2004
Posts: 258 (0.03 al dì)
Location:
Corso: informatica
Anno:
Time Online: 2 Days, 5:06:07: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
problema action script flash mx

ciao a tutti, sto facendo un mp3 player con flash da inserire nel mio sito... vorrei caricare i file da un file xml ma ho dei problemi.. ecco il codice che ho scritto fin ora:

playlist = new XML();
playlist.ignoreWhite = true;
playlist.onload = function(success) {
_global.songname = [];
_global.songfile = [];
if (success) {
for (var i = 0; i<playlist.firstChild.childNodes.length; i++) {
_global.songname[i] = playlist.firstChild.childNodes[i].attributes.title;
_global.songfile[i] = playlist.firstChild.childNodes[i].attributes.path;
trace("-Titolo: '"+songname[i]+"' -Path: '"+songfile[i]+"'");
}
} else {
titolo = "Error loading XML";
}
};
playlist.load("playlist.xml");
suono = new Sound();
suono.loadSound(_global.songfile[0], false);
titolo = _global.songname[0];
x = Math.round(suono.getBytesLoaded()/suono.getBytesTotal()*100);
perc = x+"%";
_root.barra._xscale = x;
suono.onSoundComplete = suona();
function suona() {
suono.start();
}

come vedete ho usato degli array per memorizzare il titolo e il path del file mp3... solo che questi dati sono visibili all'interno del ciclo for ma al di fuori non li vede e quindi quando vado a fare
suono.loadSound(_global.songfile[0], false);
non legge _global.songfile[0] e quindi mi da errore... non capisco come mai quell'array è vuoto mentre se faccio un trace all'interno del for l'array presenta il path corretto.. help please!!!

__________________
Live Fast, Die Fun

06-10-2005 17:23
Click Here to See the Profile for ste182 Click here to Send ste182 a Private Message Find more posts by ste182 Add ste182 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
fabpicca
jesus robot d'acciaio

User info:
Registered: May 2002
Posts: 2166 (0.25 al dì)
Location: Pieve Emanuele
Corso: Ticom
Anno:
Time Online: 12 Days, 23:12:28 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Potrebbe trattarsi di un semplice problema di scope (anche se , essendo le variabili globali, non dovrebbero esserci problemi), prova a tirar fuori la dichiarazione dei due array dal "metodo anonimo":


code:
_global.songname = []; _global.songfile = []; playlist = new XML(); playlist.ignoreWhite = true; playlist.onload = function(success) { if (success) { for (var i = 0; i<playlist.firstChild.childNodes.length; i++) { _global.songname[i] = playlist.firstChild.childNodes[i].attributes.title; _global.songfile[i] = playlist.firstChild.childNodes[i].attributes.path; trace("-Titolo: '"+songname[i]+"' -Path: '"+songfile[i]+"'"); } } else { titolo = "Error loading XML"; } }; playlist.load("playlist.xml"); suono = new Sound(); suono.loadSound(_global.songfile[0], false); titolo = _global.songname[0]; x = Math.round(suono.getBytesLoaded()/suono.getBytesTotal()*100); perc = x+"%"; _root.barra._xscale = x; suono.onSoundComplete = suona(); function suona() { suono.start(); }

__________________
my website?|ubuntu linux|get Firefox|grazie Polonia |bagdad sour

"Come va che non ha le corna e le zampe di Caprone?" gli opposi. "Oh, Giuvà", mi disse il prete "adesso non si usa più.Satana è furbo". (I.Silone, Fontamara)
"Al giorno d'oggi non bisogna essere intelligenti, perchè la gente si offende" (un ubriacone)
"close your eyes / pay the price / for your paradise" (DM) "whatever you want to change/you'd better start changing it in your mind" (Transatlantic)

06-10-2005 20:46
Click Here to See the Profile for fabpicca Click Here to See the Blog of fabpicca Click here to Send fabpicca a Private Message Visit fabpicca's homepage! Find more posts by fabpicca Add fabpicca to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
ste182
.arcimaestro.

User info:
Registered: Oct 2004
Posts: 258 (0.03 al dì)
Location:
Corso: informatica
Anno:
Time Online: 2 Days, 5:06:07: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

non ho capito.. potresti essre più chiaro su quello che dovrei fare?

__________________
Live Fast, Die Fun

06-10-2005 20:50
Click Here to See the Profile for ste182 Click here to Send ste182 a Private Message Find more posts by ste182 Add ste182 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
ste182
.arcimaestro.

User info:
Registered: Oct 2004
Posts: 258 (0.03 al dì)
Location:
Corso: informatica
Anno:
Time Online: 2 Days, 5:06:07: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ah si ho capito.. si ho già provato a dichiararli fuori ma non cambia niente....

__________________
Live Fast, Die Fun

06-10-2005 20:52
Click Here to See the Profile for ste182 Click here to Send ste182 a Private Message Find more posts by ste182 Add ste182 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
fabpicca
jesus robot d'acciaio

User info:
Registered: May 2002
Posts: 2166 (0.25 al dì)
Location: Pieve Emanuele
Corso: Ticom
Anno:
Time Online: 12 Days, 23:12:28 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Hai provato a rendere autonoma la funzione estraendola dal gestore dell'evento? Per intenderci una cosa tipo

code:
myFunction(parameters){ ... some code here... } [...] myObject.onLoad= myFunction(parameters);

__________________
my website?|ubuntu linux|get Firefox|grazie Polonia |bagdad sour

"Come va che non ha le corna e le zampe di Caprone?" gli opposi. "Oh, Giuvà", mi disse il prete "adesso non si usa più.Satana è furbo". (I.Silone, Fontamara)
"Al giorno d'oggi non bisogna essere intelligenti, perchè la gente si offende" (un ubriacone)
"close your eyes / pay the price / for your paradise" (DM) "whatever you want to change/you'd better start changing it in your mind" (Transatlantic)

06-10-2005 20:56
Click Here to See the Profile for fabpicca Click Here to See the Blog of fabpicca Click here to Send fabpicca a Private Message Visit fabpicca's homepage! Find more posts by fabpicca Add fabpicca to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
ste182
.arcimaestro.

User info:
Registered: Oct 2004
Posts: 258 (0.03 al dì)
Location:
Corso: informatica
Anno:
Time Online: 2 Days, 5:06:07: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

se faccio così è peggio... nel trace non appare più niente..

__________________
Live Fast, Die Fun

06-10-2005 21:02
Click Here to See the Profile for ste182 Click here to Send ste182 a Private Message Find more posts by ste182 Add ste182 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
fabpicca
jesus robot d'acciaio

User info:
Registered: May 2002
Posts: 2166 (0.25 al dì)
Location: Pieve Emanuele
Corso: Ticom
Anno:
Time Online: 12 Days, 23:12:28 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Guarda sto andando un po' alla cieca, dovrei fare delle. prove.
Comunque fossi in te proverei ad evitare l'uso delle globali e rimarrei sul passaggio di variabili per riferimento.

__________________
my website?|ubuntu linux|get Firefox|grazie Polonia |bagdad sour

"Come va che non ha le corna e le zampe di Caprone?" gli opposi. "Oh, Giuvà", mi disse il prete "adesso non si usa più.Satana è furbo". (I.Silone, Fontamara)
"Al giorno d'oggi non bisogna essere intelligenti, perchè la gente si offende" (un ubriacone)
"close your eyes / pay the price / for your paradise" (DM) "whatever you want to change/you'd better start changing it in your mind" (Transatlantic)

06-10-2005 21:08
Click Here to See the Profile for fabpicca Click Here to See the Blog of fabpicca Click here to Send fabpicca a Private Message Visit fabpicca's homepage! Find more posts by fabpicca Add fabpicca to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
ste182
.arcimaestro.

User info:
Registered: Oct 2004
Posts: 258 (0.03 al dì)
Location:
Corso: informatica
Anno:
Time Online: 2 Days, 5:06:07: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

adesso ti spiego: io ho un interfaccia grafica in flash con i pulsanti play, stop pause ecc... tutto questo sta in un livello.
Poi c'è il livello con il codice che ho postato, in pratica devo leggere un file xml, estrapolarne i dati in modo da salvare in un array il nome e il percorso del file mp3..
quindi per riferimento come faccio? in quel for mi serve mettere nell'array i dati in modo da poterli usare dopo... tipo se premo il tasto next devo riprodurre il file che corrisponde a array[indice++];.. se premo prev--> array[indice--] e così via...
il punto è che quell'array me lo riempe solo nel for, al di fuori me lo svuota...:(

__________________
Live Fast, Die Fun

06-10-2005 21:15
Click Here to See the Profile for ste182 Click here to Send ste182 a Private Message Find more posts by ste182 Add ste182 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
fabpicca
jesus robot d'acciaio

User info:
Registered: May 2002
Posts: 2166 (0.25 al dì)
Location: Pieve Emanuele
Corso: Ticom
Anno:
Time Online: 12 Days, 23:12:28 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by ste182
adesso ti spiego: io ho un interfaccia grafica in flash con i pulsanti play, stop pause ecc... tutto questo sta in un livello.
Poi c'è il livello con il codice che ho postato, in pratica devo leggere un file xml, estrapolarne i dati in modo da salvare in un array il nome e il percorso del file mp3..
quindi per riferimento come faccio? in quel for mi serve mettere nell'array i dati in modo da poterli usare dopo... tipo se premo il tasto next devo riprodurre il file che corrisponde a array[indice++];.. se premo prev--> array[indice--] e così via...
il punto è che quell'array me lo riempe solo nel for, al di fuori me lo svuota...:(


potresti sempre tenere il codice sullo stesso livello dei pulsanti...

__________________
my website?|ubuntu linux|get Firefox|grazie Polonia |bagdad sour

"Come va che non ha le corna e le zampe di Caprone?" gli opposi. "Oh, Giuvà", mi disse il prete "adesso non si usa più.Satana è furbo". (I.Silone, Fontamara)
"Al giorno d'oggi non bisogna essere intelligenti, perchè la gente si offende" (un ubriacone)
"close your eyes / pay the price / for your paradise" (DM) "whatever you want to change/you'd better start changing it in your mind" (Transatlantic)

06-10-2005 21:19
Click Here to See the Profile for fabpicca Click Here to See the Blog of fabpicca Click here to Send fabpicca a Private Message Visit fabpicca's homepage! Find more posts by fabpicca Add fabpicca to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
ste182
.arcimaestro.

User info:
Registered: Oct 2004
Posts: 258 (0.03 al dì)
Location:
Corso: informatica
Anno:
Time Online: 2 Days, 5:06:07: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

già provato.. niente...

__________________
Live Fast, Die Fun

06-10-2005 21:24
Click Here to See the Profile for ste182 Click here to Send ste182 a Private Message Find more posts by ste182 Add ste182 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 06:08.    Post New Thread    Post A Reply
  Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.172 seconds (50.86% PHP - 49.14% MySQL) con 25 query.