# Help with sending a variable to a class function

**URL:** <https://forum.kirupa.com/t/help-with-sending-a-variable-to-a-class-function/297963>\
**Category:** flash\
**Created:** [October 11, 2009, 10:53am UTC](https://forum.kirupa.com/t/help-with-sending-a-variable-to-a-class-function/297963 "2009-10-11T10:53:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flashTrev](https://avatars.discourse-cdn.com/v4/letter/f/9fc348/32.png) [@flashTrev](https://forum.kirupa.com/u/flashTrev)\
**Post date:** [October 11, 2009, 10:53am UTC](https://forum.kirupa.com/t/help-with-sending-a-variable-to-a-class-function/297963/1 "2009-10-11T10:53:05Z")

</div>

Hi, just finished the usual hours of searching and testing to still be none the wiser so hoping someone here can help. What I am trying to do should work, so why doesn’t it?  
My problem is best explained as so…  
I have two classes one called ‘LoaderSwf.as’ which is used to talk to all the other classes im using. I also have a ‘GeneralTimer.as’ which works fine from a stand alone ‘GeneralTimer.swf’ file. What I am trying to do is send a value of 10ms to the ‘GeneralTimer.as’ which will then run the timer and when complete send a value back. But for simplicity im trying to send a ms value to trace(“tick”) and trace(“tock”).  
I keep getting error “TypeError: Error #1034: Type Coercion failed: Cannot convert 10 to GeneralTimer.” this is according to Adobe “1034 Variables cannot be native.” What does that mean for starters?  
Here’s my code:  
in LoaderSwf.as

```auto
var w:Number = 10;
GeneralTimer(w);

```

in GeneralTimer.as

```auto
package
{
 //trace("called as file");
 import flash.display.Sprite;
 import flash.utils.*;
 import flash.events.*;
 public class GeneralTimer extends Sprite
 {
  public var timer:Timer;
  trace("inside timer class");
  
  public function GeneralTimer(w:Number)
  {
   timer = new Timer(w, 10);
   timer.addEventListener(TimerEvent.TIMER, onTimer);
   timer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
   timer.start();
   trace("inside timer");
  }
  
  private function onTimer(event:TimerEvent):void
  {
   trace("tick");
  }
  
  private function onTimerComplete(event:TimerEvent):void
  {
   trace("Finished!");
  }
 }
}

```

so as you can see I want to send the number 10 to be used in the GeneralTimer. I am sure I have used this before (in CS3) and its worked but am now using CS4 and it doesn’t, any help would be most appreciated.

Cheers
