A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: As2 code not working in as3

  1. #1
    Registered User
    Join Date
    Feb 2012
    Posts
    5

    As2 code not working in as3

    The following code
    listVariables(_root);

    function listVariables(mc:MovieClip): Void
    {whatever.......

    }

    works flawlessly in a as2 file but gives me the error 1046 saying sth like"not valid ...: Void",but if i change void to "string", it tells me there is noresult.Any ideas?

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Yes, learn a bit about as3. It is not as2, and you shouldn't expect as2 code to work.

  3. #3
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Now that I'm not on my phone, I can give you some more specifics.
    _root is now root. It is typed as DisplayObject, so if you want to use it as a MovieClip, you have to cast it as such.

    Void should not be capitalized.

    If you do declare that a function has a non-void return type, it must return something of the declared type.

Tags for this Thread

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