Mailing List
Home
Forum Home
Flash Pro
Subjects
Firework Effect
setInterval bug identified and fixed
setInterval bug identified and fixed
ScrollPane component doesn 't auto update
Help: MX 2004 How to script a print button to print the entire sli
Event Dispatcher between classes
memory management removeMovieClip /
MX2004 Dataset itemClassName
Order of events per frame
XML to Object help
Textfield prototype question
Flash and QuickTime VR
Reading and displaying RSS feeds in Flash MX
Flash MX 2004 Sucks
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash Interface with 10mb xml file
Web Service Results
Listener Object 's best practice
 
Eval in Flash 5 vs. Flash MX

Eval in Flash 5 vs. Flash MX

2004-04-07       - By Stocke, Michael (M.J.)

 Back
Reply:     1     2  

Good afternoon group.  I have an obscure problem regarding using the
eval command in Flash 5 vs. Flash MX.  I am using a script that was
written by someone else to create a dynamic Flash quiz using XML.  The
movie loads 2 files using the include command.  One of the files is
throwing an error when I publish the movie.  Here is the relevant code:

...
XMLnode.prototype.setVars = function (prevObj) {
  if (this.hasChildNodes() && this.firstChild.nodeType == 1) {
    if (prevObj == null) {
      if (eval(this.nodeName) == null) {
        //eval(this.nodeName) = new Array(new
Object());
        new Array(new
Object(eval(this.nodeName)));
      } else {
        eval(this.nodeName).push(new Object());
      }
    } else {
      if (prevObj[this.nodeName] == null) {
        prevObj[this.nodeName] = new Array(new
Object());
      } else {
        prevObj[this.nodeName].push(new
Object());
      }
    }
...

Apparently Flash 5 doesn't like this line:

eval(this.nodeName) = new Array(new Object());  ...It says that the left
side of the equation must be a variable name.

I've tried re-writing it like this:

new Array(new Object(eval(this.nodeName))); ... and it compiles, but the
movie doesn't run properly

I search extensively for the proper code for this situation to no avail.
I don't know enough about the differences between Flash 5 Actionscript
and Flash MX Actionscript.  Any assistance would be appreciated.

Mike Stocke
Ford Retailer Education and Training
(313) 32 -23721



[Non-text portions of this message have been removed]



-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Server geeks, take heart! If you're sick of wading through
animation & graphics instruction for relevant info., then
Nate Weiss' Macromedia Flash MX Professional 2004 for Server
Geeks is for you. Leave designing to designers and dig into
core concepts to create rich user interfaces, online
advertising, and more.  See www.peachpit.com for more info.
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/FLASHmacromedia/

<*> To unsubscribe from this group, send an email to:
    FLASHmacromedia-unsubscribe@(protected)

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/