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!
//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

Open in new window

1CougarAsked:
Who is Participating?
 
1CougarConnect With a Mentor Author Commented:
Hi and thanks for commenting.  I actually solved the problem.  I had to declare gifArray:* and it works.

Cheers!
0
 
Jones911Commented:
Whats the name of the array: gifArray?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.