Be a Supporter!

document class

  • 249 Views
  • 2 Replies
New Topic Respond to this Topic
cristian123
cristian123
  • Member since: Feb. 5, 2011
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
document class 2011-02-06 20:07:08 Reply

i was following a tutorial on how to make a game and im stuck at a part it told me to create a new as file called Engine in your com/asgamer/basics1 folder. Add this code inside the as file could someone explain it to me

ProfessorFlash
ProfessorFlash
  • Member since: Oct. 6, 2007
  • Offline.
Forum Stats
Member
Level 32
Programmer
Response to document class 2011-02-06 20:21:38 Reply

You want us to explain tutorial instructions to you? Tutorials purpose is to teach you. If you don't understand the tutorial, then:

A) Find a new tutorial that explains it better.
B) Admit to yourself that you are too stupid to learn this and find something else to do.


You can solve pretty much any problem you may have with AS3 by consulting the AS3 Language reference.

SantoNinoDeCebu
SantoNinoDeCebu
  • Member since: Jul. 20, 2002
  • Offline.
Forum Stats
Supporter
Level 32
Programmer
Response to document class 2011-02-06 20:29:07 Reply

At 2/6/11 08:07 PM, cristian123 wrote: i was following a tutorial on how to make a game and im stuck at a part it told me to create a new as file called Engine in your com/asgamer/basics1 folder. Add this code inside the as file could someone explain it to me

To get your document class up and running -

To create a .as file just create a new .txt file or something and change the .txt to .as! or do it through flash - File > New > ActionScript File

name it whatever you want.. or Engine, Now in your .fla go to the properties panel, and look for 'Document Class:' - see the image ( I called mine Main) And input the same name you named your .as file. If you want to stick it in the same folder as that tutorial has told you, you will have to adjust what you write in the Document class box within flash to: 'com/asgamer/basics1/Engine'
If you want to leave it in the same folder as the .fla, then it will just be Engine.

I think you'll have to write some stuff in the document class before it compiles, so to check if it works first, here's a nice empty document class that does absolutely nothing!

package
{
    import flash.display.MovieClip;

    public class Engine extends MovieClip
    {
         public function Engine():void
         {

         }
    }
}

if you put this file into that folder, you'll have to add the folder path after the package so it'd be

package com.asgamer.basics1

document class