Re: [Flashcoders] Problem Importing Class

2010-03-05 Thread Susan Day
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 flash.display.MovieClip;
 public class Star extends MovieClip
{
 public function Star()
{
var star:MovieClip = new MovieClip();
addChild(star);
star.graphics.lineStyle(1, 0xFF);
star.graphics.beginFill(0xFF);
star.graphics.moveTo(144, 277);
star.graphics.lineTo(188, 184);
star.graphics.lineTo(288, 170);
star.graphics.lineTo(216, 98);
star.graphics.lineTo(232, 0);
star.graphics.lineTo(144, 47);
star.graphics.lineTo(55, 1);
star.graphics.lineTo(72, 100);
star.graphics.lineTo(0, 170);
star.graphics.lineTo(99, 184);
star.graphics.endFill();
}
}
}

This code works by itself. However, when I call it in the other package with
the following lines:

import Star;
// var star:Sprite = new Sprite();
(whether commented out or not)
Star();

I get the error:

1136 Incorrect number of arguments. Expected 1. Star.as

for the last of the lines in the importing pkg. What argument is it
expecting?
TIA,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Problem Importing Class

2010-03-05 Thread Benny
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

-Oorspronkelijk bericht-

..

This code works by itself. However, when I call it in the other package with
the following lines:

import Star;
// var star:Sprite = new Sprite();
(whether commented out or not)
Star();

I get the error:

1136 Incorrect number of arguments. Expected 1. Star.as

for the last of the lines in the importing pkg. What argument is it
expecting?
TIA,
Susan

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Problem Importing Class

2010-03-05 Thread Merrill, Jason
 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 will run.


Jason Merrill 

Bank of  America  Global Learning 
Learning  Performance Solutions

Join the Bank of America Flash Platform Community  and visit our
Instructional Technology Design Blog
(note: these are for Bank of America employees only)

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Problem Importing Class

2010-03-05 Thread Susan Day
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 can't cast 'nothing' it tells you it's missing an
 argument.


Gotcha.
Thanks,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Problem Importing Class

2010-03-04 Thread Keith Reinfeld
This reproduces the error: 
 
package { 
import flash.display.MovieClip; 
import Star; 
public class App extends MovieClip { 
public function App() { 
trace('app'); 
Star(); 
} 
} 
} 
 
This fixes it: 
 
package { 
import flash.display.MovieClip; 
import Star; 
public class App extends MovieClip { 
private var _star:Star; 
public function App() { 
trace('app'); 
_star = new Star(); 
} 
} 
} 
 
Regards,

Keith Reinfeld
Home Page: http://keithreinfeld.home.comcast.net


 -Original Message-
 From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-
 boun...@chattyfig.figleaf.com] On Behalf Of Susan Day
 Sent: Thursday, March 04, 2010 10:03 AM
 To: Flash Coders List
 Subject: [Flashcoders] Problem Importing Class
 
 Hi;
 I have this line in the importing package:
 
 import Star;
 
 and this in the function of the same package:
 
 Star();
 
 Star package has this code:
 
 package
 {
 import flash.display.MovieClip;
  public class Star extends MovieClip
 {
  public function Star()
 {
 trace('star');
 }
 }
 }
 When I run the importing package, I get this error:
 
 1136 Incorrect number of arguments. Expected 1. Star.as
 
 What argument is it expecting?!
 TIA,
 Susan
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Problem Importing Class

2010-03-04 Thread Henrik Andersson

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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders