Jump to content
Fórum Script Brasil
  • 0

Problema No Onrelease


Guest --Bruno --

Question

Guest --Bruno --

OPpa galera, eu fiz a seguiten classe :

import mx.transitions.Tween;
import mx.transitions.easing.*;

class Script {
    var documento:XML;
    var moldura:MovieClip;
    var mcL:MovieClipLoader;
    var objL:Object;
    var level:Number = 0;
    var desc:String = Array();
    var mcs:MovieClip = Array();
    
    public function loading(a:Boolean){
        _root.loadImg._visible = a;
    }
    
    public function Script(arquivo:String) {
        _root.fotos.onRollOut = function(){
            new Tween(_root.fade, "_alpha", Strong.easeOut, _root.fade._alpha, 100, 15, false);
            //trace("OK");
        }
        
        objL = new Object();
        mcL = new MovieClipLoader();

        moldura = _root.fotos.masq.fotobar;
        moldura._visible = false;
        documento = new XML();
        documento.load(arquivo);
        documento.ignoreWhite = true;
        documento.prototype = this;
        trace(arquivo);
        loading(true);
        documento.onLoad = function(s:Boolean) {
            if (s) {
                _root.img.loading(false);
                var i:Number;
                trace("otro - " + this.childNodes[0].childNodes.length);
                for (i=0; i<this.childNodes[0].childNodes.length; i++) {
                    
                    var node:XMLNode = this.childNodes[0].childNodes[i];
                    var url:String = node.attributes.url;
                    var descricao:String = node.attributes.categoria;
                    _root.img.newImage(url,descricao);
                    
                }
            }else{
                trace("Erro ao carregar XML");
            }
        };

        objL.onLoadProgress = function(alvo:MovieClip, bCarregados:Number, bTotal:Number) {
            var p:Number = (bCarregados/bTotal)*100;
            alvo._parent.loader._xscale = p;
        };
        
        objL.onLoadComplete = function(alvo:MovieClip, httpStatus:Number):Void {
            alvo._parent.loader._visible = false;
            alvo._visible = true;
            alvo._xscale = 130;
            alvo._yscale = 130;
            
            alvo._alpha= 0;
            
            new Tween(alvo, "_xscale", Strong.easeOut, alvo._xscale, 100, 15, false);
            new Tween(alvo, "_yscale", Strong.easeOut, alvo._yscale, 100, 15, false);
            new Tween(alvo, "_alpha", Strong.easeOut, alvo._alpha, 100, 15, false);            
            
            alvo.onRelease = function(){
                trace(this);
            }
        }
    }
    function newImage(img:String, desc:String):Void {
        level++;
        
        var mc:MovieClip = moldura.duplicateMovieClip("mc_imagem"+level, level);
        mc._x = ((level-1)*50) + 5;
        mc._y = 0;
        //mcImg.foto._visible = false;
        desc[level] = desc;
        mc.objeto = this;
        mc.descricao = desc;
        mcs.push(mc);
        mc.onMouseDown = function(){
            trace(this);
            //this.objeto.Categoria(this.descricao);
            //new Tween(_root.fade, "_alpha", Strong.easeOut,_root.fade._alpha, 0, 15, false);
        }
        
        mcL.loadClip("http://infoextreme/bruno/irenemoreira/"+img+"&width=45",mc.foto);
        mcL.addListener(objL);
    }
    
    public function rollTo(t:Number){
        var pos:Number = ((moldura._parent._width - (52.5)) * (t)) / 100;
        pos = ((moldura._parent._width)/2)-pos-22;
        
        new Tween(moldura._parent, "_x", Strong.easeOut, moldura._parent._x, pos, 1, true);
    }
    
    public function Categoria(texto:String):Void{
        _root.Categoria.texto.text = texto;
    }
    
    public function Dispose(){
        var i:Number;
        for(i = 0; i < mcs.length; i ++){
            mcs[i].removeMovieClip();
        }
    }
}
Ela carrega varias imagens uma ao lado da outra, só que eu tenho um problema na função :
function newImage(img:String, desc:String):Void {
        level++;
        
        var mc:MovieClip = moldura.duplicateMovieClip("mc_imagem"+level, level);
        mc._x = ((level-1)*50) + 5;
        mc._y = 0;
        //mcImg.foto._visible = false;
        desc[level] = desc;
        mc.objeto = this;
        mc.descricao = desc;
        mcs.push(mc);
        mc.onMouseDown = function(){
            trace(this);
            //this.objeto.Categoria(this.descricao);
            //new Tween(_root.fade, "_alpha", Strong.easeOut,_root.fade._alpha, 0, 15, false);
        }
        
        mcL.loadClip("http://infoextreme/bruno/irenemoreira/"+img+"&width=45",mc.foto);
        mcL.addListener(objL);
    }

sabe aquele mouseDown ? eu queria trocar ele por um onRelease, só que se eu faço isso ele num funciona, e quando eu testo com mouseDown eu clico, invés de ele imprimir apenas o mc que foi clicado, ele imprimi todos os mc's,

alguém sabe resolver isto ?

brigadão t+++

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152k
    • Total Posts
      651.5k
×
×
  • Create New...