Importing the Proper Classes into your Package

3
Importing Classes/Packages to Make your External ActionScript Files Work Properly ©2010 mkelly/robert morris university first of all, which Classes/ Packages does Flash need to make your external actionScript work and secondly, why? if you try to publish and you donʼt have your base Classes available for Flash to scrutinize, Flash will let you know: so thereʼs the which, and note that there may be several whichʼs. so what about the why? to keep your file size small and your execution speed quick, Flash operates on a need to know basis which means it only wants to carry the essential class definitions that it gathers from Packages (pathways) after you tell it to. so now you know you need to import the base MovieClip class and why. the import process itself almost always start out like this: or in some cases: so how do you know which one? and how do you know what comes next? if you want to know all about such package solutions... ...if you highlight , and hit F1 or (fn F1 if your hotkeys are disabled), Flash Help will open to:

description

how do you know which classes will be necessary to import into your external action script? where do you find them? why do you need them at all? how must they be written out? all these questions and other will be answered in this brief overview.

Transcript of Importing the Proper Classes into your Package

Page 1: Importing the Proper Classes into your Package

Importing Classes/Packages to Make your External ActionScript Files Work Properly ©2010 mkelly/robert morris university

first of all, which Classes/Packages does Flash need to make your external actionScript work and secondly, why?

if you try to publish and you donʼt have your base Classes available for Flash to scrutinize, Flash will let you know:

so thereʼs the which, and note that there may be several whichʼs.

so what about the why?

to keep your file size small and your execution speed quick, Flash operates on a need to know basis which means it only wants to carry the essential class definitions that it gathers from Packages (pathways) after you tell it to.

so now you know you need to import the base MovieClip class and why. the import process itself almost always start out like this:

or in some cases: so how do you know which one? and how do you know what comes next? if you want to know all about such package solutions...

...if you highlight , and hit F1 or (fn F1 if your hotkeys are disabled), Flash Help will open to:

Page 2: Importing the Proper Classes into your Package

you can also click on Packages above pretty much from anywhere in the Help menu to see the base classes hidden away in their proper Packages as on the next page.

so you can see some of the Package pathways above including flash.display and flash.events, two of the most popular ones.

remember flash.events means that there are two folders out there: one named flash, the other events that Flash will look into to find snuggly nestled inside the MovieClip.as class file.

Page 3: Importing the Proper Classes into your Package

if you , youʼll see among others under flash.display so now you know the proper pathway is flash.display.MovieClip.

an even better way is to type in and and F1 to get:

so now just type and you are good to go.

the same thing will be true for any other base Class that Flash tells you that you are missing.