Originariamente inviato da dafank
on (release) {
if (current_movie != "") {
_level5.gotoAndPlay(46);
this.onEnterFrame = function() {
if (_level5._currentframe == _level5.totalframes) {
current_movie = "caverna fronte L3.swf";
loadMovieNum(current_movie, 5);
}
}
}}
...
**Error** Scene=Scene 2, layer=pulsante 2 L3, frame=1:Line 2: on handlers may not nest within other on handlers
on (release) {
**Error** Scene=Scene 2, layer=pulsante 2 L3, frame=1:Line 1: Statement block must be terminated by '}'
on (release) {
**Error** Scene=Scene 2, layer=pulsante 2 L3, frame=1:Line 11: Syntax error.
}}
Total ActionScript Errors: 3 Reported Errors:
Dove ho sbagliato???
L'errore significa che le due azioni che ho evidenziato in rosso vanno in conflitto.
Il codice che ti ho passato NON puoi inserirlo dentro l'evento on. Ecco come devi fare:
SOLUZIONE (1)
1) attribuisci un nome istanza ad ognuno dei tuoi pulsanti: p.es. pulsante1, pulsante2 ecc.
2) scrivi il codice NON associato al pulsante stesso, MA inserendolo direttamente sul frame della timeline, così:
codice:
pulsante1.onRelease = function() {
if (current_movie != "") {
_level10.gotoAndPlay(100);
this.onEnterFrame = function() {
if (_level10._currentframe == _level10.totalframes) {
current_movie = "A.swf";
loadMovieNum(current_movie, 10);
}
}
}
}
oppure...
SOLUZIONE (2)
> Nessun nome istanza
> ai pulsanti associ solo questo codice:
codice:
on (release) {
carica_filmato("caverna fronte L3.swf");
}
> sulla timeline, invece, scrivi questa funzione:
codice:
function carica_filmato(themovie) {
if (current_movie != "") {
_level10.gotoAndPlay(100);
this.onEnterFrame = function() {
if (_level10._currentframe == _level10.totalframes) {
current_movie = themovie;
loadMovieNum(current_movie, 10);
}
}
}
}