Skip to main content
Inspiring
February 7, 2010
Answered

Very basic noob question about understanding class creation

  • February 7, 2010
  • 1 reply
  • 481 views

After learing some procedural scripting I just started with understanding OOP and have a problem with a basic stuff like this. Why my Try.as below is not working when I type Try(1); in the main file. Output says: Type Coercion failed: cannot convert 1 to Try

package {
    public class Try {
        public function Try(some:Number) {
            some += 1;
             trace (some);
        }
    }
}

This topic has been closed for replies.
Correct answer kglad

use:


var s:Try = new Try(3);

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
February 7, 2010

use:


var s:Try = new Try(3);

emil emilAuthor
Inspiring
February 7, 2010

Thanks

... and shame on me.

kglad
Community Expert
Community Expert
February 7, 2010

you're welcome.