styleBunny
Technical User
Hi Guys,
I am trying to use an array to store numbers generated at random, using the below script:
function mouseUp(Javatest) {
//javascript
var myArray = new Array();
Javatest = test
myArray.push(Javatest);
trace(myArray);
}
Where 'test' contains the randomly generated number during a mouse down event.
Tho this creates a new array called myArray each time, and the value from the previous array is lost.
i tried to create the array "myArray" as an exit frame event, earlier in the movie like so:
function exitFrame(me) {
//javascript
var myArray = new Array();
}
When it comes time to access myArray, it says "reference error, myArray is not defined".
So i presume i need to make the scope of myArray global?
Any help and love would be appreciated
This is the first time i have used js in director.
Paul.
I am trying to use an array to store numbers generated at random, using the below script:
function mouseUp(Javatest) {
//javascript
var myArray = new Array();
Javatest = test
myArray.push(Javatest);
trace(myArray);
}
Where 'test' contains the randomly generated number during a mouse down event.
Tho this creates a new array called myArray each time, and the value from the previous array is lost.
i tried to create the array "myArray" as an exit frame event, earlier in the movie like so:
function exitFrame(me) {
//javascript
var myArray = new Array();
}
When it comes time to access myArray, it says "reference error, myArray is not defined".
So i presume i need to make the scope of myArray global?
Any help and love would be appreciated
Paul.