PDA

View Full Version : Document Class and fl and flash packages


tetru
06-19-2009, 11:06 PM
Hello ,

I have stumbled upon the document class.On Adobe's website i can't realy find a good explanation.What i have understood 'til now is that the document class allows you to write code in an FLA file instead of writing it in the main time line. And needs to extend the MovieClip or Sprite classes depending on the functionality I want. >_> .Is there more to that ?

Where is the document class

What's the difference between the fl and fl packages?
Where can find a neat and clean functionality of all the stuff that's in fl and flash packages.



Thank you .

-Ev-
06-20-2009, 05:03 AM
You've got a smattering of questions here, I hope I answer them all.

I have stumbled upon the document class.On Adobe's website i can't realy find a good explanation.What i have understood 'til now is that the document class allows you to write code in an FLA file instead of writing it in the main time line. And needs to extend the MovieClip or Sprite classes depending on the functionality I want. >_> .Is there more to that ?

The document class is a class definition (in an external .as file) which is automatically instantiated to become the first child of your flash movie's Stage. You link it to your .fla by putting the full package name of the class in the "Class:" field of the properties panel. You're correct in saying it should extend Sprite or MovieClip. When developing in the Flash IDE, the main timeline is the instance of your document class. Anything placed on the main timeline becomes a public property of your document class instance.

Comparing a document class to any other class extending MovieClip or Sprite would show no obvious differences. For all intents and purposes, you build it like you would any other class. However, the document class can not be manually instantiated by any other code. It becomes reserved for use by the SWF's root. You won't get any compiler errors if you write code that tries to create a new instance of the document class, but you'll get a runtime error about the SWF containing invalid data. Because of this, the one rule with writing document classes is that the constructor should not have any parameters. But since you have no way to pass anything to it, I doubt you'd try this anyway.


What's the difference between the fl and fl packages?
I assume you mean the fl and flash packages? The fl package contains classes that mostly deal with the prebuilt components that come with Flash. The flash package contains all the Adobe-developed classes that form the base framework of ActionScript. The two packages are just how they chose to organize things. Beyond that, there's no functional difference.


Where can find a neat and clean functionality of all the stuff that's in fl and flash packages.
Not exactly sure what you mean, but here is the AS3 online language reference. It contains documentation of every class available to Flash in AS3:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/
And this is the Flex3 documentation. All of the above plus all the Flex classes (the mx package):
http://livedocs.adobe.com/flex/3/langref/index.html

tetru
06-20-2009, 07:41 AM
Post written at 2 o'clock in the morning.:D

I am from Romania .

Where can I find a neat and clean functionality map of all the stuff that's in fl and flash packages? That's what i ment .Sorry for the typos

-Ev-
06-20-2009, 05:31 PM
Not sure what you mean by a functionality map.

senocular
06-20-2009, 06:05 PM
Where can I find a neat and clean functionality map of all the stuff that's in fl and flash packages? That's what i ment .Sorry for the typos

Hopefully the packages themselves are organized by functionality already.

You might also want to try searching the web for AS3 posters - there should be some PDFs out there of posters that kind of visually assemble the classes by type