Hi,
I'm just starting out in as3 and for the life of me can not see how to create an instance on the stage of a symbol in the library by calling a function which resides in as file.
My library symbol has linkage (Class: newsButton, Base class: flash.display.MovieClip)
On the timeline in the fla file I know how to create an instance of it:
Code:
//add news buttons to the stage
var _newsButton:newsButton = new newsButton();
addChild(_newsButton);
_newsButton.x = 66;
_newsButton.y = 287;
What I'd like to do instead is place a function on the timeline called newsButton() that will read from a package where the function is defined (as file) and here's where I'm at:
On the timeline:
Code:
import com.bosie.*;
newsButton();
AS file in directory com.bosie:
Code:
package com.bosie {
import flash.display.MovieClip;
public class newsButton extends MovieClip {
private var _newsButton:newsButton;
public function newsButton() {
_newsButton = new newsButton();
trace('newsButton() function called');
addChild(_newsButton);
_newsButton.x = 66;
_newsButton.y = 287;
}
}
}
The problem is, when I run the movie I get:
"Incorrect number of arguments. Expected 1"
Have I got this completely backwards or which arguments do I need to pass in the function?