# Dynamic Moviclip event Handlers

**URL:** <https://forum.kirupa.com/t/dynamic-moviclip-event-handlers/247896>\
**Category:** flash\
**Created:** [December 31, 2007, 11:33pm UTC](https://forum.kirupa.com/t/dynamic-moviclip-event-handlers/247896 "2007-12-31T23:33:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joefloggs](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@joefloggs](https://forum.kirupa.com/u/joefloggs)\
**Post date:** [December 31, 2007, 11:33pm UTC](https://forum.kirupa.com/t/dynamic-moviclip-event-handlers/247896/1 "2007-12-31T23:33:48Z")

</div>

Apologies if this has been covered, in truth i have no idea what I would even search to find the answer. Many thanks in advance. Oh and I realise its new years eve, just keeping busy lol!

My question is this.

I’m desining a flash movie which takes in an xml and reads in a JPG to load. Once loaded, I will duplicate a movieclip to such that at certain points on this jpg these movieclips will exist. For example, I’ll have a picture of a racing track, and on top of it will be several circular movieclips ontop of certain turns on the racing track. Now with the help of XML i know the x, y and name attributes of each of these turns so i can create movieclips for them quite easily. What i don’t know how to do is to code the event handlers for each of them.

Basically, when the user hover over a turn (and so a movieclip) I want the name of that turn to pop up.

So lets say i have an oval, just two turns (TURN A and TURN B)

Now when the user hovers over TURN A and event must occur for some txt field to be populated by the name of that turn. I read some of Kirupa’s excellent tutorials on eventListeners but i’m quite new to Flash and it would be good to get a summary or insight on how to approach this. So far I’m using this

```auto

this.broadcaster = new Object();
EventDispatcher.initialize(this.broadcaster);
this.listener = new Object();
this.listener.handleEvent = function(evt:Object):Void {
    trace("EVT CALLED
------------

X: "+evt.x+"	Y: "+evt.y+"	label: "+evt.label);
};
this.broadcaster.addEventListener("genericEvent", this.listener);

```

now i can dispatch an event at will by using

```auto

this.broadcaster.dispatchEvent({type:"genericEvent", x:xPos, y:yPos, label:labl})

```

where the attrb are populated via XML. What i don’t know how to do is to dispatch these events when the user hovers over a specific movieclip.

Any help would be appreciated.

Harvey
