PDA

View Full Version : error i don't understand


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?

Paul Ferrie
04-10-2008, 09:24 AM
Tag your code please

IamBadAtAS3
04-10-2008, 09:29 AM
tag? like how? or do you mean comment?

Paul Ferrie
04-10-2008, 09:36 AM
When posting code your code if a large amount like in your post should be wrapped in code tags


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);

look for the flash icon in the post window just about the post message box

IamBadAtAS3
04-10-2008, 09:46 AM
ok, i will do that from now on.


but back to that error, do you know what it may be in reference to?

and also, you commented out that one line, do i not need that for the thing to start over if it is at the end of the slider/timeline?

Paul Ferrie
04-10-2008, 09:54 AM
I out the code into my flash to make sure it was all ok. i tested with AS2 and i got errors so i commented out some code to see if i still got the errors.
I got more...

So i then set it to export to AS3 and got no ore error but i forgot to uncomment the line i did.

i did not come acroos the error :
1083: Syntax Error: var is unexpected (var playSpeed =400)
Nor code i see var playSpeed =400 anywhere in your code. Am i going blind?

IamBadAtAS3
04-10-2008, 10:07 AM
first line of code at the top. maybe it was hiding on you?

Paul Ferrie
04-10-2008, 10:13 AM
Ah my mistake then
I still don't get that error when i test. i do get a whole bunch of other errors though.

Are you setting to export to AS2 or AS3?

IamBadAtAS3
04-10-2008, 10:21 AM
AS3

and some of my code is in other layers, but those errors have all been worked out (i think)

i am trying to get a flash file to resize symbols for CSV input amounts. would it be easier if i sent you a copy of my flash file for you to look at? (if you have a few minutes)

Paul Ferrie
04-10-2008, 10:29 AM
Sorry bud you probably no more about AS3 than me am afraid.

IamBadAtAS3
04-10-2008, 10:47 AM
no worries, thanks for trying!