1Cougar
asked on
AS 3.0 - passing Array problem
Hello,
I am trying to pass two arrays to a function in an external class, which will take the array data and show gifs/play audio, take user input and store in an array to pass back to main movie. I have checked and the arrays do contain data in the main movie, but I am doing something wrong when trying to access the array data in the external function. My comments are in the code snippet below.
I hope someone can help me!!
Thanks and cheers!
I am trying to pass two arrays to a function in an external class, which will take the array data and show gifs/play audio, take user input and store in an array to pass back to main movie. I have checked and the arrays do contain data in the main movie, but I am doing something wrong when trying to access the array data in the external function. My comments are in the code snippet below.
I hope someone can help me!!
Thanks and cheers!
//in main FLA, where mySectionTest is an instance of my external class and playSect is the //function in my class:
myData=mySectionTest.playSect(testcounter,this["gifArray"+testcounter],this["questions"+testcounter]);
//function below is the one it calls but the trace statement in onTimer shows the array length //questions.length to be 0, when it should be 4.
public function playSect(sectIn:int,gifArrayIn:Array,questionsIn:Array):Array {
var gifArray:Array=gifArrayIn;
var questions:Array=questionsIn;
myData.section=sectIn;
playMe();
return myData;
}
public function playMe():void {
var timer:Timer=new Timer(questionDelay,1);
timer.addEventListener(TimerEvent.TIMER,onTimer);
timer.start();
}
public function onTimer(evt:TimerEvent):void {
var d:int=arraycounter-1;
trace("testcounter Timer:"+ questions.length);
///etc
Whats the name of the array: gifArray?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.