• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Display List?

New Here ,
Oct 18, 2014 Oct 18, 2014

Copy link to clipboard

Copied

Hello, I am new to actionscript and flash, I am also very stuck when it comes to display list. I have the following questions if anyone can tell me if my understanding is correct:

1. The way I understand it the stage is at the top of the hierarchy, nothing is above the stage any Display objects or Display object containers are children of the stage.

2. A movie clip on the stage (because of its nature to contain in itself graphics and other movie clips) are Display object containers, and any other movie clips in the movie clip are also Display object containers until we open enough movie clips inside other movie clips and find that the last one contains only a graphic, this last one is a Display Object, not a Display Object Container.

3. If you have a graphic on the stage it is a Display Object because it does not contain anything in itself.

4. If you have a movie clip on stage is it a child of the stage?, Also is any movie clip and any movie clips inside another movie clip a child of the previous movie clip?, I read somewhere that it is correct to call some grandparents and great grandparents, what does that mean, that a couple of movie clips inside an original movie clip means the original movie clip is a great grandparent?

Any help on this would be greatly appreciated, because I just cant get mu head around this,

George

TOPICS
ActionScript

Views

685

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 18, 2014 Oct 18, 2014

Copy link to clipboard

Copied

I can't say whether or not the page linked below will help clear things up since the things you are trying to differentiate are somewhat interchangeable as far as terminology goes.

http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e3e.html

DisplayObjects versus DisplayObjectContainers might be considered like fingers versus thumbs... all thumbs are fingers but not all fingers are thumbs...  all DisplayObjectContainers are DisplayObjects, but not all DisplayObjects are DisplayObjectContainers.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 18, 2014 Oct 18, 2014

Copy link to clipboard

Copied

Thank you. I am even more confused than before I know that a Display Object Container can contain a Display Object which may be a bitmap or graphic, but a Display Object cannot contain a Display Object Container, what I dont understand is if a Display Object Container contains a Display object is that a child of the Display Object Container.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 18, 2014 Oct 18, 2014

Copy link to clipboard

Copied

A DisplayObject contained by a DisplayObjectContainer is a child of it.

I am not sure why you are pursuing trying to gain a dintinctive understanding of the terminology (and I encourage it), but if you are wondering how things actually work out then why don't you do a little creative testing using the trace() function.

Start with an empty stage and only have the one line of code...

  

      trace(numChildren);

Run the file and see what the trace output indicates.

Draw a bunch of rectangles on the stage.   Run the file and see what the trace output indicates.

Select some number of the rectangles at once and right click the selection (or choose Modify) and choose Convert to symbol.  Choose to create a graphic symbol.  Run the file and see what the trace yields.

Do it again for a different group of rectangles and create a Movieclip symbol.  Run the file and see what the trace yields.

Give the movieclip an instance name and add a new trace command to check how many children the movieclip contains.

     trace(mcName.numChildren)

Experiment.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 18, 2014 Oct 18, 2014

Copy link to clipboard

Copied

Thank you that sounds like a great idea!!! I knew that the best way to learn was by experimenting and trial and error. Thank you again i will try

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 18, 2014 Oct 18, 2014

Copy link to clipboard

Copied

You're welcome

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 19, 2014 Oct 19, 2014

Copy link to clipboard

Copied

Something like this: .....

import flash.display.Shape;

var rectangle:Shape = new Shape();

var circle:Shape = new Shape();

rectangle.graphics.beginFill(0xFF0000);

rectangle.graphics.drawRect(0, 0, 100,100);

circle.graphics.drawCircle(40,40,100);

addChild(rectangle);

addChild(circle);

trace(numChildren);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 23, 2014 Oct 23, 2014

Copy link to clipboard

Copied

1. The way I understand it the stage is at the top of the hierarchy, nothing is above the stage any Display objects or Display object containers are children of the stage.

Really, the MainTimeline object is a child of the stage, and anything you put on 'stage' you really put in the mainTimeline object. If you trace(stage.getChildAt(0)) you will see object MainTimeline traced.

2. A movie clip on the stage (because of its nature to contain in itself graphics and other movie clips) are Display object containers, and any other movie clips in the movie clip are also Display object containers until we open enough movie clips inside other movie clips and find that the last one contains only a graphic, this last one is a Display Object, not a Display Object Container.

A MovieClip, or Sprite, is always a DisplayObjectContainer. A Bitmap, or Shape is always a DisplayObject.

3. If you have a graphic on the stage it is a Display Object because it does not contain anything in itself.

If it's a shape or bitmap yes, not a sprite or movieClip.

4. If you have a movie clip on stage is it a child of the stage?, Also is any movie clip and any movie clips inside another movie clip a child of the previous movie clip?, I read somewhere that it is correct to call some grandparents and great grandparents, what does that mean, that a couple of movie clips inside an original movie clip means the original movie clip is a great grandparent?

A MC on stage is actually a child of the MainTimeline, which is a child of the Stage. Nobody says grandparent etc. Child/parent is as far as it needs to go. Anything inside a container is a child of that container.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 23, 2014 Oct 23, 2014

Copy link to clipboard

Copied

Hello, thanks for writing,

1.That is the way I understand it too. That a stage is at the top of the hierarchy, anything on the stage is a child of the stage, and that any object on the stage is on the timeline and is a child of it. Also a MovieClip is a Display Object container and a display object but a Display Object cannot be a Display Object Container. A Display Object Container is a Display Object Container simply because it can contain other Display Object Containers and Display Objects, and that if it contains Display Object Containers they are children of the original Display Object Container, and if it contains a Display Object, its a child of the original MovieClip but the chain stops there.Any way that is what I understand. I am not sure that it is correct.

2. I realized after writing in another forum, and after getting an answer, that I have got ahead of myself a bit starting with the Display List. I was introduced to the Document Class, and then I realized that it was more important first to get a grasp of OOP, and it is HARD. I looked at the Actionscript reference and at the MovieClip Clip Class, which I am not even even sure that is a class, but it seems to be so, is a part of (I say part because I dont know how else to call it) the display package/class I am not sure what exactly it is. It seems to be a great,great,great,great,great,great,great grandchild of the display class, because it inherits or extends all these classes before it MovieClip Inheritance Sprite Inheritance DisplayObjectContainer Inheritance InteractiveObject Inheritance DisplayObject Inheritance EventDispatcher Inheritance Object.  So actually it seems that everything in the beginning of the Document Class is a class until you instantiate a class and thus create an Object.

I dont know this is how I understand it, Is it correct? I dont know, I am still reading and researching .

Kind Regards,

George

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 24, 2014 Oct 24, 2014

Copy link to clipboard

Copied

>>A Display Object Container is a Display Object Container simply because it can contain other Display Object Containers and Display Objects, and that if it contains Display Object Containers they are children of the original Display Object Container, and if it contains a Display Object, its a child of the original MovieClip but the chain stops there.Any way that is what I understand. I am not sure that it is correct.

Anything in a container, whether another container, or a simple display object, are children of the container they are in.

MovieClip is a class,it extends Sprite and a bunch of other classes, all the way down to the Object class. The Object class is the base class of every class in AS3. An 'object' is an instance of a class - any class. But it may be confusing at first to see the Object class and hear about objects in OOP. They are different... You can make an instance of Object, which is an object... like so: var a:Object = new Object();

Classes simply allow you to break your code down into manageable pieces that relate to each other. It's much nicer to have a dozen classes with a couple hundred lines in each class, than it is to have one bunch of code with thousands of lines in it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 24, 2014 Oct 24, 2014

Copy link to clipboard

Copied

Hi again. Yeah thats how I understand MovieClips and other Movieclips inside them. Objects and Classes and OOP is a bit more difficult for me. So what you are saying is that all these are Classes down to Object, and that this is just the display class, I know there are other classes that have the same classes in depth as in the display class and they all inherit from the previous class. So Object is a class, actually?

I read that in order to have an Object, as in the OOP terms, it is necessary to instantiate a class another words what you said var myObject:MovieClip = new MovieClip(); in this way a new instance of the MovieClip class is instatiated and now we have a MovieClip Object with a reference variable myObject which with the use of dot notation its properties can be accessed. These properties when I type a dot, the predictive code message shows all the properties that this object can use, and the classes from which it inherits these properties.

Regards,

George

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 24, 2014 Oct 24, 2014

Copy link to clipboard

Copied

Yup, all those are classes, down to and including Object. Each additional class extends the previous one, and adds additional capabilities. When you make an instance of MovieClip you have access to methods and properties of Object, EventDispatcher, etc. The reason you can add a listener to a movieClip is because it extends EventDispatcher.

>>These properties when I type a dot, the predictive code message shows all the properties that this object can use, and the classes from which it inherits these properties.

That depends on what editor you're using... using FlashDevelop you will get much more info than say using the built in editor.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 24, 2014 Oct 24, 2014

Copy link to clipboard

Copied

LATEST

I see. Thank you. So I can safely say that at least to some extent I got the hang of Display Object Container and Display Object, and children and parent and the classes and Objects.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines