Hudson DXN 0 Denunciar post Postado Março 7, 2008 e ai galera beleza... preciso de uma AJUDAAAA... estou tendo problemas com um for... EX.. criei um movieclip e instanciei ele com o nome de "loop_mc" e dentro dele tem 3 dynamic text 1 movieclip vazio(jaja explico), um botao e um movieclip branco... consegui fazer o loop normal tudo bunitinho a bronca é quando eu clico no botao ele nao me retorna o valor certo... tipo ele vem sempre com a quantidade do loop e nao o numero do loop q eu qeroo... meio difícil de explicar e entender hehehehe por isso vai ai o codigo... CODE System.useCodepage=true; var strEmp:String=""; var xmlEmpreendimentos:XML = new XML(); xmlEmpreendimentos.ignoreWhite = true; var y=20; loop_mc._visible = false; varWidthIntMovieClip = 365.5; varPosicaoInicial = 147.5; xmlEmpreendimentos.onLoad = function(){ for(var i:Number = 0; i < xmlEmpreendimentos.firstChild.childNodes.length; i++){ var cpEmpNode:XMLNode = xmlEmpreendimentos.firstChild.childNodes; // strEmp+="->"+cpEmpNode.childNodes[1].firstChild.nodeValue+"\n"; strEmp+=" Bairro "+cpEmpNode.childNodes[3].firstChild.nodeValue+"\n"; strEmp+=" Área "+cpEmpNode.childNodes[4].firstChild.nodeValue+"\n"; strEmp+=" A Partir De "+cpEmpNode.childNodes[5].firstChild.nodeValue+"\n\n"; if(cpEmpNode.childNodes[0].firstChild.nodeValue.length>0){ //imagem="_img/predios/"+cpEmpNode.childNodes[1].firstChild.nodeValue; imagem="http://rsweb/Delphi_engenharia/Final/_imgs/capa/arq46bc6e785cc76.jpg"; duplicateMovieClip(loop_mc, "loop_mc"+i, i); eval("loop_mc"+i)._x += (loop_mc._width)*(i+1); var carrega:MovieClipLoader = new MovieClipLoader(); var carregaListener:Object = new Object(); carrega.loadClip(imagem, eval("loop_mc"+i).img); carregaListener.onLoadInit = function() { eval("loop_mc"+i).img._width = 175; eval("loop_mc"+i).img._height = 240; } carrega.addListener(carregaListener); eval("loop_mc"+i).bgimg._width = 185; eval("loop_mc"+i).bgimg._height = 250; eval("loop_mc"+i).TextTitle.autoSize = true; eval("loop_mc"+i).TextSubTitle.autoSize = true; eval("loop_mc"+i).TextSobre.autoSize = true; eval("loop_mc"+i).TextTitle.text = cpEmpNode.childNodes[4].firstChild.nodeValue; eval("loop_mc"+i).TextSubTitle.text = cpEmpNode.childNodes[3].firstChild.nodeValue; eval("loop_mc"+i).TextSobre.text = cpEmpNode.childNodes[6].firstChild.nodeValue; //eval("loop_mc"+i).img.loadMovie(imagem); } strEmp=""; eval("loop_mc"+i).btn.onRelease = function(){ trace("loop_mc"+i); } } } xmlEmpreendimentos.load("_xml/tbprelancamento.xml"); _parent.avanca.onRelease = function(){ _parent.prelancamento_conteudo_mc._x = _parent.prelancamento_conteudo_mc._x - varWidthIntMovieClip; if(_parent.prelancamento_conteudo_mc._x <= -1 * _parent.prelancamento_conteudo_mc._width + varWidthIntMovieClip * 3 + varPosicaoInicial){ _parent.prelancamento_conteudo_mc._x = -1 * _parent.prelancamento_conteudo_mc._width + varWidthIntMovieClip * 3 + varPosicaoInicial; } } _parent.volta.onRelease = function(){ _parent.prelancamento_conteudo_mc._x = _parent.prelancamento_conteudo_mc._x + varWidthIntMovieClip; if(_parent.prelancamento_conteudo_mc._x >= 147.5){ _parent.prelancamento_conteudo_mc._x = 147.5; } } por favor ajudem... vlww Compartilhar este post Link para o post Compartilhar em outros sites
Eder Fortunato 15 Denunciar post Postado Março 7, 2008 é um probleminha besta do FOR, testa assim que vai: eval("loop_mc"+i).flag = i eval("loop_mc"+i).btn.onRelease = function(){ trace("loop_mc"+this.flag); } mas se você quer a referencia do próprio botão seria assim: eval("loop_mc"+i).btn.onRelease = function(){ trace(this); } []´s Compartilhar este post Link para o post Compartilhar em outros sites