Skip to main content
gulhangulez
Participating Frequently
April 23, 2010
Answered

Call variable from TimerEvent class

  • April 23, 2010
  • 1 reply
  • 634 views

Hello,

I have a Timer class and i am trying to call a variable from that TimerEvent class. But i am not sure how to do that. Do you have idea?

function contact(e:MouseEvent):void {
    var world:URLRequest=new URLRequest("contact.swf");
    countertime.addEventListener(TimerEvent.TIMER, counter);
    countertime.start();
}

function counter(e:TimerEvent, world:URLRequest):void {   // red area didnt work
    loadswf.load(world);
    countertime.stop();
}

How can get a var from outside to a Timer Class?

This topic has been closed for replies.
Correct answer Harry Kunz

function contact(e:MouseEvent):void {

    var world:URLRequest=new URLRequest("contact.swf");

    var pfEvent:Function = function(oEvent:TimerEvent):void {counter(oEvent, world);};
    countertime.addEventListener(TimerEvent.TIMER, pfEvent);
    countertime.start();
}

function counter(e:TimerEvent, world:URLRequest):void {   // red area didnt work
    loadswf.load(world);
    countertime.stop();
}

1 reply

Harry KunzCorrect answer
Inspiring
April 23, 2010

function contact(e:MouseEvent):void {

    var world:URLRequest=new URLRequest("contact.swf");

    var pfEvent:Function = function(oEvent:TimerEvent):void {counter(oEvent, world);};
    countertime.addEventListener(TimerEvent.TIMER, pfEvent);
    countertime.start();
}

function counter(e:TimerEvent, world:URLRequest):void {   // red area didnt work
    loadswf.load(world);
    countertime.stop();
}

gulhangulez
Participating Frequently
April 23, 2010

function contact(e:MouseEvent):void {

    var world:URLRequest=new URLRequest("contact.swf");

  var pfEvent:Function = function(oEvent:TimerEvent):void {counter(oEvent, world);};
    countertime.addEventListener(TimerEvent.TIMER, pfEvent);
    countertime.start();
}

function counter(e:TimerEvent, world:URLRequest):void {   // red area didnt work
    loadswf.load(world);
    countertime.stop();
}

Thanks for help, but

Red area giving "1137: Incorrect number of arguments.  Expected no more than 1." error.

How can i solve?

gulhangulez
Participating Frequently
April 23, 2010

ah ok its working now, thanks so much