Freelife 2 Denunciar post Postado Dezembro 15, 2008 Bom dia... estou usando um for para criar colunas e linhas: var linha:Number = 0; var coluna:Number = 0; var total:Number = 8; var j; for( j=0; j<=total; j++){ coluna++; trace(coluna +" Coluna"); if(coluna <= 4){ this.attachMovie("libraryLinkageClassName", fundo, j, {_x:(coluna * 100), _y:(linha * 70)}); } else{ linha++; coluna=0; } } Mas quando tento implementar em uma galeria de fotos não dá certo, o código da galeria é este; import mx.transitions.*; import mx.transitions.easing.*; //Aqui setamos a linguagem que o flash aceitará nos textos, o mesmo que sistema onde o flash player está rodando. System.useCodepage = true; //criamos a variável image_xml image_xml = new XML(); //falamos para ela ignorar os espaços em branco. image_xml.ignoreWhite = true; //usamos onLoad para que quando o xml for carregado ele dê o resultado, se sim ou se não. image_xml.onLoad = function (success:Boolean){ //se o xml for carregado com sucesso trace... if(success){ trace("Xml carregado com sucesso"); //chamamos a função conta. conta(); } //senão trace... else{ trace("Falha ao carregar Arquivo Xml"); break; } } //carregamos o xml. image_xml.load("image.xml"); // Aqui criamos as variáveis para determinar o centro do palco. var stageWidth = Stage.width /2; var stageHeight= Stage.height /2; //Aqui criamos um array var qImages:Array = new Array(); //inicia a função conta(); conta = function(){ //Criamos a variácel len que recebe o nó de nosso interesse no xml. var len = image_xml.firstChild.childNodes; //criamos o loop para percorrer armazenar o conteúdo da var len. for(var i=0; i < len.length; i++){ //armazenamos o conteúdo o valor de cada nó de len em qImages.a qImages.push({a: len[i].firstChild.nodeValue}); //Isso aqui eu peguei do Help do próprio Flash, mas se o que faz. // Cria um clipe de filme filho em "my_mc". // Esse é o clipe de filme que será substituído pela imagem. teste_mc.createEmptyMovieClip("container_mc",99); // Use MovieClipLoader para carregar a imagem. var my_mcl:MovieClipLoader = new MovieClipLoader(); my_mcl.loadClip(qImages[i].a, teste_mc.container_mc); var teste_mc:MovieClip = this.createEmptyMovieClip("my"+ i +"_mc", i); //setamos a escala/tamanho da imagem em 25% nos eixos x e y. teste_mc._xscale = 25; teste_mc._yscale = 25; var linha:Number = 0; var coluna:Number = 0; var total:Number = 8; var j; for( j=0; j<=total; j++){ coluna++; trace(coluna +" Coluna"); if(coluna <= 4){ teste_mc.attachMovie("libraryLinkageClassName", fundo, 1, {_x:(coluna * 100), _y:(linha * 70)}); } else{ linha++; coluna=0; } } //nessa parte quando pressionar o botão ele vai verificar se a escala/tamanho da imagem é igual // a 25 nos eixos X eY. Se for igual então ele seta o tamanho em 100%. teste_mc.onPress = function() { trace(this.getDepth()); if(this._xscale == 25 && this._yscale == 25){ this.swapDepths(len.length); this._xscale = 100; this._yscale = 100; //pega a posição inicial da imagem this.iniPosX = this._x; this.iniPosY = this._y; //posiciona a imagem no meio do palco usando as variáveis stageWidth e stageHeight - a metada do tamanho da imagem //no caso do eixo Y somente adicionai + 30 por comodidade. this._x = stageWidth - (this._width / 2); this._y = stageHeight - (this._height / 2); trace(this._y); new Tween(this, "_xscale", None.easeNone, 0, 100, 1, true); new Tween(this, "_x", mx.transitions.easing.None.easeNone, stageWidth , this._x, 1, true); } //se a escala for == 100% então... else{ //torna a escala/tamanho 25% /*this._xscale = 25; this._yscale = 25;*/ //volta a imagem à posição inicial. /*this._x = this.iniPosX; this._y = this.iniPosY;*/ this.swapDepths(0); trace(this.getDepth()); new Tween(this, "_xscale", None.easeNone, 100, 25, 1, true); new Tween(this, "_yscale", None.easeNone, 100, 25, 1, true); TransitionManager.start(this, {type:Rotate, direction:Transition.IN, duration:1, easing:Regular.easeIn, ccw:false, degrees:360}); new Tween(this, "_x", mx.transitions.easing.None.easeNone, stageWidth - (this._width / 2) , this.iniPosX, 1, true); new Tween(this, "_y", mx.transitions.easing.None.easeNone, stageHeight - (this._height / 2) , this.iniPosY, 1, true); } }; } } Preciso de ajuda galera... abraços Compartilhar este post Link para o post Compartilhar em outros sites
Freelife 2 Denunciar post Postado Dezembro 16, 2008 Dia... Será que ninguém conseguirá me ajudar? http://forum.imasters.com.br/public/style_emoticons/default/natal_sad.gif Compartilhar este post Link para o post Compartilhar em outros sites