Foros del Web » Creando para Internet » Flash y Actionscript »

attachMovie

Estas en el tema de attachMovie en el foro de Flash y Actionscript en Foros del Web. Hola tengo una pregunta tengo una función que crea en la pantalla unos iconos. Código: createIcons = createIcons = function () { var icoNum = ...
  #1 (permalink)  
Antiguo 07/08/2009, 06:22
 
Fecha de Ingreso: agosto-2009
Mensajes: 13
Antigüedad: 14 años, 8 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;
};
  #2 (permalink)  
Antiguo 07/08/2009, 09:37
Avatar de Kottore  
Fecha de Ingreso: octubre-2007
Mensajes: 170
Antigüedad: 16 años, 6 meses
Puntos: 8
Respuesta: attachMovie

prueba con:

removeMovieClip(_root.nombre_archivo);

Saludos
  #3 (permalink)  
Antiguo 07/08/2009, 12:36
 
Fecha de Ingreso: agosto-2009
Mensajes: 13
Antigüedad: 14 años, 8 meses
Puntos: 0
Respuesta: attachMovie

Funciona! Muchas gracias!
Código:
function iconsOut()
{
 
    var icoNum = 0;
    checkPhoneType();
    if (isWalkman)
    {
        removeMovieClip(_root.walkman);
    }
    else if (isCybershot)
    {
        removeMovieClip(_root.cybershot);
    } // end else if
	removeMovieClip(_root.deselectedIcons);
	removeMovieClip(_root.selectedIcons);
    for (row = 1; row <= 4; row++)
    {
        for (col = 1; col <= 3; col++)
        {
            ++icoNum;
            newClip = "clip" + icoNum;
            removeMovieClip(_root.newClip);
            var iconName = _root["_IconName"];
            with (_root[newClip])
            {
                _x = col * 70 - 20;
                _y = row * 58 + 19;
                if (iconName == "MEDIAPLAYER_DESKTOP_ICN" && isWalkman)
                {
                    removeMovieClip("des" + icoNum);
                    removeMovieClip("sel" + icoNum);
                }
                else
                {
                    removeMovieClip("des");
                    removeMovieClip("sel");
                } // end else if
                if (deselectedIcons["des" + icoNum] == undefined || selectedIcons["sel" + icoNum] == undefined)
                {
                    removeMovieClip("des" + icoNum);
                    removeMovieClip("sel" + icoNum);
                } // end if
                icoNum = icoNum;
            } // End of with
            iconName = null;
        } // end of for
    } // end of for
    icoNum = null;
};
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:26.