# Mouseover event with dynamically loaded clips

**URL:** https://forum.kirupa.com/t/mouseover-event-with-dynamically-loaded-clips/254574
**Category:** Uncategorized
**Created:** [March 13, 2008, 9:56am UTC](https://forum.kirupa.com/t/mouseover-event-with-dynamically-loaded-clips/254574 "2008-03-13T09:56:21Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![obmon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/obmon/32/3503_2.png) [@obmon](https://forum.kirupa.com/u/obmon)
#### Post date: [March 13, 2008, 9:56am UTC](https://forum.kirupa.com/t/mouseover-event-with-dynamically-loaded-clips/254574/1 "2008-03-13T09:56:21Z")

</div>

my code is as follows:

```php

var yearMarkersVar = new LoadVars()
yearMarkersVar.load("script/timeline.php");
yearMarkersVar.onLoad = loadYearVariables;

function loadYearVariables(){
    trace(this.numberOfYears);
    yearPosition = 20;
    for (i = 1; i < this.numberOfYears; i++) {
        yearOf = this["yearToPrint"+i];
        yearMarker = "yearMarker"+i;
        yearLink = "<a href=\"index.php?activeYear=" + yearOf + "\">" + yearOf + "</a>";
        _root.attachMovie("yearMarkerClip", yearMarker, i, {_x:yearPosition, _y:5, yearText:yearLink});
        yearPosition = yearPosition+100;
    }
}

```

This reads a php file (which in turn reads a database) and returns a series of years that have content hidden behind them. then the years are placed into a dynamic textbox within a movieclip (_yearmarker = “yearmarker”+i_).

This all works fine. My trouble is i can’t figure out how to add an OnRollOver event to each dynamically added clip telling it to go to its second frame.

any suggestions?

Thanks in advance.
