[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 216
  • Last Modified:

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

0
1Cougar
Asked:
1Cougar
1 Solution
 
Jones911Commented:
Whats the name of the array: gifArray?
0
 
1CougarAuthor Commented:
Hi and thanks for commenting.  I actually solved the problem.  I had to declare gifArray:* and it works.

Cheers!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now