|
-
Undefined property Timer ??
This is the code (simple):
var timer:Timer = new Timer(2000, 1);
timer.addEventListener(TimerEvent.Timer, onTimer);
timer.start();
function onTimer(evt:TimerEvent):void {
r1.filters = sampleFilters; }
This is the error:
"access of possibly undefined property Timer through a reference with statis type"
And I do did import flash.events.TimerEvent; --- am I supposed to import something else? Is this the problem?
TIA
-
Senior Member
It should be TimerEvent.TIMER
-
Of course you must import the Timer class itself.
import flash.utils.Timer;
http://www.gemstonedragon.com/
-
Senior Member
If it's just code in the timeline of the .fla, you don't need to import the Timer class, it's already there.
-
Have you tried it? If not it's only one line of code. I think you need to import it.
http://www.gemstonedragon.com/
-
Senior Member
-
Weird.
So, I set it up like this:
import flash.events.TimerEvent.TIMER; (also tried this without the all caps for "Timer"
import flash.utils.Timer;
and I'm getting this error:
1172: Definition flash.events.TimerEvent:TIMER could not be found.
Then for the second line of the following code ...
var timer:Timer = new Timer(2000, 1);
timer.addEventListener(TimerEvent.Timer, onTimer);
timer.start();
I'm getting this error:
1119: Access of possibly undefined property Timer through a reference with static type Class.
PS - I'm working on the timeline.
Last edited by Leftyplayer; 09-14-2009 at 03:20 PM.
-
Senior Member
No i mean like this:
Code:
var timer:Timer = new Timer(2000, 1);
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.start();
function onTimer(evt:TimerEvent):void {
r1.filters = sampleFilters;
}
No need to import anything, that's all you need.
-
Ahhh! thanks, man. Simple solution and it's working. I appreciate your help.
-
Senior Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|