A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: convert flash 6 - to - flash 8 as2

  1. #1

    convert flash 6 - to - flash 8 as2

    Hi -

    I need some help converting a flash 6 as 1 file, to flash 8 as 2 file. It is a moving xml based tree menu. Can you figure out why it won't work as v8 as2?

    Will pay an agreed amount for the job.

    Thanks
    JH

    the main part of the code:

    PHP Code:
    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=90 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 
    pathclipsubClipthisPathdiff=undefineddisteso=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.inerlineadiff=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==false)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=0mm<clip.lengthmm++)
        {
            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)).indexOf("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_ts_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 
    newlastDistl_Dist==undefined ? (lastDist-(Obj.altezza+Obj.inerlinea)) : l_Dist;
            
    pathStr=new String(ts._parent);
            if((
    pathStr.substr(pathStr.lastIndexOf(".")+1)).indexOf("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(nodespathn)
    {
        var 
    c_colornum_colortesto;
        for(var 
    i=0i<nodes.lengthi++)
        {
            if(
    nodes[i].firstChild.nodeValue!=undefined)
            {
                
    //-------------------------------------------------------- oggetto clip
                
    if(path==undefinedpath=this;
                
    path.createEmptyMovieClip("box_"+ii);
                
    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].titolotestoObj.coloreTestoObj.coloreTestoOverObj.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 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_"+i]._x Obj.rientro;  // n = numero di livello 
                
                
    i==this.box_0._y=path["box_"+i]._y i==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].childNodespath["box_"+i], path["box_"+i].n);
                }
                
            }
        }
    }
    stop();
    //------------------- THE END ----------------------- 

  2. #2
    Senior Member Ovaire d'Oz's Avatar
    Join Date
    May 2006
    Location
    France
    Posts
    148
    ..
    Last edited by Ovaire d'Oz; 02-09-2008 at 03:56 PM.

  3. #3
    Senior Member Ovaire d'Oz's Avatar
    Join Date
    May 2006
    Location
    France
    Posts
    148
    ..
    Last edited by Ovaire d'Oz; 02-09-2008 at 03:55 PM.

  4. #4
    Senior Member Ovaire d'Oz's Avatar
    Join Date
    May 2006
    Location
    France
    Posts
    148
    Hi,
    Could you say what is not working? The whole menu?

  5. #5
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    hi..there is no reason to keep posting the same thing "..."

    you can edit your posts for up to an hour I believe...

    Thanks.

  6. #6
    Senior Member Ovaire d'Oz's Avatar
    Join Date
    May 2006
    Location
    France
    Posts
    148
    I know, what happend is that by the time I wanted to post a reply, I got automatically logged off, and when I tried logging in again, my message was posted three times. I did not find how to remove the two useless posts, so I had to edit them with the minimum characters admited.
    Sorry about that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center