">'); win.document.writeln(''); win.document.writeln(''); }
 

The Indefinite Article.

Thursday, December 15, 2005

Syntax Errors

I hate syntax errors.

UPDATE: Upon todd's request, i added a small reset button so that if you blow it up real big and then scroll around and then scroll back down and lose the iamge outside of the screen, it'll bring you right back to where you started.

I created a slider that would control the scale of a movie clip, but had some difficulty sending the scale value to a dynamic text field on the stage that was created at author-time. I kept getting a syntax error with this command:

//percent being a variale that holds the scale value
scaleText_txt.text = "Scale value: " + percent + " %";

Turns out that this works perfectly for dynamically placed text boxes, but not for text boxes that are placed there at author-time using the GUI tools. The correct syntax, it turns out, is:

scaleText_txt.text = 'Scale value: ' + percent + ' %';

Apostrophe's and not quotes? Is this subtle difference documented somewhere? cause i can't remember running into this before.

UPDATE: before the previous code, i had a trace command that would send the value to the output panel, coded as such:

trace('percent '+percent);

this has always worked. on a scooby-doo-like hunch, i changed the apostrophes to quotes and it still worked. so then i changed apostrophes to quotes in the scaleText_txt box and THIS TIME IT WORKED! so, the moral of the story is stay consitent. If it works, keep on doing it. This really throws me for a loop as i thought that all characters had a really specific function (i.e. square brackets as opposed to curly brackets as opposed to parenthesis) and couldn't be interchanged.

UPDATE 2: I updated the file so that you can now scroll the image once you enlarge it (up to 999%) and scroll around the body. Eventually, the user will bea ble to choose a body part/area and get some displayed information.

3 Comments:

  • is this that question you threw out there that you were waiting on a response for?
    this would drive me mad

    By Blogger CarolinaDivina, at 1:35 PM  

  • no. it was something i encountered after i had the scale slider working.

    By Blogger Killy, at 2:07 PM  

  • wow. that is good stuff.

    one little observation: if you make the image ver large, then move it around, specifically down, when you re-enlarge it the image shrinks off the screen.

    but, that is still very good work man.

    By Blogger todd, at 6:36 PM  

Post a Comment

<< Home