This was a case of stripping down a class that worked to make the example
smaller and easier for you all, then accidentally stripping out a necessary
detail. Here's a different stripped down and tested version, different
because I'm actually working with an mc not a string:
package
{
import
Hi susan,
In the 'other package' try:
import Star;
var myStar:Star = new Star();
addChild(myStar);
---
Why are you getting the error? .. because you are trying to cast 'nothing'
as a Star. Because Flash can't cast 'nothing' it tells you it's missing an
argument.
---
Regards, Benny
Star();
Again Susan, as others have said, you're still just calling Star().
What you need to do in your other class is call
var myStar:Star = new Star();
addChild(myStar);
By calling new Star(), the constructor function (the Star() function
inside your Star class) is called automatically and
On Fri, Mar 5, 2010 at 8:34 AM, Benny b.vlug...@hccnet.nl wrote:
Hi susan,
In the 'other package' try:
import Star;
var myStar:Star = new Star();
addChild(myStar);
That works.
---
Why are you getting the error? .. because you are trying to cast 'nothing'
as a Star. Because Flash
This reproduces the error:
package {
import flash.display.MovieClip;
import Star;
public class App extends MovieClip {
public function App() {
trace('app');
Star();
}
}
}
Susan Day wrote:
1136 Incorrect number of arguments. Expected 1. Star.as
What argument is it expecting?!
The object to convert to the type. You omitted the keyword new and got
the function style typecast.
___
Flashcoders mailing list
6 matches
Mail list logo