p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning ActionScript 2.0 (http://p2p.wrox.com/forumdisplay.php?f=256)
-   -   pg 49 Photo Viewer script does not work (http://p2p.wrox.com/showthread.php?t=51550)

flashfreelancer December 14th, 2006 12:13 PM

pg 49 Photo Viewer script does not work
 
What's going on guys? I can't afford these scripting mistakes. This is the second one and I'm on page 49!!!

The "trace" command is undefined all three times. I've triple-checked the code on the .as file. Here is the code:

var photoArray:Object = new Object ();

photoArray["weddingPhoto1"]=newObject();
photoArray["weddingPhoto1"].fileName="weddingPhoto1.jpg";
photoArray["weddingPhoto1"].fileSize=150;
photoArray["weddingPhoto1"].description="Exchanging of the rings.";

photoArray["westIndiesVacation1"]=newObject();
photoArray["westIndiesVacation1"].fileName="vacation1.jpg";
photoArray["westIndiesVacation1"].fileSize=64;
photoArray["westIndiesVacation1"].description="Arriving at the airport in sweltering heat.";

trace(photoArray["weddingPhoto1"].fileName);
trace(photoArray["weddingPhoto1"].fileSize);
trace(photoArray["westIndiesVacation1"].description);

jberg December 15th, 2006 05:15 PM

This appears to be a recurrence of the error you found in the try it out on page 73.

In the book, the syntax is photoArray["weddingPhoto1"]=new Object();

Somehow we lost a space character again after the new keyword. I am looking for where this might have occurred elsewhere.

flashfreelancer December 16th, 2006 02:27 AM

You're right. Thank you. I guess a space is necessary on some lines of code. I thought it wasn't because there was a statement made on page 25 (WHITE SPACE) that stated that white spacing was more a personal preference issue rather than a necessity on some lines of code.


jberg December 16th, 2006 12:21 PM

Right on. You are correct. I hear what you're saying about the white space and our statements about it in chapter 2. I will confer with Nathan about adding a note in errata to clarify the use of minimum white space where required by instructional keywords. Examples of such keywords are var, new, return, delete, as well as class keywords such as get, set, extends, etc.








All times are GMT -4. The time now is 05:51 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.