no, devi mettere sul timeline principale, oppure se voi addattare per un componente, le funzioni, e il funzionamento devi implementare tu, guardando le tue esigenze.
codice:
function Ombrello(chiLoNolegga, meSe, prenotaInizio, prenotaFine) {
this.chiLoNolegga = chiLoNolegga;
this.meSe = meSe;
this.prenotaInizio = prenotaInizio;
this.prenotaFine = prenotaFine;
}
Ombrello.prototype.visNome = function() {
return this.chiLoNolegga;
};
Ombrello.prototype.visPeriodo = function() {
var myString = this.meSe + ' : ' + this.prenotaInizio + ' : ' + this.prenotaFine;
return myString;
};
Ombrello.prototype.cercaPreido = function(dal, al) {
if (dal < this.prenotaInizio && al < this.prenotaFine) {
trace("è libero in questi giorni");
return true;
}
};
Ombrello.prototype.meseLibero = function(mese) {
if (mese != this.meSe) {
return true;
}
};
ombr_1 = new Ombrello('Bèla Puppino', 'aogosto', 15, 26);
ombr_2 = new Ombrello('Pabe Dobbo', 'gennaio', 10, 14);
ombr_3 = new Ombrello('Kiko Derdaso', 'giulio', 25, 30);
ombrelliArray = ['ombr_1', 'ombr_2', 'ombr_3'];
function cercaMese(mese) {
var ar = [];
for (var u = 0; u < ombrelliArray.length; u++) {
this[ombrelliArray[u]].meseLibero(mese) ? ar.push(ombrelliArray[u]) : trace("non c'è " + ombrelliArray[u]);
}
trace(ar);
}
ombr_1.cercaPreido(2, 14);
ombr_2.cercaPreido(2, 14);
ombr_3.cercaPreido(2, 14);
cercaMese('gennaio');
ciao