Ahora tengo 2 clases una que se llama rebotando y otra pelota, mi documento tiene la clase rebotando, tengo agregado el efecto de rebote ahí y las pelotas se llaman ahí también al stage, en total 8. El problema es que necesito que cuando el cursor este sobre una pelota, esta despliegue un mensaje.
Pero no tengo ni idea de como asignar a cada pelota un nodo del array, ni como declarar la funcion para esto

Este es mi codigo para la pelota
Código ActionScript :
package { import flash.events.Event; import flash.display.MovieClip; import flash.display.Sprite; import flash.events.MouseEvent; public class Ball extends MovieClip { public var nSpeedX:Number; public var nSpeedY:Number; public var nombres_array:Array = ["It\'s like dropping your toast butter-side up.", "It\'s like finding twenty bucks in your pocket.", "It\'s like finding parking chock-full of time on the meter.", "It\'s like oversleeping, panicking and then realizing it’s only Sunday.", "It\'s like winning a poker hand with a pair of 2’s.", "It\'s like an even number of socks coming out of the dryer.", "It\'s like spreading peanut butter without ripping the bread."]; private var nStageWidth:Number = 420; private var nStageHeight:Number = 178; public function Ball ( NSpeedX:Number, NSpeedY:Number ) : void { nSpeedX = NSpeedX; nSpeedY = NSpeedY; this.addEventListener ( Event.ENTER_FRAME, onEnterFrameHandler ); this.addEventListener ( MouseEvent.MOUSE_OVER, detenerya); this.addEventListener ( MouseEvent.MOUSE_OUT, seguiya); //this.addEventListener( MouseEvent.MOUSE_OVER,trazar); //this.addEventListener( MouseEvent.MOUSE_OUT,outF); //for(var i=0;i<8;i++){ //this["ball"+i].ivar=i; //} } private function onEnterFrameHandler ( E:Event ) : void { this.x -= nSpeedX; this.y -= nSpeedY; if ( this.x >= nStageWidth - 10 ) { this.x = nStageWidth - 10; nSpeedX *= -1; } else if ( this.x <= 10 ) { this.x = 10; nSpeedX *= -1; } if ( this.y >= nStageHeight - 10 ) { this.y = nStageHeight - 10; nSpeedY *= -1; } else if ( this.y <= 10 ) { this.y = 10; nSpeedY *= -1; } } private function detenerya ( e : MouseEvent ) : void { removeEventListener( Event.ENTER_FRAME, onEnterFrameHandler); } private function seguiya ( e : MouseEvent ) : void { addEventListener( Event.ENTER_FRAME, onEnterFrameHandler); } //function overF(e:MouseEvent):void{ //tf.text=textA[e.currentTarget.ivar]; // if the compiler complains, cast e.currentTarget as a MovieClip //} //function outF(e:MouseEvent):void{ //tf.text=""; //} //private function trazar(item:*, index:int, array:Array) : void { //trace( index + item ); //} //nombres_array.forEach(trazar); } }