JoãoCatalão 0 Denunciar post Postado Dezembro 17, 2008 Não tenho muita experiencia com funções em Action Script ... dai então ... Problemas. Tenho atualmente esse codigo que preciso atualiza-lo. while (i < nomeBanner.length - 1){ nome = nomeBanner[i]; xpos = xposBanner[i]; ypos = yposBanner[i]; _root.createEmptyMovieClip("topo_"+i, i); _root['topo_'+i].loadMovie(""+nome, "topo_"+i); _root['topo_'+i]._x = xpos; _root['topo_'+i]._y = ypos; i = i + 1; } Até aqui está funcionando tudo bem. Mas agora terei várias condições e para não repetir o codigo pensei em usar funções. Como nunca trabalhei com isso antes, pesso a ajuda de vocês. while (i < nomeBanner.length - 1){ var tipo = tipoBanner[i]; if (tipo == "Topo") valor = imprime(i); if (tipo == "Lateral") valor = imprime(i); i = i + 1; } function imprime(x) { i = x; nome = nomeBanner[i]; xpos = xposBanner[i]; ypos = yposBanner[i]; _root.createEmptyMovieClip("topo_"+i, i); _root['topo_'+i].loadMovie(""+nome, "topo_"+i); _root['topo_'+i]._x = xpos; _root['topo_'+i]._y = ypos; } Aguardo uma resposta. Obrigado Compartilhar este post Link para o post Compartilhar em outros sites
ASkmi 0 Denunciar post Postado Dezembro 18, 2008 Estava vendo como podia ajudar você, e como você nao pode posicionar os mc's antes de elas estarem deviadamente carrgados...acabei por escrever algo um pouco + extenso, mas espero você entenda e q ajude.... var count_clip:Number = 0; // function loadclip(n) { // selecionar if (tipoBanner[n] == "Topo") { imprime(i, "topo_"); } if (tipoBanner[n] == "Lateral") { imprime(i, "lateral_"); } } // iniciar loadclip(count_clip); // function imprime(x, t) { // criar e carregar _root.createEmptyMovieClip(t+""+x, x); _root[t+""+x].loadMovie(nomeBanner[x]); // detectar carregado _root[t+""+x].onEnterFrame = function() { if (this.getBytesLoaded() == this.getBytesTotal()) { // posicionar this._x = xposBanner[x]; this._y = yposBanner[x]; this.onEnterFrame = null; // carregar o proximo count_clip++; if (count_clip<nomeBanner.length) { loadclip(count_clip); } else { // fim } } }; } http://forum.imasters.com.br/public/style_emoticons/default/natal_wink.gif Compartilhar este post Link para o post Compartilhar em outros sites