# Invoking a Function in a Class on a Mouse Event

**URL:** https://forum.kirupa.com/t/invoking-a-function-in-a-class-on-a-mouse-event/270501
**Category:** flash
**Created:** [September 10, 2008, 3:54pm UTC](https://forum.kirupa.com/t/invoking-a-function-in-a-class-on-a-mouse-event/270501 "2008-09-10T15:54:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![nifty\_](https://avatars.discourse-cdn.com/v4/letter/n/4da419/32.png) [@nifty\_](https://forum.kirupa.com/u/nifty_)
#### Post date: [September 10, 2008, 3:54pm UTC](https://forum.kirupa.com/t/invoking-a-function-in-a-class-on-a-mouse-event/270501/1 "2008-09-10T15:54:26Z")

</div>

hey there folks,

need a little hand, i am trying to activate a function within a class on a mouse rollover -this is AS2 in CS3 and i have the following in my Class.as:

```php

private function mouseEvents(new_pane, pane_name)
 {
  new_pane[pane_name].onRollOver = function () 
  {
   movePanes()
   this._alpha = 50
  }
  new_pane[pane_name].onRollOut = function () 
  {
   this._alpha = 100
  }
 
 }
 
 public function movePanes():Void
 {
  var i:Number
  for(i in _global.pane_array)
  {
   trace(_global.pane_array*)
  }
 }

```

the global.pane\_array is specified in my FLA  
Obviously i would like to see the trace from the array, but nada…  
if i put the movePanes() outside the rollover event, it works fine… however this does not achieve my goals

also if i declare the function as a global function from within my FLA, and then call it on the rollover e.g. \_global.movePanes() - it works!

I could really use some assistance here as have an imminent deadline approaching…

Many Thanks  
nift
