Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/06/2010, 08:39
kidart
 
Fecha de Ingreso: junio-2010
Mensajes: 108
Antigüedad: 13 años, 10 meses
Puntos: 2
Cargar loadmovie desde XML

Hola, soy nuevo en el foro. Tengo un template de botonera xml de flash que quiero modificar.

La botonera esta hecha para cargar links de url´s. Yo quisiera en cambio que me cargue unos MC de flash, dentro de la misma pelicula. O sea, generar la funcion loadmovie desde el xml para que al clickear los botones se carguen .swf en la pelicula "contenedor_mc" que tengo en el root...


El codigo del actionscript es este:


[I]

import flash.filters.DropShadowFilter;
import mx.transitions.Tween;
import mx.transitions.easing.*;

stop();



//create function to add buttons
function addButtons() {
pushOverX = 0;
for (i=0; i<obj.buttons.length; i++) {
btn = buttons.attachMovie("menu", "menu"+i, i, {_x:pushOverX, _y:0});
btnsArray.push(btn);
pushOverX += btn._width + btnSpacing;
btn.itemOverColor = obj.buttons[i].attributes.itemRollOverColor;
btn.itemColor = obj.buttons[i].attributes.itemColor;
btn.parentBtn.name_txt.text = obj.buttons[i].attributes.title;
btn.parentBtn.name_txt.textColor = btn.itemColor;

//create menuItems array to store the text labels (do not change the array name, keep it >>menuItems<<);
btn.menuItems = new Array();
btn.links = new Array();
for (j=0; j<obj.buttons[i].childNodes.length; j++) {
btn.menuItems.push(obj.buttons[i].childNodes[j].attributes.title);
btn.links.push(obj.buttons.childNodes[j].attributes.link);
_root["menuitems"+i].buttons.onRelease=function(){
loadMovie(this._parent.Link, contenedor_mc);}


}
//add shadow filter
btn.filters = [ds];
}
}

var ds:DropShadowFilter = new DropShadowFilter(2, 45, 0x000000, 100, 6, 6, 1.1, 3);

//space between buttons
var btnSpacing:Number = new Number();

//object that contains data from xml
var obj:Object = new Object();

//create nex xml object
var xml:XML = new XML();
xml.ignoreWhite = true;



//after the xml is loaded, load variables and parse the date to obj
xml.onLoad = function(succes) {
if (succes) {
//bS = Number(this.firstChild.attributes.spacing);
obj.buttons = this.firstChild.childNodes;
btnSpacing = Number(this.firstChild.attributes.buttonsSpacing);
//function call
addButtons();
} else {
trace("xml could not load");
}
};

//the path to the xml file
xml.load("menu.xml");







y el del XML es el siguiente.



<?xml version="1.0" encoding="UTF-8"?>

<menu buttonsSpacing="10" >

<item title="CV" itemColor="0x333333" itemRollOverColor="0xFF0033">
<subitem title="CV" link ="http://guadalupegomezverdi.blogspot.com/" />
</item>

<item title="SERIES" itemColor="0x333333" itemRollOverColor="0xff0033">
<subitem title="Girls" link="mygallery.swf" />
<subitem title="Boys" link ="http://www.ffiles.com/users/NoGrids" />
<subitem title="Animaux" link ="http://www.ffiles.com/users/NoGrids" />
<subitem title="Stages" link ="http://www.ffiles.com/users/NoGrids" />
<subitem title="Pieces" link ="http://www.ffiles.com/users/NoGrids" />
<subitem title="Cuts" link ="http://www.ffiles.com/users/NoGrids" />
<subitem title="Pret a Porter" link ="http://www.ffiles.com/users/NoGrids" />
<subitem title="Diary" link ="http://guadalupegomezverdi.blogspot.com/" />
</item>

<item title="CONTACTO" itemColor="0x333333" itemRollOverColor="0xff0033">
<subitem title="CONTACTO" link ="http://guadalupegomezverdi.blogspot.com/" />
</item>


</menu>



Les agradezco cualquier ayuda, ya que estoy bastante desorientado. Se que tengo que agregar en el flash un codigo para q el xml haga el load movie, pero no sabria cual es.