New Job 0 Denunciar post Postado Agosto 25, 2010 Boa tarde. Tenho um Swf que cria um slideshow apartir de um XML externo. Até ai tudo perfeito 100% ok. Porém tentei fazer dois slideshows ao mesmo tempo no swf. Acontece que deve estar atrapalhando o funcionamento do outro. Segue os scripts: Para criar o primeiro slideshow: //foto 1 import mx.transitions.Tween; import mx.transitions.easing.*; var myShowXML = new XML(); myShowXML.ignoreWhite = true; myShowXML.load("slideshow.xml"); myShowXML.onLoad = function() { _root.myWidth = myShowXML.firstChild.attributes.width; _root.myHeight = myShowXML.firstChild.attributes.height; _root.mySpeed = myShowXML.firstChild.attributes.speed; _root.myImages = myShowXML.firstChild.childNodes; _root.myImagesNo = myImages.length; createContainer(); callImages(); }; function createContainer() { _root.createEmptyMovieClip("myContainer_mc",1); myContainer_mc._x = 0; myContainer_mc._y = 166; } function callImages() { _root.myMCL = new MovieClipLoader(); _root.myPreloader = new Object(); _root.myMCL.addListener(_root.myPreloader); _root.myClips_array = []; _root.myPreloader.onLoadStart = function(target) { }; _root.myPreloader.onLoadProgress = function(target) { _root.myText_txt.text = "Carregando.. "+_root.myClips_array.length+"/"+_root.myImagesNo+" Concluído"; }; _root.myPreloader.onLoadComplete = function(target) { _root.myClips_array.push(target); target._alpha = 0; if (_root.myClips_array.length == _root.myImagesNo) { _root.myText_txt._y = myContainer_mc._y + myContainer_mc._height; _root.target_mc = -1; moveSlide(); myShowInt = setInterval(moveSlide, (_root.mySpeed*1000)+1000); } }; for (i=0; i<_root.myImagesNo; i++) { temp_url = _root.myImages[i].attributes.url; temp_mc = myContainer_mc.createEmptyMovieClip(i, myContainer_mc.getNextHighestDepth()); _root.myMCL.loadClip(temp_url,temp_mc); } } function moveSlide() { current_mc = _root.myClips_array[_root.target_mc]; new Tween(current_mc, "_alpha", Strong.easeOut, 100, 0, 1, true); _root.target_mc++; if (_root.target_mc>=_root.myImagesNo) { _root.target_mc = 0; } _root.myText_txt.text = _root.myImages[target_mc].attributes.title; next_mc = _root.myClips_array[_root.target_mc]; new Tween(next_mc, "_alpha", Strong.easeOut, 0, 100, 1, true); } Para criar o segundo. Apenas copiei o código e troquei algumas informações. //foto 2 import mx.transitions.Tween; import mx.transitions.easing.*; var myShowXML2 = new XML(); myShowXML2.ignoreWhite = true; myShowXML2.load("slideshow2.xml"); myShowXML2.onLoad = function() { _root.myWidth2 = myShowXML2.firstChild.attributes.width; _root.myHeight2 = myShowXML2.firstChild.attributes.height; _root.mySpeed2 = myShowXML2.firstChild.attributes.speed; _root.myImages2 = myShowXML2.firstChild.childNodes; _root.myImages2No = myImages2.length; createContainer2(); callImages2(); }; function createContainer2() { _root.createEmptyMovieClip("myContainer_mc2",44); myContainer_mc2._x = 425; myContainer_mc2._y = 166; } function callImages2() { _root.myMCL = new MovieClipLoader(); _root.myPreloader = new Object(); _root.myMCL.addListener(_root.myPreloader); _root.myClips2_array = []; _root.myPreloader.onLoadStart = function(target) { }; _root.myPreloader.onLoadProgress = function(target) { _root.myText_txt.text = "Carregando.. "+_root.myClips2_array.length+"/"+_root.myImages2No+" Concluído"; }; _root.myPreloader.onLoadComplete = function(target) { _root.myClips2_array.push(target); target._alpha = 0; if (_root.myClips2_array.length == _root.myImages2No) { _root.myText_txt._y = myContainer_mc2._y + myContainer_mc2._height; _root.target_mc = -1; moveSlide2(); myShowInt = setInterval(moveSlide2, (_root.mySpeed*1000)+1000); } }; for (i=0; i<_root.myImages2No; i++) { temp_url = _root.myImages2[i].attributes.url; temp_mc = myContainer_mc2.createEmptyMovieClip(i, myContainer_mc2.getNextHighestDepth()); _root.myMCL.loadClip(temp_url,temp_mc); } } function moveSlide2() { current_mc = _root.myClips2_array[_root.target_mc]; new Tween(current_mc, "_alpha", Strong.easeOut, 100, 0, 44, true); _root.target_mc++; if (_root.target_mc>=_root.myImages2No) { _root.target_mc = 43; } _root.myText_txt.text = _root.myImages2[target_mc].attributes.title; next_mc = _root.myClips2_array[_root.target_mc]; new Tween(next_mc, "_alpha", Strong.easeOut, 0, 100, 44, true); } Alguém com mais experiência com Action Script poderia me dar uma luz neste caso??? Acredito que tenha algum conflito entre os dois scrpts, mas não descobri aonde que está. Compartilhar este post Link para o post Compartilhar em outros sites
rockyng 4 Denunciar post Postado Agosto 25, 2010 Pega o segundo e testa sem o primeiro. Dentro do callImages ta tudo igual.. dê uma olhada. Compartilhar este post Link para o post Compartilhar em outros sites
New Job 0 Denunciar post Postado Agosto 25, 2010 Pega o segundo e testa sem o primeiro. Dentro do callImages ta tudo igual.. dê uma olhada. Opa, consegui resolver. Só ali no começo do código, troquei de 44 para camada 2. _root.createEmptyMovieClip("myContainer_mc2",2); Valeu!!! Compartilhar este post Link para o post Compartilhar em outros sites