Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
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 goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
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.

895 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now