|
-
If you can explain briefly...
Why/What are you suggesting should go in the document class? What are the benefits of the document class vs. what I'm trying to do?
Reading a bit, I see that "the document class serves as a shortcut for creating an instance of a MovieClip or Sprite and adding it to the display list..."
Does this mean if I use a document class, I don't have to declare stageRef = stage from the timeline?
I'm not sure I need anything in the "global scope" as you put it... it's just what I was used to in AS2.0, because you could declare a function or variable as global by using "_global"... so usually I would just define my global stuff on Frame 1 of the Main Timeline
So in attempting to transition over to AS3.0, I did a few searches on "AS3 global functions and variables". And the common solution was a custom class.
To my thinking... I want variables within the global scope so that I don't have to write (using AS2.0 timeline coding logic):
PHP Code:
MovieClip(parent.parent.parent.parent.parent.parent).myVar1 = "Hello";
Similarly, if I have a function that isn't necessarily project specific... such as a function that converts us dollars to bhutanese money... I don't want to have to write:
PHP Code:
MovieClip(parent.parent.parent.parent.parent.parent).fConvertUSDtoBHU(263.00);
Now, if I had several common functions, I don't think I'd necessarily want a ".as" file for each... so why not bundle them into 1 ".as" file which I can just reference as needed from ANY .fla:
PHP Code:
myGlobal.fConvertUSDtoBHU(263.00);
If it's flawed logic, I'd love to hear why, or how anybody would handle a set of functions which may or MAY NOT be needed in any given project?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|