Gustavo,
In your for loop:
// The item's name property needs to be set
var itemNames:String = names[i];
item.name = itemNames;
Then in your rollOverHandler:
trace("event.target.name =",event.target.name);
HTH
Regards,
-Keith
http://keithreinfeld.home.comcast.net
> -----Original Message-----
> From: [email protected] [mailto:flashcoders-
> [email protected]] On Behalf Of Gustavo Duenas LRS
> Sent: Tuesday, February 03, 2009 10:07 PM
> To: Flash Coders List
> Subject: [Flashcoders] really help needed here.
>
> Hi I ahve this code for a carrousel 3d for as3 and I was wondering if
> you could help me out , because it seems that
> when I try to name the "item" it works to load the pictures but after
> the push in the array, the items doesn't have
> a name I don't know how could I'd be able to pass a name I've tried
> everything that I know.. HELP ME!!!
>
> here is the code
>
> var names:Array =
> ["models","portrait","weddings","children","commercial"];
> var numOfItems:uint = names.length; // number of Items to put on stage
> var radiusX:uint = 250; // width of carousel
> var radiusY:uint = 75; // height of carousel
> var centerX:Number = stage.stageWidth / 6; // x position of center of
> carousel
> var centerY:Number = stage.stageHeight /7; // y position of center of
> carousel
> var speed:Number = 0.05; // initial speed of rotation of carousel
> var itemArray:Array = new Array(); // store the Items to sort them
> according to their 'depth' - see sortBySize() function.
>
> init();
>
> // place Items on stage
> function init():void {
> for(var i:uint = 0; i < numOfItems; i++) {
> var item:Item = new Item();
> //adcionamos las fotos/
> var itemNames = item.name;
> itemNames = names[i];
> trace(itemNames);
> var itemPics:Loader = new Loader();
> itemPics.load(new URLRequest("menuImages/"+
> itemNames +".jpg"));// here it works I can load the pictures in the
> different items
> itemPics.x=-25;
> itemPics.y=-30;
> item.addChild(itemPics);
>
> item.angl = i * ((Math.PI * 2) / numOfItems);
> //item.ref.mask = item.masker;
> item.alpha = 0.5;
> itemArray.push(item);
> addChild(item);
> item.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
> // listen for MouseEvents only on icons, not on reflections
> //item.addEventListener(MouseEvent.CLICK, clickHandler);
> item.addEventListener(MouseEvent.ROLL_OVER,
rollOverHandler);
> item.addEventListener(MouseEvent.ROLL_OUT, rollOutHandler);
> function rollOverHandler(event:MouseEvent):void {
> event.target.parent.alpha = 9;
> trace(item.name);//here is the problem when I try to use the roll
> over to trace its name(the name of each item...nothing works...why?
>
>
>
>
> }
>
> }
> }
>
>
> Someone help me please.!!
>
>
>
> Gustavo Duenas
>
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders