Solved

How do I correct this error, Incorrect number or arguments.

Posted on 2009-06-27
5
357 Views
Last Modified: 2013-11-11
I know I need something in the parenthesis of swfComplete when I run the function.  I've tried everything.

1136: Incorrect number of arguments.  Expected 1.

Thanks.

stop();
var request:URLRequest = new URLRequest("myURL");
var swfLoader:Loader = new Loader();
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfComplete);
var newID = 0;
function swfComplete(e:Event):String {
       MovieClip(swfLoader.content).innerVariable = newID; 
    	   
	return (newID);
	   
	  }
 
	   swfLoader.load(request);
 
swfComplete();

Open in new window

0
Comment
Question by:greg7740
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
mynamebecory2 earned 500 total points
ID: 24730101
If you want to call swfComplete yourself even though you've designed it for an event listener

"swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfComplete);"

you can just call it passing null or a new object of the specified parameter type as long as you're not using anything specifically set automatically in that parameter. That is to say, because you're not using the variable "e" inside your swfComplete function you can call it like this:

swfComplete( null );

or

swfComplete( new Event( "myDummyEvent ) );
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 24730310
just to add. why are you calling swfComplete?
seems pointless as mynamebecory said - you've created an event listener - so your swfcomplete will trigger automatically once your swf loader has finished loading.
0
 

Author Comment

by:greg7740
ID: 24731626
I'm new to actionscript and I was trying to use the value of the variable created inside the function.  How would I get the value of newID if I don't call the function.  Thanks.
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 24743367
you figured out how to get the ID i assume?
0
 

Author Comment

by:greg7740
ID: 24748602
yes, thanks Blue Genie.
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question