ActionScript 3.0 :: Getting A DisplayObjectContainer Name?
Jul 15, 2009
I'd like to know if is possible to trace the name of a container object using the contained object.Something like:
mc1 = new Movieclip();
cont1.addChild(mc1);
trace ("container object is: " + mc1.function_I_need());
[code].....
View 1 Replies
Similar Posts:
Jul 2, 2009
I'm creating an object that's only purpose is to hold a few other display objects, so all I need is a super class that can hold display objects. I don't want to use the sprite class because it has so many functions and properties that I don't need. if I can't use DisplayObjectContainer as a base class then what class should I use?
View 1 Replies
Oct 30, 2009
in ActionScript 3, if I loop through the children of a movie clip, it will return a DisplayObjectContainer, which is a list of DisplayObjects. However, the AS3 typeof cannot identify MovieClip as MovieClip is now an object, instead of a data type. How can I correctly identify MovieClip?I found 3 solutions online: First set the MovieClip name to a specific name, then in the iterate process, check the name of children using child.name.indexOf("specificName") > -1
Solution 2:use child.hasOwnProperty("numChildren") to identify a MovieClip
Solution 3: use 3rd party plug-in like FlashDevelop
View 2 Replies
Apr 29, 2011
I'm trying to get a class file from Flash into Builder.Everything in that class sits inside a Sprite called mainContainer. Now I'm trying to get that `mainContainer' which hold the graphics for the class into a Flex Application.This is proving to be a problem as their are many various ways of doing it (it seems going by numerous Google searches).First off I declare an MXML Canvas with an Image inside it (as I read would work):
<mx:Canvas x="268" y="10" width="756" height="680" id="canvas">
<mx:Image id="spriteLayer" x="268" y="0" width="756" height="700" scaleContent="false" autoLoad="true">
[code].....
View 3 Replies
Jan 16, 2009
I am converting a DisplayObjectContainer as a Bitmap using BitmapData.The DisplayObjectContainer has many DisplayObjects. I want to exclude few DisplayObjects while i tranform into Bitmap.Therefore the bitmap should not have that particular displayobjects alone.
View 7 Replies
Jan 7, 2010
[code]...
The above code is not working, I am getting an error.
View 1 Replies
Jan 27, 2009
Code:
import flash.display.Sprite;
var sp1:Sprite = new Sprite( );
var sp2_1:Sprite = new Sprite( );
[Code]....
I'd assume from this that there is no correcting done for children with the same name being added to the same parent. I ask this question because I'm creating a structure that needs to mimic the display list and I'd like to keep behavior consistent.
Another question: I'd assume internally the children are saved in something similar to a Dictionary object, does anyone know if this is true? And then getChildByName simply does a foreach loop and returns the first match on a name?
View 2 Replies
Oct 8, 2009
A DisplayObjectContainer's dimensions change based on its contents.
That can be a LOT of contents, many of them with visible = false or masked, thus making them hidden. Is there a way to get only the visible contents of a DisplayObjectContainer similar to a TextField has the textHeight property, which gives you the exact dimension of what you see on-screen.
View 2 Replies
Apr 19, 2010
I have a display object container and I am trying to add a paste event to it. But the event is not being registered. The documentation at liveDocs mentions that classes that derive from Interactive objects can dispatch paste event but I dont understand why it wouldnt work for me.
View 1 Replies
Dec 9, 2009
is it possible to clip children that are part of a DisplayObjectContainer? If I have a parent object with size x 100, y 100, width 100, height 100 and a child that has the coordinates x -50, y -50, width 100, height 100, I can still see the full child staying at x 50, y 50, but I want the child to be cut off by the parent.
View 3 Replies
Oct 28, 2009
I have a class which will contain exactly one child, no more, no less, and other classes are not allowed to change that fact.
I could throw error messages every time a child is added or removed by overriding the default properties, but I don't want the object to be treated as if it were a DisplayObjectContainer.
I want it to look like only a DisplayObject, yet I still want to add a child to it in private.
View 6 Replies
Jan 21, 2010
I'm working on a class that let's you use "addChild" to add children to it. In all aspects, it's treated like a regular class, the only difference is that it doesn't really add them. It only draws the BitmapData of them and displays that, which doesn't make a huge difference for the user, but might make a difference for performance, at least the way I am planning to make it.
Now, if users add a regular old Sprite or other DisiplayObject to the container, I have overridden the function to draw the BitmapData of the item, and store the item in an array.The problem is, if the user want to do something like "sprite1.parent", since the Sprite technically isn't on the display list, the parent property will be null. I can't override the passed in sprite's properties, right? Is there any way around this?
View 1 Replies
Jan 27, 2011
I would like to know the internals of that method, in other words what exactly happens when I call that method. If someone can explian it with a list 1,2,3... would be great. including events..
and the addElement method too, if is possible.
View 1 Replies
Jan 30, 2010
look at the following codes first
var sp:Sprite = new Sprite();
trace( sp.width ); // the result will be 0
var mc:DefinedMC = new DefinedMC(); // assume that DefinedMC is derived from movie clip, and the width of mc is 100
sp.addChild(mc);
trace( ap.width ); // the result will be 100
[code].....
so the size of an instance of Sprite is affected by its children.is there any class derived from DisplayObjectContainer whose size is not affected by its children, or is there any method that could make the size of Sprite is not affected by its children.
View 7 Replies