473,326 Members | 2,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

How do I pass an array through a function call?

my code come up with an error #1010 undefined property.

Expand|Select|Wrap|Line Numbers
  1. import flash.events.MouseEvent;
  2. import flash.display.MovieClip;
  3.  
  4. var buttons:Array = new Array();
  5.  
  6. createButtons([ square1, square2, square3, square4, square5 ]);
  7.  
  8. function createButtons(buttons){
  9.  
  10. for (var i:int = 0; i<=buttons.length;i++){
  11.  
  12. buttons[i].addEventListener(MouseEvent.CLICK, clickButton);
  13.  
  14.  
  15.  
  16. }
  17.  
  18. }
  19. function clickButton(event:MouseEvent){
  20.  
  21.  var square:MovieClip = MovieClip(event.currentTarget);
  22.  
  23. trace(square.name);
  24.  
  25. }
  26.  
Nov 12 '12 #1
1 2144
Anas Mosaad
185 128KB
I believe you need to quote the string in line 6.
Expand|Select|Wrap|Line Numbers
  1. createButtons([ square1, square2, square3, square4, square5 ]);
  2.  
You need to change it to:
Expand|Select|Wrap|Line Numbers
  1. createButtons([ "square1", "square2", "square3", "square4", "square5" ]);
  2.  
Otherwise, you may need to define the square variables in your code.
Jan 5 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: mangi03 | last post by:
Hi, I came acrosss g++ compile errors whenever I make a function call by reference and found out from the test program that compiler is treating the function argument differently when another...
5
by: wilson | last post by:
Dear all, In this time, I want to pass array to function. What should I declare the parameter in the function?i int array or int array? Which one is correct? ...
9
by: ashok.anbalan | last post by:
Hi, Can someone tell me if the language imposes any restrictions on the maximum number of arguments that can be passed via a function call? Thanks, Ashok
13
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make...
4
by: _Mario.lat | last post by:
Hallo, I have a little question: In the function session_set_save_handler I can pass the name of function which deal with session. In Xoops code I see the use of this function like that: ...
1
by: Falko | last post by:
Hi there, I am currently translating a VB 6.0 application to .NET and have the following problem: The data structure I need to pass to a DLL function call has a structure variable inside its...
4
by: golubovsky | last post by:
Hi, Is there an easy way to construct a function call out of a function and an array of actual arguments? e. g. given a function `fun' and an array I need to obtain equivalent of...
7
by: lordkain | last post by:
Hello all, I have a problem which I cant seem to solve, I dont know if it is solvable.. it should though. What I want is to call a function, whith x arguments on base of an xml file. In the...
5
by: marcsirois | last post by:
I have an SQL Query that looks like this. I simplified it for the purpose of this example, but it's still a runnable query SELECT TOP 1 FundedPositions.PositionNumber AS , (select top 1...
10
by: primpa | last post by:
Hi I have a question when I call a function and creating a pointer to a 2D array in the main function. "Main" call a function to input data in a array witch is declared in the main function. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.