netoikeda 0 Denunciar post Postado Abril 22, 2010 Iaew Galeraa, td bem?? Bom, dp de muita pesquisa e mta dor de cabeça xeguei a reta final do meu projeto, q eh uma rádio. Como disse em outros tópicos, a intenção era, cada usuario do site ter um login de senha, e dp de logado no site, ter sua propria Playlist, durante a reprodução de sua playlist haverá momentos em q a rádio dirá as horas. No XML, eu coloquei em determinados nós referencias q o flash irá usar para saber o momento exato de chamar os arquivos de audio que dirá as horas, pra literalmente "falar" as horas. Como fiz isso?, eu coloquei em um MC, o código de hora (getHours e talz), e na timeline eu busquei esse valor concatenando, tipo: hora+"h.mp3", pq tenho tds as horas e minutos desse jeito. Até ai beleza, o flash xama td certinho, o problema eh quando tem q falar as horas de novo, parece q quando a variavel chama o valor da hora do MC q tem o código, esse valor fica gravado na váriavel, então msm q tenham se passado vários minutos, o flash vai xamar o msm minuto dakela primeira vez. O q eu gostaria de saber eh se tem alguma maneira de limpar a váriavel, e td vez q o flash tiver q falar as horas novamente, ele busque o valor da hora de novo. Estou nisso a muito tempo. Se alguem puder me ajudar... Obrigado! Aqui vão os códigos. XML(as referencias q eu citei são: HORA, MINUTO): <?xml version="1.0" encoding="UTF-8"?> <songs> <song filename="../Musicas/Axe_Music/sound_1271337724.mp3" track="Musica 1" artist="Artista 1" album="" /> <song filename="../Musicas/Axe_Music/sound_1271337724.mp3" track="Musica 1" artist="Artista 1" album="" /> <song filename="../Musicas/Axe_Music/sound_1271337724.mp3" track="Musica 1" artist="Artista 1" album="" /> <song filename="../Comerciais/comercias_1271351855.mp3" track="teste" artist="tete" album="" /> <song filename="../Comerciais/comercias_1271351855.mp3" track="teste" artist="tete" album="" /> <song filename="HORA" track="" artist="" album="" /> <song filename="MINUTO" track="" artist="" album="" /> <song filename="../Musicas/Axe_Music/sound_1271337724.mp3" track="Musica 1" artist="Artista 1" album="" /> <song filename="../Musicas/Axe_Music/sound_1271337724.mp3" track="Musica 1" artist="Artista 1" album="" /> <song filename="../Comerciais/comercias_1271351855.mp3" track="teste" artist="tete" album="" /> <song filename="../Comerciais/comercias_1271351855.mp3" track="teste" artist="tete" album="" /> <song filename="HORA" track="" artist="" album="" /> <song filename="MINUTO" track="" artist="" album="" /> <song filename="../Musicas/Axe_Music/sound_1271337724.mp3" track="Musica 1" artist="Artista 1" album="" /> <song filename="../Musicas/Axe_Music/sound_1271337724.mp3" track="Musica 1" artist="Artista 1" album="" /> <song filename="../Musicas/Axe_Music/sound_1271337724.mp3" track="Musica 1" artist="Artista 1" album="" /> <song filename="../Musicas/Axe_Music/sound_1271337724.mp3" track="Musica 1" artist="Artista 1" album="" /> <song filename="../Comerciais/comercias_1271351855.mp3" track="teste" artist="tete" album="" /> <song filename="../Comerciais/comercias_1271351855.mp3" track="teste" artist="tete" album="" /> <song filename="HORA" track="" artist="" album="" /> <song filename="MINUTO" track="" artist="" album="" /> </songs> MC com o código das horas: //hora e minuto _global.hora_minuto = function() { valores = new Date(); _global.hora = valores.getHours(); _global.minuto = valores.getMinutes(); _global.segundos = valores.getSeconds(); } hora_minuto(); setInterval(hora_minuto, 1000); Código da time line, q busca as horas e concatena: var horario = new Array([_global.hora,_global.minuto]); var song_folder:String = "xml/"; var song_list:Array = new Array(); var track_list:Array = new Array(); var artist_list:Array = new Array(); var album_list:Array = new Array(); var current:Number = 0; var position:Number; var new_volume:Number = 100; var flashmo_xml:XML = new XML(); flashmo_xml.ignoreWhite = true; flashmo_xml.onLoad = function() { var nodes:Array = this.firstChild.childNodes; for(var i = 0; i < nodes.length; i++) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/" + horario[0][0] + "h.mp3"; } if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/" + horario[0][1] + "m.mp3"; } song_list.push(nodes[i].attributes.filename); track_list.push(nodes[i].attributes.track); artist_list.push(nodes[i].attributes.artist); album_list.push(nodes[i].attributes.album); } play_song("start"); } Compartilhar este post Link para o post Compartilhar em outros sites
Gutodisse 0 Denunciar post Postado Abril 26, 2010 Os valores da array não estão sendo atualizados somente as varivaies globais!.. De uma revisada var horario = new Array([_global.hora,_global.minuto]); // Aqui ela está sendo declarada com o valor inicial, mas depois daqui ela não é atualizada mais!.. Atualize esses valores e tente, Depois poste o resultado aqui Compartilhar este post Link para o post Compartilhar em outros sites
carneirinho 7 Denunciar post Postado Abril 26, 2010 Os valores da array não estão sendo atualizados somente as varivaies globais!.. De uma revisada var horario = new Array([_global.hora,_global.minuto]); // Aqui ela está sendo declarada com o valor inicial, mas depois daqui ela não é atualizada mais!.. Atualize esses valores e tente, Depois poste o resultado aqui O Guto tem razão, tent deletar o array dentro da função e dar um novo push a ele: //hora e minuto _global.hora_minuto = function() { valores = new Date(); _global.hora = valores.getHours(); _global.minuto = valores.getMinutes(); _global.segundos = valores.getSeconds(); delete horario; horario = [_global.hora,_global.minuto]; } hora_minuto(); setInterval(hora_minuto, 1000); Compartilhar este post Link para o post Compartilhar em outros sites
netoikeda 0 Denunciar post Postado Abril 26, 2010 Olha, fiz de um modo mais manual e mais direto, agra coloquei um por um, quando a hora for = 1, ele vai chamar o arquivo 1h.mp3, fiz o msm esquema para os minutos, e por incrivel q pareça, deu certo, mais o problema, continua o msm. Msm tendo colocado td o codigo dentro da função de horario, q tem um setInterval de 1 seg, parece q os ifs nao se atualizam, ou seja, msm entrando no site as 11:28, ele puxará os arquivos corretamente, e dirá as horas são 11 horas, e 28 minutos, depois de se passar alguns minutos, e dizer as horas novamente, ele dira são 11 horas, e "28" minutos novamente. O q eu precisava, era q os ifs se atualizassem sem parar, para q quando buscar as horas, busque a atual, ao invés da primeira q foi carregada. Ai galera vlw pela atenção ;D. Se souberem como faço,, vao quebrar um tronco pra mim ;D Oh o código monstro aew: var flashmo_xml:XML = new XML(); flashmo_xml.ignoreWhite = true; flashmo_xml.onload = function() { var nodes:Array = this.firstChild.childNodes; for(var i = 0; i < nodes.length; i++) { clock = function () { valores = new Date(); hora = valores.getHours(); minuto = valores.getMinutes(); segundos = valores.getSeconds(); Hour.text = hora; Min.text = minuto; Seg.text = segundos; //////////////////////////HORAS///////////////////////////////////////////////// if (hora == 0) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/00h.mp3"; } } if (hora == 1) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/01h.mp3"; } } if (hora == 2) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/02h.mp3"; } } if (hora == 3) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/03h.mp3"; } } if (hora == 4) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/04h.mp3"; } } if (hora == 5) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/05h.mp3"; } } if (hora == 6) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/06h.mp3"; } } if (hora == 7) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/07h.mp3"; } } if (hora == 8) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/08h.mp3"; } } if (hora == 9) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/09h.mp3"; } } if (hora == 10) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/10h.mp3"; } } if (hora == 11) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/11h.mp3"; } } if (hora == 12) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/12h.mp3"; } } if (hora == 13) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/13h.mp3"; } } if (hora == 14) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/14h.mp3"; } } if (hora == 15) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/15h.mp3"; } } if (hora == 16) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/16h.mp3"; } } if (hora == 17) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/17h.mp3"; } } if (hora == 18) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/18h.mp3"; } } if (hora == 19) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/19h.mp3"; } } if (hora == 20) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/20h.mp3"; } } if (hora == 21) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/21h.mp3"; } } if (hora == 22) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/22h.mp3"; } } if (hora == 23) { if (nodes[i].attributes.filename == "HORA"){ nodes[i].attributes.filename = "../Hora_Certa/23h.mp3"; } } ////////////////////////////////MINUTOS////////////////////////////////////////////// if (minuto == 1) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/1m.mp3"; } } if (minuto == 2) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/2m.mp3"; } } if (minuto == 3) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/3m.mp3"; } } if (minuto == 4) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/4m.mp3"; } } if (minuto == 5) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/5m.mp3"; } } if (minuto == 6) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/6m.mp3"; } } if (minuto == 7) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/7m.mp3"; } } if (minuto == 8) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/8m.mp3"; } } if (minuto == 9) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/9m.mp3"; } } if (minuto == 10) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/10m.mp3"; } } if (minuto == 11) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/11m.mp3"; } } if (minuto == 12) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/12m.mp3"; } } if (minuto == 13) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/13m.mp3"; } } if (minuto == 14) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/14m.mp3"; } } if (minuto == 15) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/15m.mp3"; } } if (minuto == 16) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/16m.mp3"; } } if (minuto == 17) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/17m.mp3"; } } if (minuto == 18) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/18m.mp3"; } } if (minuto == 19) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/19m.mp3"; } } if (minuto == 20) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/20m.mp3"; } } if (minuto == 21) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/21m.mp3"; } } if (minuto == 22) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/22m.mp3"; } } if (minuto == 23) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/23m.mp3"; } } if (minuto == 24) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/24m.mp3"; } } if (minuto == 25) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/25m.mp3"; } } if (minuto == 26) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/26m.mp3"; } } if (minuto == 27) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/27m.mp3"; } } if (minuto == 28) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/28m.mp3"; } } if (minuto == 29) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/29m.mp3"; } } if (minuto == 30) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/30m.mp3"; } } if (minuto == 31) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/31m.mp3"; } } if (minuto == 32) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/32m.mp3"; } } if (minuto == 33) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/33m.mp3"; } } if (minuto == 34) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/34m.mp3"; } } if (minuto == 35) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/35m.mp3"; } } if (minuto == 36) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/36m.mp3"; } } if (minuto == 37) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/37m.mp3"; } } if (minuto == 38) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/38m.mp3"; } } if (minuto == 39) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/39m.mp3"; } } if (minuto == 40) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/40m.mp3"; } } if (minuto == 41) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/41m.mp3"; } } if (minuto == 42) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/42m.mp3"; } } if (minuto == 43) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/43m.mp3"; } } if (minuto == 44) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/44m.mp3"; } } if (minuto == 45) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/45m.mp3"; } } if (minuto == 46) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/46m.mp3"; } } if (minuto == 47) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/47m.mp3"; } } if (minuto == 48) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/48m.mp3"; } } if (minuto == 49) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/49m.mp3"; } } if (minuto == 50) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/50m.mp3"; } } if (minuto == 51) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/51m.mp3"; } } if (minuto == 52) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/52m.mp3"; } } if (minuto == 53) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/53m.mp3"; } } if (minuto == 54) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/54m.mp3"; } } if (minuto == 55) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/55m.mp3"; } } if (minuto == 56) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/56m.mp3"; } } if (minuto == 57) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/57m.mp3"; } } if (minuto == 58) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/58m.mp3"; } } if (minuto == 59) { if (nodes[i].attributes.filename == "MINUTO"){ nodes[i].attributes.filename = "../Hora_Certa/59m.mp3"; } } //fexa função } clock(); setInterval(clock, 1000); song_list.push(nodes[i].attributes.filename); track_list.push(nodes[i].attributes.track); artist_list.push(nodes[i].attributes.artist); album_list.push(nodes[i].attributes.album); } play_song("start"); } Compartilhar este post Link para o post Compartilhar em outros sites