Home > Uncategorized > 2 ways to instantiate and link document class in AS3

2 ways to instantiate and link document class in AS3

ok folks, today i’m going show you 2 ways to link class in as3

Method 1: Instantiating in AS file and link from Document class
Method 2: Instantiating in fla’s file main time line

Method 1: Instantiating in AS file and link from Document class

On the new fla file make sure the name of the Document class ‘s name is same with the AS file class you’ve created, be note  that class name must be same with the AS file name. By using this way every object has to be instantiate in the as file.

Method 2: Instantiating in fla’s file main time line

This method will be using time line to instantiate the object in the AS file,  first create the class with its method but remember don’t link the Document class in FLA file with the AS file class,or you will get error, instead of that you have to make it on the time line.

is easy for example

first you create you class like normally you create but you don’t have to import flash classes.  because we’ll instantiate directly to the FLA’s time line. but how to link it you said? easy

just instantiate on the main time line with the ‘new’ keyword:

for expample-   var yourval:classname = new classname();

That’s it simple and easy hope you enjoy.

Advertisement
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.