Solved

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

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
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…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

759 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

21 Experts available now in Live!

Get 1:1 Help Now