Problems trying to access a MovieClip that contains a dynamically loaded
image, inside dynamically created menu items.

I hope the code is self explanatory !

function mouseOverItem(e:Event):void {
var item:MenuItem = e.target as MenuItem;
 trace (item.getChildAt(3).name);
trace (item.getChildAt(3));
trace (item.bt_title);
 trace (item.getChildAt(4).name);
trace (item.getChildAt(4));
trace (item.icone);

new GTween(item.bt_title, 0.3, {y:25}, easing1);
new GTween(item.bt_subtitle, 0.3, {y:25}, easing1);
new GTween(item.icone, 0.3, {y:100}, easing1);            /*/ doesn´t work!!
*


*The tracing output this:*

bt_title
[object MovieClip]
[object MovieClip]
icone
[object MovieClip]
undefined

*QUESTION: Why do i get undefined? shouldn´t I get  "[object MovieClip]"
instead ?*

Thanks!!

In case this code is not clear:

function iniciarMenu ():void{

for (var i:Number = 0; i < my_total; i++){

var menuItem:MenuItem = new MenuItem();
menuItem.x = (menuItem.width + 2)*i;
menuItem.bt_title._txt.text = my_items[...@title;
menuItem.bt_title._txt.antiAliasType = AntiAliasType.ADVANCED;
menuItem.bt_subtitle._txt.text = my_items[...@subtitle;
menuItem.bt_subtitle._txt.antiAliasType = AntiAliasType.ADVANCED;

menuItem.linkTo = my_items[...@link;
menuItem.mouseChildren = false;

menuItem.addEventListener(MouseEvent.MOUSE_OVER, mouseOverItem);
menuItem.addEventListener(MouseEvent.MOUSE_OUT, mouseOutItem);
menuItem.addEventListener(MouseEvent.CLICK, itemClicked);

menu_mc.addChild(menuItem);
menuArray[i] = menuItem;

var iconURL = my_items[...@icon;
var iconLoader = new Loader();
iconLoader.load(new URLRequest(iconURL));
iconLoader.name = i;
iconLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, iconLoaded);

}
}

function iconLoaded(e:Event):void{
var my_icon:Loader = Loader(e.target.loader);
var iconMC:MovieClip = new MovieClip();
iconMC.addChild(my_icon);
menuArray[my_icon.name].addChild(iconMC);

iconMC.x = 100;
iconMC.y = 35;
iconMC.alpha = 0;
iconMC.name = "icone";
new GTween(iconMC, 0.9, {alpha:0.8}, easing1);
 my_icon.contentLoaderInfo.removeEventListener(Event.COMPLETE, iconLoaded);
my_icon = null;
}
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to