A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: [F9/AS3] HelloWorld project

  1. #1
    Senior Member walnoot's Avatar
    Join Date
    Apr 2005
    Posts
    751

    [F9/AS3] HelloWorld project

    Since there's no AS3 forum and I know a couple of guys around here are already progressing in AS3 I hope you don't bother me asking a total newbie question on this.

    Here they give the really first start in AS3, the program that's always your first in every language:the HelloWorld application.

    They tell you to make a Greeter.as
    Code:
    package 
    {
        public class Greeter 
        {
            public static function sayHello():String 
            {
                var greeting:String = "Hello World!";
                return greeting;
            }
        }
    }
    and a HelloWorld.fla
    Code:
    var myGreeter:Greeter = new Greeter("Bob");
    mainText.text = myGreeter.greeting;
    in the HelloWorld.fla you drag a textfield on the stage and give it the instancename:mainText

    when I test the movie it says:
    Code:
    ArgumentError: Error #1063: Argument count mismatch on Greeter$iinit(). Expected 0, got 1.
    	at Timeline0_f9b48cb254eeb04dbca16453c75a97e/::frame1()
    I really want to take the time to intensively study AS3 in the upcoming years but for now I really don't understand what I do wrong, I did this tut three times over to ensure myself I didn't make any typo's.

    Thanks in advance,
    Wouter

  2. #2
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    Try this:

    var myGreeter:Greeter = new Greeter();
    mainText.text = myGreeter.sayHello();

  3. #3
    Senior Member walnoot's Avatar
    Join Date
    Apr 2005
    Posts
    751
    Code:
    ReferenceError: Error #1069: Property sayHello not found on Greeter and there is no default value.
    	at Timeline0_b4855bc6ae8f844b9ab15137b14a1f7c/::frame1()
    I can test a movie in flash as long as the .as-file is in the same folder am I?

  4. #4
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    Remove static:
    Code:
    public function sayHello():String 
    {
                var greeting:String = "Hello World!";
                return greeting;
    }

  5. #5
    Senior Member walnoot's Avatar
    Join Date
    Apr 2005
    Posts
    751
    Thank you, now I got something to start from. I must say that's a pretty buggy tutorial Macromedia presents us there. Thanks again.

    PS. Do you know if there's talking about an AS3-forum here on flashkit? Or can't they because it's not yet a launched thing?
    Last edited by walnoot; 08-05-2006 at 03:44 PM.

  6. #6
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    Quote Originally Posted by walnoot
    Do you know if there's talking about an AS3-forum here on flashkit? Or can't they because it's not yet a launched thing?
    Yes, AS3+Flex+Flash9 forum has been proposed several times. Its not so much that Flash9 is not out yet since Flex is out and it uses AS3 too, but so far there has not been enough interested members and they dont want to create forum for only few people. Anyone thinking AS3/Flash9/Flex forum is needed, please post in the feedback section.

  7. #7
    Senior Member walnoot's Avatar
    Join Date
    Apr 2005
    Posts
    751
    Ok, so maybe we all can reply in the following topic?
    we want an AS3-forum!

  8. #8
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    Moved to new AS3 forum.

    I have sent comment at the page
    http://livedocs.macromedia.com/labs/.../00000021.html
    describing all the bugs involving the tutorial.

    Not sure when it will apear there.
    Last edited by tonypa; 08-08-2006 at 02:52 PM.

  9. #9
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    Ah, my comment has been approved into MM livedocs to page about writing code to greeter.as file. The comment describes 3 steps to fix the helloworld tutorial so it works with F9.

  10. #10
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Page does not exist
    They don't like critique.
    - The right of the People to create Flash movies shall not be infringed. -

  11. #11
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    Quote Originally Posted by cancerinform
    Page does not exist
    They don't like critique.
    This page?
    http://livedocs.macromedia.com/labs/.../00000021.html

    Works for me. Can you access other parts of AS3 docs?

  12. #12
    hmm Pugger's Avatar
    Join Date
    Sep 2003
    Location
    Perth, Australia
    Posts
    616
    That is a shocking tutorial. wow

  13. #13
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    It is weird. When I pressed the link you first showed I got an error. Now when I press it again it is ok. Anyways, here is a very basic tutorial:

    http://flashas3.flashscript.biz/AS3_...roduction.html
    - The right of the People to create Flash movies shall not be infringed. -

  14. #14
    Senior Member walnoot's Avatar
    Join Date
    Apr 2005
    Posts
    751
    Quote Originally Posted by cancerinform
    It is weird. When I pressed the link you first showed I got an error. Now when I press it again it is ok. Anyways, here is a very basic tutorial:

    http://flashas3.flashscript.biz/AS3_...roduction.html
    Very nice! That's yours? Thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center