macromedia.director.basics
[Top] [All Lists]

Re: Control Panel: Rewind

Subject: Re: Control Panel: Rewind
From: "adam@blueapplestudio" <webforumsuser@xxxxxxxxxxxxxx>
Date: Thu, 29 Nov 2007 15:07:46 +0000 (UTC)
Newsgroups: macromedia.director.basics

I'm defining my variable after I use clearGlobals, but it seems that my array 
still "has no properties".  Not sure if I am using startMovie properly, but I 
believe I am (let me know if I'm not).

 There are no sprites or anything else in this movie; just the below code and a 
Hold On Current Frame behavior on frame 4.

 //***MOVIE SCRIPT
 //Creates a function that will clear & then define a variable, and also define 
a function.
 function startMovie() {
   //Clears global variables.
   clearGlobals();
   //Declares global variable
   gMyArray = ["A", "B", "C"];
 }
 //Creates a function that removes the last element from an array if the 
array's length is at least 2.
 function fRemoveLastElement(aTempArray){
   if(aTempArray.length > 1){
     aTempArray.length = aTempArray.length - 1;
   }
   trace(aTempArray);
 }


 //***BEHAVIOR SCRIPT ON FRAME 2
 function exitFrame(me) {
   //Removes the last element from the global array gMyTempArray.
   fRemoveLastElement(gMyArray);
 }


 //When this runs a Director error occurs:
 //Script error: TypeError: aTempArray has no properties
 //if(aTempArray.length > 1){


<Prev in Thread] Current Thread [Next in Thread>