Tema: attachMovie
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/08/2009, 06:22
rhp07
 
Fecha de Ingreso: agosto-2009
Mensajes: 13
Antigüedad: 15 años, 3 meses
Puntos: 0
attachMovie

Hola tengo una pregunta tengo una función que crea en la pantalla unos iconos.
Código:
createIcons = createIcons = function ()
{
    var icoNum = 0;
    checkPhoneType();
    if (isWalkman)
    {
        _root.attachMovie("walkman_glow", "walkman", 170, {_x: 0, _y: 16});
        _root.walkman._visible = false;
    }
    else if (isCybershot)
    {
        _root.attachMovie("cybershot_glow", "cybershot", 170, {_x: 0, _y: 16});
        _root.cybershot._visible = false;
    } // end else if
    for (row = 1; row <= 4; row++)
    {
        for (col = 1; col <= 3; col++)
        {
            ++icoNum;
            newClip = "clip" + icoNum;
            _root.attachMovie("iconHolder", newClip, 150 + icoNum);
            var iconName = _root["App" + (icoNum - 1) + "_IconName"];
            with (_root[newClip])
            {
                _x = col * 70 - 20;
                _y = row * 58 + 19;
                if (iconName == "MEDIAPLAYER_DESKTOP_ICN" && isWalkman)
                {
                    deselectedIcons.attachMovie("WALKMAN_DESKTOP_ICN_deselected", "des" + icoNum, deselectedIcons.getNextHighestDepth());
                    selectedIcons.attachMovie("WALKMAN_DESKTOP_ICN_selected", "sel" + icoNum, selectedIcons.getNextHighestDepth());
                }
                else
                {
                    deselectedIcons.attachMovie(iconName + "_deselected", "des" + icoNum, deselectedIcons.getNextHighestDepth());
                    selectedIcons.attachMovie(iconName + "_selected", "sel" + icoNum, selectedIcons.getNextHighestDepth());
                } // end else if
                if (deselectedIcons["des" + icoNum] == undefined || selectedIcons["sel" + icoNum] == undefined)
                {
                    deselectedIcons.attachMovie("default", "des" + icoNum, deselectedIcons.getNextHighestDepth());
                    selectedIcons.attachMovie("default", "sel" + icoNum, selectedIcons.getNextHighestDepth());
                } // end if
                icoNum = icoNum;
            } // End of with
            iconName = null;
        } // end of for
    } // end of for
    icoNum = null;
};
y cuando la llamo con la función "createIcons()" me crea los iconos.
Ahora el problema es.. cómo los quito!? Como puedo eliminar los iconos creados con attachMovie?? Alguien me podría ayudar con ésto!? Gracias.

He intentado suerte con el comand "unattachMovie" que lo leí en un foro pero no funciona.
Código:
function iconsOut()
{
 
    var icoNum = 0;
    checkPhoneType();
    if (isWalkman)
    {
        _root.unattachMovie("walkman");
        _root.walkman._visible = false;
    }
    else if (isCybershot)
    {
        _root.unattachMovie("cybershot");
        _root.cybershot._visible = false;
    } // end else if
    for (row = 1; row <= 4; row++)
    {
        for (col = 1; col <= 3; col++)
        {
            ++icoNum;
            newClip = "clip" + icoNum;
            _root.unattachMovie(newClip);
            var iconName = _root["_IconName"];
            with (_root[newClip])
            {
                _x = col * 70 - 20;
                _y = row * 58 + 19;
                if (iconName == "MEDIAPLAYER_DESKTOP_ICN" && isWalkman)
                {
                    deselectedIcons.unattachMovie("des" + icoNum);
                    selectedIcons.unattachMovie("sel" + icoNum);
                }
                else
                {
                    deselectedIcons.unattachMovie("des");
                    selectedIcons.unattachMovie("sel");
                } // end else if
                if (deselectedIcons["des" + icoNum] == undefined || selectedIcons["sel" + icoNum] == undefined)
                {
                    deselectedIcons.unattachMovie("des" + icoNum);
                    selectedIcons.unattachMovie("sel" + icoNum);
                } // end if
                icoNum = icoNum;
            } // End of with
            iconName = null;
        } // end of for
    } // end of for
    icoNum = null;
};