The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.34 / 5.00 31,296 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.07 / 5.00 10,082 ViewsHey, I'm in a situation where I need to acces a var (Boolean) that is situated on my main timeline (first frame)
I want to acces it in a bullet class. How would I do this?
I actually tryed this
root.LeanLeft:Boolean
But it doesn't work.
At 11/23/12 01:52 PM, benaerens wrote: Hey, I'm in a situation where I need to acces a var (Boolean) that is situated on my main timeline (first frame)
That raises the question why you use the timeline at all.
It is recommended to use a document class and reduce the code on timelines to a minimum.
I want to acces it in a bullet class. How would I do this?
There are several ways to do this.
The simples way is to pass it to a function of the Bullet class.
Please explain what this boolean variable is and what it should do.
There's no general answer to that question.
I actually tryed this
root.LeanLeft:Boolean
But it doesn't work.
The approach is not good.
You should not go somewhere (root in this case) and try to fetch a variable.
It's possibly not there, somewhere else, etc.
Generally speaking, the things a class needs are passed to it.
Hence more information is required about what you want to achieve.
Probably not good practice but have you tried?
MovieClip(root).variablename
At 12/1/12 09:56 AM, Psionic3D wrote: Probably not good practice but have you tried?
MovieClip(root).variablename
that's is horrible practice, and it's just as bad (actually, slightly worse) as what the OP suggested.
besides, AS3 doesn't have "root" - it has "stage"
Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P
At 12/1/12 11:15 AM, egg82 wrote: AS3 doesn't have "root"
it does
At 12/2/12 01:24 PM, milchreis wrote: it does
public class DisplayObject extends EventDispatcher implements IBitmapDrawable
/**
* For a display object in a loaded SWF file, the root property is the
* top-most display object in the portion of the display list's tree structure represented by that SWF file.
* For a Bitmap object representing a loaded image file, the root property is the Bitmap object
* itself. For the instance of the main class of the first SWF file loaded, the root property is the
* display object itself. The root property of the Stage object is the Stage object itself. The root
* property is set to null for any display object that has not been added to the display list, unless
* it has been added to a display object container that is off the display list but that is a child of the
* top-most display object in a loaded SWF file.
*
* For example, if you create a new Sprite object by calling the Sprite() constructor method,
* its root property is null until you add it to the display list (or to a display
* object container that is off the display list but that is a child of the top-most display object in a SWF file).For a loaded SWF file, even though the Loader object used to load the file may not be on the display list,
* the top-most display object in the SWF file has its root property set to itself. The Loader object
* does not have its root property set until it is added as a child of a display object for which the
* root property is set.
* @langversion 3.0
* @playerversion Flash 9
* @playerversion Lite 4
*/
public function get root () : flash.display.DisplayObject;
gotcha.
Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P
At 12/2/12 01:38 PM, egg82 wrote:At 12/2/12 01:24 PM, milchreis wrote: it doespublic function get root () : flash.display.DisplayObject;
no need to prove my words right, thanks anyway.
At 12/2/12 01:59 PM, milchreis wrote: no need to prove my words right, thanks anyway.
I had time, it was easy, and I thought it was interesting enough to share
Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P