Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 81557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:28:43+00:00 2026-05-10T21:28:43+00:00

In trying to learn how to create objects in ActionScript, I have had no

  • 0

In trying to learn how to create objects in ActionScript, I have had no success. One thing that I have noticed is that there seems to be a billion different ways of doing it. Even if none of them have worked for me. This is really confusing me, and I don’t know which approach to try to debug.

The approach that seems to come up most often is:

function myClass() {    this.val = 1; }  var test = new myClass(); trace(test.val); 

But this just gives me compiler errors no matter how simple I make it, and it makes no sense to me that a function could be an object. If the function is an object, where does ‘this’ point when it is in a function in a function (that is being interpreted as an object).

Another way that seems to come up somewhat less often is:

class myClass {    function myClass() {        this.val = 1;    } }  var test = .... 

This gives me compiler errors as well, and seems more formal. But I can find very little documentation comparitivley. Most guides are either very simple, or assume that you are talking about the built in objects.

A third way that came up was to create a

 new Object();

in a function, add all the things you wanted and return it. Seems logical. But I have read all sorts of things that mention prototypes, and it seems like an object created this way would be ill suited to be a prototype. But really I am just very confused.

I also came across something saying that Object syntax was different between AS2, and AS3, but nothing more than that.

How am I supposed to create objects? What are the best practices, and for the love of god does somebody know where I can find an in depth tutorial? (my google-fu is evidently weak)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T21:28:44+00:00Added an answer on May 10, 2026 at 9:28 pm

    The class syntax between AS2 and AS3 is indeed different. For AS3 the syntax looks something like the following:

    package somePackage {      public class SomeClass {         public function SomeClass() {          }     } } 

    By way of explanation, a package is a wrapper that can contain multiple classes so you have to declare what package contains each class definition.

    A class requires a constructor function. In most languages the name of the constructor function is the same as the name of the class. This is the case in ActionScript.

    To call an instance of your class would look something like this:

    package somePackage {      public class OtherClass {         public function OtherClass() {             var something = new SomeClass();         }     } } 

    I’ve got my AS3 reference sitting in front of me so I feel pretty confident with the code snippet above, but unfortunately my AS2 reference is at work but the code should look something like the following:

    class ThirdClass {     public function ThirdClass() {      } } 

    And then to instantiate a variable should look something like this:

    var third = new ThirdClass(); 

    Please not that the examples provided do not use strong typing which I would recommend using whenever possible in your ActionScript efforts.

    While I would strongly recommend that you pick a copy of Essential ActionScript 2.0 and/or Essential ActionScript 3.0, I have found the following links for beginning tutorials:

    Beginning Flash and ActionScript Tutorials

    More Beginner Tutorials

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 51k
  • Answers 51k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer The most reliable way is to provide it yourself. The… May 11, 2026 at 6:21 am
  • added an answer This is more of a style question than anything else.… May 11, 2026 at 6:21 am
  • added an answer You'd contribute to MediaWiki. However, I strongly suspect you won't… May 11, 2026 at 6:21 am

Top Members

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.