Here's a snippit and a timeline version of it - when I run it on the timeline,
it works as expected, but when I run it within my class it acts as though there
are two instances of the _timer object.
On the timeline, it works as expected, tracing,
1 1
True
But when I have it inside my class, it traces,
1 0
false
1 1
True
What am I not seeing or understanding here? Thanks..
//******** Version on timeline:
var _timer:Timer;
function init() {
_timer = new Timer(250, 0);
_timer.addEventListener(TimerEvent.TIMER, checkPlaying);
_timer.start();
}
function checkPlaying(e:TimerEvent) : void {
if (1 == 1) {
e.target.stop();
trace(e.target.currentCount, _timer.currentCount);
trace(e.target == _timer);
}
}
init();
//******** Version in class:
public function Tracker(video) {
_video = video;
}
public function init() {
_timer = new Timer(250, 0);
_timer.addEventListener(TimerEvent.TIMER, checkPlaying);
_timer.start();
}
function checkPlaying(e:TimerEvent) : void
if (1 == 1) {
e.target.stop();
trace(e.target.currentCount, _timer.currentCount);
trace(e.target == _timer);
}
}
I'm instantiating it from another class like this:
if (_tracker == null) {
_tracker = new Tracker(_videoScreen);
}
_tracker.init();
_ _ _
Erik Mattheis
Senior Web Developer
Minneapolis
T 952 346 6610
C 612 377 2272
Weber Shandwick
Advocacy starts here.
PRWeek Global Agency Report Card 2009 - Gold Medal Winner
The Holmes Report Global Agency of the Year
PR News Agency of the Year
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders