gracias Arkane !
no quería abandonar la recursividad para poder renderizar uno a uno los clips...
pero la verdad tampoco pasa nada, así que, un bonito for y chutando...

por cierto, si queréis una sopa de letras, es open source:


en el fla:
#include "../../../includes/sopadeletras.as"
#include "../../../includes/sdf_prototypes.as"
#include "mc_tween2.as"                ----------->                 http://hosted.zeh.com.br/mctween/

y un MovieClip en la librería: "letra" con un fondo "bkg" para colorear y un TextField "tf"

************************************************************************************************************************************

sopadeletras.as


************************************************************************************************************************************

getPressedRight= function (pressed){
    for (var x in tips){
        if(tips[x][0]==pressed){
            pressedWord=x;
            return true;
        }
    }
    return false;
}
getReleasedRight= function (pressed){
    for (var x in tips){
        if(tips[x][0]==pressed){
            releasedWord=x;
            return true;
        }
    }
    return false;
}
getWordDirection= function (){
    var ix=pressedArray[0];
    var iy=pressedArray[1];
    var fx=releasedArray[0];
    var fy=releasedArray[1];
   
   
    if((fx-ix)>0){
        vx=1;
    } else {
        vx=-1;
    }
    if((fy-iy)>0){
        vy=1;
    } else {
        vy=-1;
    }
    if(ix==fx){ vx=0 };
    if(iy==fy){ vy=0 };
    var direccion=new Array();
    direccion[0]=vx;
    direccion[1]=vy;
    //trace("--> "+vx+" "+vy);
    //trace("direccion "+direccion)
    return direccion;
}

highlightSoupWord=function(word){
    //trace("hola");
    var dir=getWordDirection();
    trace(dir);
    var dx=dir[0];
    var dy=dir[1];
    var letras=palabras[word].length;
    //trace(letras);
    var ix=Number(pressedArray[0]);
    var iy=Number(pressedArray[1]);
    for(i=0;i<letras;i++){
        var _c=ix+dx*i;
        var _r=iy+dy*i;
        var mc=sopa[_c+"_"+_r];
        trace(mc+" "+_c+"_"+_r);
        mc.bkg.colorTransformTo ( 0, 99,  0, 196,  0, 00, 60, 60, 0.2, "linear");
    }
    errores=errores-1;
    if(errores==0){
        pistas.htmlText=sopaLV["frase"];
    }
}
//___________________________________________arrangeItems
arrangeItems = function ()
{
    var _r=1;
    var _air=0;
    var next_x=_air;
    var next_y=_air;
    var _c=20;
    var _xd=24;
    for (i = 1; i <= totalitems; i ++)
    {
        var mc = sopa ["item" + i];
        mc.floatTo (0.9,next_x, next_y);
        var resto=i % _c;
        if (resto == 0)
        {
            next_x = _air;
            next_y += _xd;
            _r++;
        } else
        {
            next_x += _xd;
                // var next_y+=yd;
        }
        mc._x =next_x;
        mc._y =next_y;
       
        mc._c=(resto==0) ? 20 : resto ;
        mc._r=(resto==0) ? _r-1 : _r;
        //trace("***"+i+"--->"+mc.letra+" resto: "+resto+" _c:"+mc._c+" _r:"+mc._r);
        mc._name=mc._c+"_"+mc._r;
        //trace(i+"--->  "+mc.letra+" "+mc._name)
    }
    //sopa._x = sopa._original_X;
    //sopa._y = sopa._original_Y;
}
//___________________________________________renderItems
render_item = function (n)
{
   
       
        //trice("rendering item # "+n+" of "+totalitems+" items");
       
        var newname = "item" + n;
        var mc = sopa.attachMovie ("letra", newname, gnHD (this.sopa));
        var letra=sopaData[n-1];
        //trace ("mc " + mc );
        //trace ("letra= " + letra);
        mc.letra=letra;
        mc.tf.text = letra;
        mc. ()
        {
            var scope=this._parent._parent;
            var _r=Math.floor(this._parent._ymouse/24)+1;
            var _c=Math.floor(this._parent._xmouse/24)+1;
            scope.pressed=_c+"_"+_r;
            scope.pressedArray=new Array();
            scope.pressedArray=pressed.split("_");           
            scope.pressedRight=getPressedRight(pressed);
           
            //trace("oP "+letra+" "+scope.pressed+" ok: "+scope.pressedRight);
        }
        mc. ()
        {
            //trace("oR "+letra);
        }
        mc. ()
        {
            var scope=this._parent._parent;
            trace("scope "+scope);
            var _r=Math.floor(this._parent._ymouse/24)+1;
            var _c=Math.floor(this._parent._xmouse/24)+1;
            scope.released=_c+"_"+_r;
            scope.releasedArray=new Array();
            scope.releasedArray=released.split("_");           
            scope.releasedRight=getReleasedRight(pressed);
            if(scope.pressedRight && scope.releasedRight && scope.pressedWord==scope.releasedWord){
                scope.highlightSoupWord(scope.releasedWord);
            }
           
           
           
            //trace("oROut "+letra+" "+scope.released+" ok: "+scope.releasedRight);
        }
        //trace("r--->"+n+" "+newname+" "+ letra);
        mc.order = n;
       
    if (n >= totalitems)
    {
        //trice("***rendering glossary terms finished");
        arrangeItems ();
        //menu_list.setstates ();
    }
}
//___________________________________________showContent
showContent = function ()
{   
    //trace ("---showContent");
    //PALABRAS
    palabras = new Array();
    palabras=sopaLV["palabras"].split(",");
    tips = new Array();
    tips=sopaLV["tips"].split("|");
    for (var x in tips){
        tips[x]=tips[x].split("-");
    }
    errores=tips.length;
    enunciado.htmlText=sopaLV["enunciado"];
    pistas.htmlText=sopaLV["pistas"];
    //trace("tips.length "+tips.length);   
    sopaLV["sopa"]=sopaLV["sopa"].strReplace(" ","");
    sopaLV["sopa"]=sopaLV["sopa"].strReplace("\r","");
    sopaLV["sopa"]=sopaLV["sopa"].strReplace("\n","");
    sopaData = new Array();
    sopaData=sopaLV["sopa"].split(",");
    //trace("sopaData: "+sopaData);
    totalitems = sopaData.length;
    if (totalitems < 1 || totalitems == undefined || totalitems == NaN)
    {
        //trace ("llamada a duplicar falló");
    } else
    {
        //trace ("Totalitems= " + typeof (totalitems) + "---" + totalitems);
        for (i = 1; i <= totalitems; i ++){
            //trace("r--->"+i);
            render_item (i);
        }
    }

}
//___________________________________________reload
reload = function (letra)
{
    //trice("hola");
    if ( ! this.sopa)
    {
        this.createEmptyMovieClip ("sopa", gnHD ());
        sopa._x = 20;
        sopa._y = 120;
        sopa._original_X = 20;
        sopa._original_Y = 120;
        //sopa.aspad (620, 400);
    }
    //trace("***menu_list.temaactual"+menu_list.temaactual);
    content_displayed = true;
    // si hay items, los sacamos
    ////trace ("totalitems:--->" + totalitems);
    if (content_displayed == true && totalitems >= 1 && totalitems != undefined)
    {
        //trace ("totalitems:--->" + totalitems);
        for (h = 0; h <= totalitems; h ++)
        {
            //trace ("for h: " + h);
            sopa ["item" + h].removeMovieClip ();
        }
        //trice("lista anterior eliminada");
    }
    //Cargamos Nuevos Datos
    delete sopaLV;
    sopaLV = new LoadVars ();
    sopaLV.>     sopaLV.load ("ocio_1_1.txt");
    //this.tabla=sopaLV.tabla;
    //getURL("scripts/productos_bbhh.php", "_blank", "POST");
}
reload("ocio_1_1.txt");





************************************************************************************************************************************

sdf_prototypes.as


************************************************************************************************************************************


System.useCodepage = true;
function isOnBrowser() {
return (_root._url.substr(0,4)=="http");
}
//_______________________________________string replace
String.prototype.strReplace=function(strng,toReplace){
var temparray=this.split(strng);
newstring=temparray.join(toReplace);
return newstring;
}
//___________________________color_texts()
TextField.prototype.colorOver=function(){
    //trace("colorizing "+this);
var tutu = new Color(this);
tutu.setRGB(0xCC3300);
}
TextField.prototype.colorUp=function(){
var tutu = new Color(this);
tutu.setRGB(0x333333);
}
 //___________________________________________MovieClip.prototype.gnHD(scope)

MovieClip.prototype.gnHD = function (scope)
{
    if (scope == undefined)
    {
        scope = this;
    }
    return scope.getNextHighestDepth ();
}
//___________________________zind()
_root.zind=16000;
MovieClip.prototype.zindex=function(){
    _root.zind++;
    //trace("_root.zind="+_root.zind+"---");
    this.swapDepths(_root.zind);   
}
MovieClip.prototype.getZindex=function(){
    _root.zind++;
    //trace("_root.zind="+_root.zind+"---");
    return _root.zind;   
}
//___________________________rect()
    MovieClip.prototype.drawRectangle = function(ax, ay, bx, by, rcolor, ralpha){
        //trace(this+" recuadrando");
        this.createEmptyMovieClip ("rect"+order, 100);
        with(this["rect"+order]){
        lineStyle (0.5, rcolor, ralpha);
        moveTo(ax,ay);
        lineTo(ax,by);
        lineTo(bx,by);
        lineTo(bx,ay);
        lineTo(ax,ay);
        }
    }
//___________________________rectFill()   
MovieClip.prototype.drawRectFill = function(ax, ay, bx, by, rcolor, ralpha, fcolor, falpha) {
    var rectDepth = this.getNextHighestDepth ();
    var clip=this.createEmptyMovieClip ("rectFill" + rectDepth, rectDepth);
    //trice("FRAMEclip:-->"+clip);
    //this["rectFill"+rectDepth].swapDepths(this.tooltip_textfield);
    with (clip)
    {
        //trace("THIS_AT RECTFILL"+this);
        beginFill (fcolor, falpha);
        lineStyle (0.5, rcolor, ralpha);
        moveTo (ax, ay);
        lineTo (ax, by);
        lineTo (bx, by);
        lineTo (bx, ay);
        lineTo (ax, ay);
        endFill ();
    }
};
    //_________________________floatTO

MovieClip.prototype.floatTo = function(s, x, y)
{
    //trace("-------------"+this);
this.> this.floating=true;
var x_vector=Math.floor( (( x-this._x)*s)*s);
var y_vector=Math.floor( (( y-this._y)*s)*s);
if(x_vector==0 && y_vector==0){
this.floating=false;
this._x = x;
this._y = y;

delete this.onEnterFrame;
}
this._x += x_vector;
this._y += y_vector;
}
}
MovieClip.prototype.resizeToFit = function(thumb_size) {
    ratio = this._width/this._height;
    this._width = ratio>1 ? thumb_size : thumb_size*ratio;
    this._height = ratio>1 ? thumb_size/ratio : thumb_size;
    this.centerinparent();
    //this._x = thumb_size/2-this._width/2;
    //this._y = thumb_size/2-this._height/2;
};
MovieClip.prototype.centerinparent = function() {
    //trice("this._parent._width "+this._parent+" "+this._parent._width);
    this._x = this._parent._width/2-this._width/2;
    this._y = this._parent._height/2-this._height/2;
};
MovieClip.prototype.centerinroot = function() {
    //trice("this._parent._width "+this._parent+" "+this._parent._width);
    this._x = _root._width/2-this._width/2;
    this._y = _root._height/2-this._height/2;
};
//_______________________________________________________________________________________createmyTextField
MovieClip.prototype.createmyTextField=function(){
    var ndepth=this.getNextHighestDepth();
    var tfname="tf"+ndepth;
    this.createTextField(tfname,ndepth,0,0,0,0);
    var ntf=this[tfname];
    ntf.border = true; //quitar
    ntf.multiline = true;
    //ntf.wordWrap = true;
    ntf.selectable = true;
    ntf.autoSize=true;
    var ntformat=new TextFormat();
    ntformat.font="Verdana";
    ntformat.size = 12;
    //trace("ntformat: "+ntformat.font);
    ntf.setTextFormat(ntformat);
    ntf.setNewTextFormat(ntformat);
    ntf.html = true;
    trace
    //trace("textField Created: "+ntf)
    return ntf;
}
//_______________________________________________________________________________________createmynamedTextField
MovieClip.prototype.createmynamedTextField=function(tfnombre){
    var ndepth=this.getNextHighestDepth();
    var tfname=tfnombre;
    this.createTextField(tfname,ndepth,0,0,0,0);
    var ntf=this[tfname];
    ntf.border = true; //quitar
    ntf.multiline = true;
    //ntf.wordWrap = true;
    ntf.selectable = true;
    ntf.autoSize=true;
    var ntformat=new TextFormat();
    ntformat.font="Verdana";
    ntformat.size = 12;
    //trace("ntformat: "+ntformat.font);
    ntf.setTextFormat(ntformat);
    ntf.setNewTextFormat(ntformat);
    ntf.html = true;
    trace
    //trace("textField Created: "+ntf)
    return ntf;
}
//_______________________________________________________________________________________isonArray
MovieClip.prototype.isonArray=function(term,arreglo){
    var respuesta=false;
   
    for(i=0;i<=arreglo.length;i++){
        if(arreglo.length==undefined){
            respuesta=false;
            break;
        }
        if (term==arreglo[i]){
            respuesta=true;
            break;
        }
    }
    return respuesta;
}





****************************************************************************************************
ocio_1_1.txt
****************************************************************************************************
&sopa=A,D,O,N,D,E,H,A,Y,E,D,U,C,A,C,I,O,N,T,N,
U,O,H,A,Y,D,I,S,T,I,N,C,I,O,N,D,E,A,C,L,
N,A,S,E,S,D,O,A,G,V,O,J,P,S,B,J,L,F,M,H,
I,J,M,D,I,W,M,V,N,O,S,F,D,O,O,L,R,C,V,M,
T,O,A,D,C,R,E,L,L,A,T,S,A,L,E,U,C,S,E,O,
N,X,C,G,Z,U,C,Z,E,J,I,O,P,R,S,M,V,X,I,Z,
O,R,P,U,Z,L,R,V,S,F,Q,K,E,H,U,X,T,C,D,W,
C,B,E,O,P,B,H,H,N,W,G,S,P,J,A,W,I,T,D,J,
F,X,I,G,C,A,D,V,P,F,D,L,L,N,S,F,L,D,Q,S,
N,A,Y,F,L,E,C,V,G,E,K,I,I,E,O,J,M,D,E,N,
T,I,V,Y,O,A,X,I,E,M,L,A,V,E,Z,E,H,Z,X,I,
G,X,T,F,Q,Y,D,M,O,O,M,Z,D,T,S,H,H,F,Z,P,
D,Q,E,A,D,A,P,A,A,N,W,S,Q,O,R,G,T,T,N,N,
N,R,E,O,X,L,P,R,Q,D,A,S,C,D,L,K,H,D,A,J,
W,J,W,I,E,L,K,P,V,S,G,L,F,R,I,V,S,Q,J,C,
V,Z,N,O,M,R,S,T,A,P,Z,Y,W,Z,V,U,R,Z,O,J,
Q,F,B,N,N,Y,D,C,B,S,U,F,A,M,Z,K,M,L,K,N,
E,M,F,S,B,U,O,A,F,G,Q,M,X,A,Y,F,E,F,T,X,
F,E,X,M,L,R,X,E,Q,P,A,O,G,O,Z,F,B,H,P,D,
C,T,V,B,U,R,C,G,J,P,S,J,J,U,T,W,S,P,W,A&
&palabras=CASASDEOFICIO,CONTINUA,ESCUELASTALLER,OCUPACIONAL,REGLADA,TALLERESDEEMPLEO&
&tips=8_17-20_5|1_8-1_1|19_5-6_5|2_5-12_15|2_7-8_13|19_1-4_16&
&frase=Donde hay educacion no hay distincion de clases <br />confucio&
&pistas=Pincha con el ratón en la primera letra, arrastra y suelta en la última letra de la palabra&
&enunciado=Encuentra 6 modalidades de formación profesional&
----------------------------------- ASNativos http://www.5dms.com/listas ------------------------------------

Responder a