PDA

View Full Version : help moving function out of document class...



jebediah
December 7th, 2008, 07:47 PM
I've managed to get my little flash app. working by mostly building everything in the document class file. Now I'm trying to get the various functions separated out into their own class files for better organization and extensibility. This is my first time working with AS3 and I'm slowly catching on.


I currently have a function in the document class:

package {
public class presPlayer extends MovieClip {
private function navFunc():void {

}
}
}


I've tried to move it into its own class so it looks like this:

package {
public class navFunc extends presPlayer {
public function navFunc() {

}
}
}


In this new configuration it throws the error "1136: Incorrect number of arguments. Expected 1."

I've not added arguments to the function.

What am I missing here?

Thanks,

Jeb

scottc
December 7th, 2008, 08:29 PM
get the line number from here.
http://www.kirupa.com/forum/showthread.php?t=313070

maybe your looking at the wrong class? perhaps its one that's being extended?



package {
public class presPlayer extends MovieClip {
public function presPlayer() {}//this one is the contructor, it has same name as the class.
//private function navFunc():void {
//we moving this function to other class as a constructor?

also your missing your constructor in the above class...

btw wrap your code when posting with [ as ][ /as ] tags.

jebediah
December 8th, 2008, 12:22 AM
Hi Scott, thanks for responding.

Here's the class:



package {

public class navFunc extends presPlayer{ //presPlayer is the document class

public function navFunc():void {
// functions stuff here. I've commented it all out to simply and it's still throwing error.

}
}
}


Here's the error description:

1136: Incorrect number of arguments. Expected 1.


The "source" of the error description is navFunc(); (I do have debugging permitted, it's line 33 in the fla, frame 1.

The function including the offending line:



function makeNav(event:MouseEvent):void{
navFunc();
}



Again, when navFunc(); was in presPlayer.as there was no issue. It only happened since I've moved it out into its own class.


Thanks,

Jeb