Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    Effetto elastico su menu

    Ciao ragazzi. Qualcuno saprebbe dirmi dove agire (e come possibilmente) per eliminare un effetto elastico (che si presenta una volta che apro/chiudo le voci di un menu agganciato ad un xml creato tramite questo Ascript)?

    //--

    MovieClip.prototype.moveMenu=function()
    {
    var py=this._y;
    var pos_y;
    var lastpath=eval(this.lastPath);
    if(lastpath!=undefined && this.lastPath.substr((this.lastPath.length-6),6)!="titolo")
    {
    this.onEnterFrame=function()
    {
    if((lastpath._y+lastpath.h_id)!=this._y)
    {
    pos_y =lastpath._y+lastpath.h_id;
    this._y += (pos_y-this._y)/Obj.velocita;
    if(Math.abs(pos_y-this._y)<1)this._y=pos_y;
    }
    }
    }
    }
    MovieClip.prototype.apriMask=function()
    {
    this.mask.onEnterFrame=function()
    {
    this._height+=(this._parent.h_id-this._height)/Obj.velocita;
    if(Math.abs(this._parent.h_id-this._height)<1)
    {
    this._height=this._parent.h_id;
    this.onEnterFrame=undefined;
    }
    }
    }
    MovieClip.prototype.turnArrow=function()
    {
    var rotazione;
    this._parent.clik ? rotazione=0 : rotazione=0;
    this.onEnterFrame=function()
    {
    this._rotation+=(rotazione-this._rotation)/2;
    if(Math.abs(this._rotation-rotazione)<1)
    {
    this._rotation=rotation;
    this.onEnterFrame=undefined;
    }
    }
    }
    MovieClip.prototype.apriMenu=function()
    {
    var path, clip, subClip, thisPath, diff=undefined, disteso=Obj.disteso;
    thisPath=this._parent;
    clip=new Array();
    path=thisPath._parent;
    //---------------------- opzione contratto ------
    function trovaDiff(diff_p)
    {
    for(var d_c in diff_p._parent)
    {
    if(typeof(diff_p._parent[d_c])=="movieclip"
    && d_c!="titolo"
    && d_c!="mask"
    && diff_p._parent[d_c]!=diff_p
    && diff_p._parent!=undefined)
    {
    if(diff_p._parent[d_c].h_id>Obj.altezza+Obj.inerlinea) diff=diff_p._parent[d_c].h_id;
    diff_p._parent[d_c].h_id=Obj.altezza+Obj.inerlinea;
    diff_p._parent[d_c].apriMask();
    diff_p._parent[d_c].moveMenu();

    diff_p._parent[d_c].titolo.clik=false;
    diff_p._parent[d_c].titolo.frec.turnArrow();
    }
    }
    }
    if(disteso==true)trovaDiff(thisPath);

    function cont_c_subClip(c_s_p)
    {
    for(var c_c in c_s_p._parent)
    {
    if(typeof(c_s_p._parent[c_c])=="movieclip"
    && c_c!="titolo"
    && c_c!="mask"
    && c_s_p._parent[c_c]!=c_s_p
    && c_s_p._parent!=undefined)
    {
    c_s_p._parent[c_c].h_id=Obj.altezza+Obj.inerlinea;
    c_s_p._parent[c_c].apriMask();
    c_s_p._parent[c_c].moveMenu();
    c_s_p._parent[c_c].titolo.clik=false;
    c_s_p._parent[c_c].titolo.frec.turnArrow();
    cont_c_subClip(c_s_p._parent[c_c].titolo);
    }
    }
    }
    if(disteso==false)cont_c_subClip(thisPath);
    //-----------------------------------------------
    for( var a in path)
    {
    if(typeof(path[a])=="movieclip" && a!="mask")
    {
    subClip=new Array();
    for( var b in path[a])
    {
    if(typeof(path[a][b])=="movieclip" && b!="mask")
    {
    subClip.push(path[a][b]);
    }
    }
    subClip.reverse();
    clip.push([path[a], subClip]);
    }
    }
    clip.reverse();


    for(var mm=0; mm<clip.length; mm++)
    {
    if(clip[mm][0]==thisPath)
    {
    this._parent.h_id*=clip[mm][1].length;
    if(diff!=undefined)
    {
    var vd = this._parent.h_id-diff;
    diff = vd;
    }

    }
    var lp = new String(clip[mm-1][0]);
    clip[mm][0].lastPath=lp;
    clip[mm][0].moveMenu();
    clip[mm][0].apriMask();
    }

    //---------------------------- sistema _h precedenti

    function rip_subClip(t,d)
    {
    pathStr=new String(t);
    if((pathStr.substr(pathStr.lastIndexOf(".")+1)).in dexOf("box")!=-1)
    {
    t.h_id+=d-(Obj.altezza+Obj.inerlinea);
    t.apriMask();
    for(var subx in t._parent)
    {
    if(typeof(t._parent[subx])=="movieclip" && t._parent[subx]!=t)
    {
    t._parent[subx].moveMenu();
    }
    }
    var s_t=t._parent;
    var s_d=d;
    rip_subClip(s_t, s_d);
    }
    }
    var subDist=this._parent.h_id;
    rip_subClip(path,(diff==undefined ? subDist : vd+(Obj.altezza+Obj.inerlinea)));
    }
    MovieClip.prototype.chiudiMenu=function()
    {

    var thisPath;
    thisPath=this._parent;
    //----------------------chiude le precedenti
    function rip_subLastClip(ts,l_Dist)
    {
    var lastDist=ts.h_id;
    var newlastDist= l_Dist==undefined ? (lastDist-(Obj.altezza+Obj.inerlinea)) : l_Dist;
    pathStr=new String(ts._parent);
    if((pathStr.substr(pathStr.lastIndexOf(".")+1)).in dexOf("box")!=-1)
    {
    ts._parent.h_id-=newlastDist;
    ts._parent.apriMask();
    for(var thisLstPath in ts._parent._parent)
    {
    if(typeof(ts._parent._parent[thisLstPath])=="movieclip"
    && thisLstPath!="titolo"
    && thisLstPath!="mask")
    {
    ts._parent._parent[thisLstPath].moveMenu();
    }
    }
    rip_subLastClip(ts._parent,newlastDist);
    }
    }
    rip_subLastClip(thisPath);



    //----------------------chiude lo stesso gruppo
    thisPath.h_id=Obj.altezza+Obj.inerlinea;
    thisPath.apriMask();

    for(var thisSubPath in thisPath._parent)
    {
    if(typeof(thisPath._parent[thisSubPath])=="movieclip"
    && thisPath._parent[thisSubPath]!=thisPath
    && thisSubPath!="titolo"
    && thisSubPath!="mask")
    {
    thisPath._parent[thisSubPath].moveMenu();
    }
    }
    //----------------------chiude le clip successive
    function c_subClip(s_p)
    {
    for(var c in s_p)
    {
    if(typeof(s_p[c])=="movieclip"
    && c!="titolo"
    && c!="mask")
    {
    s_p[c].h_id=Obj.altezza+Obj.inerlinea
    s_p[c].titolo.clik=false
    s_p[c].titolo.frec.turnArrow()
    s_p[c].moveMenu()
    s_p[c].apriMask()
    c_subClip(s_p[c])
    }
    }
    }
    c_subClip(thisPath);
    }


    filexml=new XML();
    file = file_xml_name+(no_cache ? "?rnd="+random(99999) : "");
    filexml.load(file);
    filexml.onLoad=parserXml;

    //----------------------
    // OPZIONI GENERALI
    //----------------------

    Obj=new Object();
    Obj.disteso=allow;
    Obj.inerlinea=interline;
    Obj.rientro=tabulation;
    Obj.velocita=velocity;
    Obj.fontsize=fontsize;
    Obj.distWfreccia=arrow_xposition;
    Obj.distWtesto=text_xposition;
    Obj.coloreTesto=text_color;
    Obj.coloreTestoOver=text_color_over;
    Obj.coloreLinea=parseInt(line_color);

    //----------------------

    function parserXml()
    {
    //------------------------------------- opzioni di colore x livello
    var options = this.firstChild.attributes.colorliv;
    Obj.mainOptions=options.split("|");
    //-------------------------------------------------
    nodes = this.firstChild.childNodes;
    creaelementi(nodes);
    delete (filexml);
    delete (nodes);
    }

    //---------------------

    function creaTextBox(pathClip, _testo_, _colore_, _overColore_, x)
    {
    var path;
    var t=_testo_;
    var a_t=t.split("\r\n");
    t=a_t.join("");

    pathClip.createEmptyMovieClip("testo",1);
    path=pathClip.testo;

    path.createTextField("tit",1,0,0,1,1);
    var format = new TextFormat();
    format.font = mainFormat.font;
    format.bold = mainFormat.bold;
    format.italic = mainFormat.italic;
    format.size = Obj.fontsize;
    format.color = parseInt(_colore_);

    path.tit.setNewTextFormat(format);
    path.tit.text = t;
    path.tit.autoSize = true
    path.tit.multiline = false;
    path.tit.selectable = false;
    path.tit.embedFonts = true;

    var formatOver = path.tit.getTextFormat();
    formatOver.color = parseInt(_overColore_)//parseInt(_overColore_);
    path.formatOver = new TextFormat();
    path.formatOver = formatOver;
    path.format = format;

    path._y=Math.floor((pathClip._height/2)-(path._height/2));
    path._x=x;
    }



    function creaelementi(nodes, path, n)
    {
    var c_color, num_color, testo;
    for(var i=0; i<nodes.length; i++)
    {
    if(nodes[i].firstChild.nodeValue!=undefined)
    {
    //-------------------------------------------------------- oggetto clip
    if(path==undefined) path=this;
    path.createEmptyMovieClip("box_"+i, i);
    path["box_"+i].attachMovie("tit", "titolo", 0);
    testo = nodes[i].firstChild.nodeValue;
    if(nodes[i].attributes.FRAME!=undefined)path["box_"+i].titolo.action=["FRAME",nodes[i].attributes.FRAME];
    else if(nodes[i].attributes.FUNCTION!=undefined)path["box_"+i].titolo.action=["FUNCTION",nodes[i].attributes.FUNCTION];
    else if(nodes[i].attributes.URL!=undefined)path["box_"+i].titolo.action=["URL",nodes[i].attributes.URL];
    creaTextBox(path["box_"+i].titolo, testo, Obj.coloreTesto, Obj.coloreTestoOver, Obj.distWtesto);
    if(i==0)
    {
    Obj.altezza=path["box_"+i].titolo._height;
    Obj.larghezza=path["box_"+i].titolo._width;
    }
    path["box_"+i].createEmptyMovieClip("mask", 13000)
    with(path["box_"+i].mask)
    {
    beginFill(0x6330FF);
    lineStyle(0,0xFF0000);
    lineTo(0,0);
    lineTo((Obj.larghezza+(Obj.rientro*Obj.mainOptions .length)),0);
    lineTo((Obj.larghezza+(Obj.rientro*Obj.mainOptions .length)),Obj.altezza);
    lineto(0,Obj.altezza)
    endFill();
    }
    path["box_"+i].setMask(path["box_"+i].mask);
    path["box_"+i].h_id=Obj.altezza+Obj.inerlinea;

    //---------------------------------------------colore riempimento

    c_color="0x"+Obj.mainOptions[n==undefined ? 0 : n]
    clipColor=new Color(path["box_"+i].titolo.box.r)
    clipColorLine=new Color(path["box_"+i].titolo.box.t)
    clipColor.setRGB(c_color)
    clipColorLine.setRGB(Obj.coloreLinea)
    //----------------------------------------------------------------
    if(n!=undefined)path["box_"+0]._x = Obj.rientro; // n = numero di livello

    i==0 ? this.box_0._y=0 : path["box_"+i]._y = i==1 ? path["box_"+i]._height+Obj.inerlinea : path["box_"+(i-1)]._y+path["box_"+(i-1)].titolo._height+Obj.inerlinea ;

    //----------------- pulsanti
    path["box_"+i].titolo.clik=false;
    path["box_"+i].titolo.onRelease=function()
    {
    this.clik=!this.clik;
    this.clik ? this.apriMenu() : this.chiudiMenu();
    this.frec.turnArrow();
    switch(this.action[0])
    {
    case "FRAME":
    var parametri=this.action[1].split("|");
    eval(parametri[0]).gotoAndStop(parametri[1]);
    break;
    case "FUNCTION":
    var parametri=this.action[1].split("|");
    eval(parametri[0]+"."+parametri[1])(parametri[2]);
    break;
    case "URL":
    var parametri=this.action[1].split("|");
    getURL(parametri[0], parametri[1]);
    break;
    }
    }
    path["box_"+i].titolo.onRollOver=function()
    {
    this.testo.tit.setTextFormat(this.testo.formatOver );
    }
    path["box_"+i].titolo.onRollOut=function()
    {
    this.testo.tit.setTextFormat(this.testo.format);
    }
    //--------------------------

    //---------------------------------------------------------
    if(nodes[i].childNodes.length>1)
    {
    path["box_"+i].n=n+1;
    path["box_"+i].titolo.attachMovie("freccia","frec",2);
    path["box_"+i].titolo.frec._y=Math.floor((path["box_"+i].titolo._height/2));//-(path["box_"+i].titolo.frec._height/2))
    path["box_"+i].titolo.frec._x=Obj.distWfreccia;
    creaelementi(nodes[i].childNodes, path["box_"+i], path["box_"+i].n);
    }

    }
    }
    }
    stop();

    -//

  2. #2

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.