IamBadAtAS3
04-10-2008, 09:03 AM
so here is my code so far...
var playSpeed = 400;
var playInterval;
var pauseInterval;
var date = new Date (1993,05,01);
var maxHeight =50;
var isPlaying = false;
var day = 0;
playBut.addEventListener(MouseEvent.CLICK, onPlayClick);
trace (playBut);
function onPlayClick(e) {
if(!isPlaying){
playInterval = setInterval (incrementDate, playSpeed);
isPlaying = true;
}
if (date ==(1993,08,31)){
date = (1993,06,01);
}
}
pauseBut.addEventListener (MouseEvent.CLICK, onPauseClick);
function onPauseClick(e) {
isPlaying = false;
clearInterval(playInterval);
}
function incrementDate(){
slider.caret.y = (day-min)/(divisions-1) * (slider.channel.width);
var startDate = new Date(1993,5,1);
startDate.date += day
divText.text = startDate.toString().substring(4,10)+', 1993';
for each(var measurePts in statNames) {
trace (measurePts);
scaleSymbol(this[measurePts], this[measurePts + "Array"][day]);
}
if (day < 92) {
day ++;
}else {
scaleSymbol(this[measurePts], this[measurePts + "Array"][day]);
}
}
function scaleSymbol (symbol, value) {
symbol.height = (value / maxValue) * maxHeight;
}
slider.caret.x = (date-min)/(divisions-1) * (slider.channel.width);
divText.text = String(date);
and when i try to run it, it gives me an error
1083: Syntax Error: var is unexpected (var playSpeed =400)
anybody see what is wrong?
var playSpeed = 400;
var playInterval;
var pauseInterval;
var date = new Date (1993,05,01);
var maxHeight =50;
var isPlaying = false;
var day = 0;
playBut.addEventListener(MouseEvent.CLICK, onPlayClick);
trace (playBut);
function onPlayClick(e) {
if(!isPlaying){
playInterval = setInterval (incrementDate, playSpeed);
isPlaying = true;
}
if (date ==(1993,08,31)){
date = (1993,06,01);
}
}
pauseBut.addEventListener (MouseEvent.CLICK, onPauseClick);
function onPauseClick(e) {
isPlaying = false;
clearInterval(playInterval);
}
function incrementDate(){
slider.caret.y = (day-min)/(divisions-1) * (slider.channel.width);
var startDate = new Date(1993,5,1);
startDate.date += day
divText.text = startDate.toString().substring(4,10)+', 1993';
for each(var measurePts in statNames) {
trace (measurePts);
scaleSymbol(this[measurePts], this[measurePts + "Array"][day]);
}
if (day < 92) {
day ++;
}else {
scaleSymbol(this[measurePts], this[measurePts + "Array"][day]);
}
}
function scaleSymbol (symbol, value) {
symbol.height = (value / maxValue) * maxHeight;
}
slider.caret.x = (date-min)/(divisions-1) * (slider.channel.width);
divText.text = String(date);
and when i try to run it, it gives me an error
1083: Syntax Error: var is unexpected (var playSpeed =400)
anybody see what is wrong?