Solved

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

Posted on 2009-06-27
5
356 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
  • 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

830 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