Hola a todos me surge el siguiente problema
tengo este codigo fla
//import classes and packages
import mx.transitions.easing.*;
import gs.TweenMax;
//create function to add buttons on menu
function addButtons() {
pushOverY = 0;
for (i=0; i<totalButtons; i++) {
menu.attachMovie("rectangle","rectangle",-1,{_x:0, _y:rY});
btn = menu.attachMovie("button", "btn"+i, i, {_x:0, _y:pushOverY, id:i});
btn.initialY = btn._y;
btn.textMC.t.autoSize = "left";
btn.textMC.t.text = obj.buttons[i].attributes.title;
btn.textMC.t.textColor = iC;
pushOverY += 42;
//set events for this button
setBtnEvents(btn);
//add submenu items
pushOverX = 0;
btn.totalSubItems = obj.buttons[i].childNodes.length;
for (j=0; j<btn.totalSubItems; j++) {
subItem = btn.subMenu.attachMovie("subItem", "subItem"+j, j, {_x:pushOverX, _y:0, id:j});
subItem.t.autoSize = "left";
subItem.t.text = obj.buttons[i].childNodes[j].attributes.title;
subItem.t.textColor = siC;
pushOverX += subItem._width+10;
}
}
Mouse.addListener(mouseListener);
}
//create function for buttons events
function setBtnEvents(btn:MovieClip) {
btn.back.onRollOver = function() {
overBtn = this._parent;
if(this != pressedBtn){
if(pressedBtn != undefined){
tweenBtn(pressedBtn,100,iC,42,.8);
}
tweenBtn(this,160,iROC,90,.8);
tweenRectangle(this._parent.initialY,.8);
}
};
btn.back.onRollOut = function() {
if(this != pressedBtn){
if(pressedBtn != undefined){
tweenBtn(pressedBtn,160,iROC,90,.8);
tweenRectangle(pressedBtn._parent.initialY,.8);
}else{
tweenRectangle(rY,.8);
}
tweenBtn(this,100,iC,42,.8);
}
};
btn.back.onPress = function() {
pressedBtn = this;
//if is not pressed over subMenu then select the first subitem
if(!pressedBtn._parent.subMenu.hitTest(_xmouse,_ym ouse)){
var cl:Color = new Color(pressedSubItem);
cl.setRGB(siC);
pressedSubItem = pressedBtn._parent.subMenu["subItem"+0];
var cl:Color = new Color(pressedSubItem);
cl.setRGB(siROC);
//ADD HERE CUSTOM FUNCTION
}
}
}
//create tweens with TweenMax
function tweenBtn(mc:MovieClip,textScale:Number,textTint:Nu mber,backHeight:Number,sec:Number){
mc.lastHeight = mc._height;
TweenMax.to(mc._parent.textMC,sec,{_xscale:textSca le, _yscale:textScale, tint:textTint, ease:Strong.easeOut});
TweenMax.to(mc,sec,{_height:backHeight, ease:Strong.easeOut, onUpdate:moveButtons, onUpdateParams:[mc]});
}
function tweenRectangle(newY:Number,sec:Number){
TweenMax.to(menu.rectangle,sec,{_y:newY, ease:Strong.easeOut});
}
function moveButtons(btn:MovieClip) {
btn.currentHeight = btn._height;
for (i=btn._parent.id+1; i<totalButtons; i++) {
menu["btn"+i]._y += btn.currentHeight-btn.lastHeight;
}
btn.lastHeight = btn._height;
}
var rY = 355; //rectangle initial y
var iC:Number = new Number();//item color
var iROC:Number = new Number();//iem rollover color
var siC:Number = new Number();//subitem color
var siROC:Number = new Number();//subitem rollover color
var totalButtons:Number = new Number();
var overBtn:MovieClip = new MovieClip();
var pressedBtn:MovieClip = undefined;
var pressedSubItem:MovieClip = new MovieClip();
var mouseListener:Object = new Object();
//create subItems events
mouseListener.onMouseMove = function() {
overSubItems = 0;
for (j=0; j<overBtn.totalSubItems; j++) {
s = overBtn.subMenu["subItem"+j];
if (s.hitTest(_xmouse, _ymouse)) {
var cl:Color = new Color(s);
cl.setRGB(siROC);
overSubItems++;
} else {
var cl:Color = new Color(s);
cl.setRGB(siC);
}
}
if (overSubItems == 0) {
var cl:Color = new Color(pressedSubItem);
cl.setRGB(siROC);
}
};
mouseListener.onMouseDown = function() {
for (j=0; j<overBtn.totalSubItems; j++) {
s = overBtn.subMenu["subItem"+j];
if (s.hitTest(_xmouse, _ymouse)) {
pressedSubItem = s;
//ADD HERE CUSTOM FUNCTION
}
}
};
//object that contains data from xml
var obj:Object = new Object();
//create new 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) {
//get colors values from xml
iC = Number(this.firstChild.attributes.itemColor);
iROC = Number(this.firstChild.attributes.itemRollOverColo r);
siC = Number(this.firstChild.attributes.subitemColor);
siROC = Number(this.firstChild.attributes.subitemRollOverC olor);
obj.buttons = this.firstChild.childNodes;
totalButtons = obj.buttons.length;
//function call
addButtons();
} else {
trace("xml could not load");
}
};
//the path to the xml file
xml.load("menu.xml");
Y este XML
<?xml version="1.0" encoding="UTF-8"?>
<menu itemColor="0xFFFFFF" itemRollOverColor="0xFF9900" subitemColor="0xFFFFFF" subitemRollOverColor="0xB99424">
<item title="Eventos">
<subitem title="Show 1"/>
<subitem title="Show 2"/>
<subitem title="Show 3"/>
<subitem title="Show 4"/>
</item>
<item title="Staff">
<subitem title="Nosotros"/>
</item>
<item title="Galerias">
<subitem title="Fotos"/>
<subitem title="Videos"/>
</item>
<item title="Mapa">
<subitem title="Mapa";/>
<subitem title="Direccion"/>
</item>
<item title="Contactos">
<subitem title="Mail"/>
<subitem title="Facebook"/>
</item>
</menu>
Y no se nme ocurre como cargar SWF a los subitems.
Alguna idea??'
Gracias chicos