displayobject

Multiple viewports of the same DisplayObject

Is it possible to have multiple view of the same display object? (e.g. same-computer multi-player game using split screen) The sample code that failed to work follows: var content: Sprite = new Sprite(); var v1: Sprite = new Sprite(); var v2: Sprite = new Sprite(); with(content.graphics) { lineStyle(2, 0xff0000...

Is there a way to export a DisplayObject's vector data?

Flex gives the ability to export a display object as a bitmap as follows: var bitmapDataBuffer:BitmapData = new BitmapData ( displayObject.width, displayObject.height, false); bitmapDataBuffer.draw ( displayObject, displayObject.transform.matrix); Is there a method to export a display object as a vector graphic instead of ...

Workarounds for setting the size of an empty display object?

I want to create an invisible drawing surface that sits over top of an image. This drawing surface would be in charge of taking mouse input and passing the coordinates along to a sprite that sits on the layer between the drawing surface and the image. The drawing surface is an empty Sprite. According to the docs, a display object that...

Flex: DisplayObject Singleton

Hi, I want to display an Flex component in several different places through out the application. And it should be the same instance of the component, but not the copies. So I think of making the Component as an Singleton. But the problem is : when I do something like this : var vb1: VBox = new VBox(); var vb2: VBox = new V...

Getting a Specific Object from a Loader in Actionscript 3.0

Hello. I am learning ActionScript 3.0 and I am seeing this paradigm often: package util { import flash.display.Sprite; import flash.display.Bitmap; import flash.display.Loader; import flash.display.LoaderInfo; import flash.net.URLRequest; import flash.events.Event; public class BitmapLoader extends Sprite ...

Identify MovieClip in AS3 among DisplayObjectContainer

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: Solution 1 (the sol...

Getting error when using the removeChild method

Happy Pre-Halloween everyone :) My issue today is a DisplayObject error I'm getting when remove a child object. I have code that will launch(addChild) a video container and video controls as well as add a close button. Now the close button works fine and everything, removing the video and controls and I'm able to choose another video ag...

AS3 using a Matrix to "scale" an object from its "center"

Hi all, Here's something I'm trying to figure out concerning display objects in ActionScript3 / Flex. Let's say you have a display object who's registration point is in the top left and you want to scale it from its center (middle of the display object), How could you easily acheive this with the flash.geom.Matrix class Thanks for you...

Bottom most DisplayObject not showing up in Flash swf

In Flash CS4 I have a MovieClip called LoginForm which contains two text inputs (name and password), a button (sign in) and some error text. For some reason, the bottom most object will not show up in the swf. I could add as many buttons, movie clips or shapes as I want and whatever I sent to back will not show up. Also, I know that th...

Any AS3 alternatives to Colin Moock's approach to visible width/height of DisplayObject?

Has anyone got any alternatives to what Colin Moock has coded to GET VISIBLE WIDTH/HEIGHT OF A DISPLAY OBJECT in ActionScript 3? That esp. in perspective of DisplayObjects that have 3D transforms applied and visible dimensions of which you need to consider for a calculation. Any leads would be appreciated. ...

Deleting DisplayObject Instances in Adobe AIR

Hi Everyone, I just have a query on deleting displayobject instance. Let me elaborate on this: I had created a custom component called ‘PanelItem’ (which basically contains a Text Area and a close button in a Panel container) Then in the main.mxml, I had utilized the above custom component as follows: var tempPanel: PanelItem = new Pan...

AS3: Why does datatype automatically change from TextField to DisplayObject on its own?

What's happening in this simple piece of AS3 code? Why does my object change from TextField to the more generic DisplayObject? public class Menu extends MovieClip { private var active_button:SimpleButton; public function Menu() { active_button = SimpleButton( menu_list.getChildAt( 0 )); // ignore menu_lis...

as3 mouseEnabled still a problem for me

A couple years in now, there's still something about mouseEnabled I'm not getting. I have a Sprite (for example here "Sky", that contains many objects, one of them is a Cloud, which I do not want to receive Mouse Events. I overlay this Sky on some other display objects. I want the cloud to be visible, but not to block mouse events. If yo...

Draw text on shape in ActionScript 3

Is there any way to draw text in a DisplayObject or Shape using only ActionScript? The only way I can find on the web is by creating a TextField, but I can't add a TF to a DisplayObject or Shape. Edit: Solved thanks to viatropos. For anyone that's interested: DisplayObject implements IBitmapDrawable which can be passed as an argument...

Why does obj.getBounds().height give a larger height than obj.height?

I'm new to Flash and ActionScript, but managing quite nicely. One thing that is continuously getting in my way are the width and height properties of DisplayObject(Container)s. I'm finally starting to get my head around them and learned that the width and height of a Sprite are determined solely by their contents for example. I do not u...

ActionScript 3 instance path issue

Hi, I'm using Flash CS4 and the following ActionScript 3 code: import fl.containers.ScrollPane; // var sp:ScrollPane = new ScrollPane(); sp.name="scroller"; // sp.setSize(320, 240); sp.move(10, 10); addChild(sp); // var mcCount:int=10; // var nextY:int=0; // var i:int=0; // var holder:MovieClip = new MovieClip(); holder.name="contain...

Facebook data to DisplayObject in AS3

Is it possible to convert facebook data (ex. user_pic) into a DisplayObject so I can be easier to manipulate? What I m trying to do is when users do FacebookConnect in my site to let them have the possibility to scale their image (like transform tool usage) before submit it in a gallery. ...

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller error - AS

I have this code snippet inside a function that checks if an object exists on stage and removes it: public function closeContent(e:MouseEvent):void{ removeChild(txt); removeChild(ldr.content); removeChild(_closeButton); container_mc.visible = false; statusText.text=""; if (contains(submitButton)) { removeChild(submitButton);...

AS3: Point for display object x, y?

Right now I have a point that I have to update with the x and y of a display object to use with the hitTestPoint object; is there any way I can get a point from a display object without having to make a new point var and continually update its x and y? ...

Limit display object's drag coordinates in AS3

how can i reference a display object's coordinates according to it's parent object or stage from within the class that creates the object? essentially when i create a new sprite object from a custom class and add it to the display list, i'd like to include code within the custom class that limits the drag coordinates to the stage, or a ...