ActionScript 3.0 :: Empty A Display Object Container?
Oct 21, 2009
Is there a simple way to completely empty a display object container regardless of what it contains, including if it's already empty? In other words, without determining its children and using removeChild on each?
In the documentation for DisplayObject, it states that the width and height of the DisplayObject can not be changed if it is empty. Why is this restriction necessary? In every other framework I have used, you can resize containers that are empty.
For some reason below is not working. It is probably very obvious but I am not seeing it. As soon as I comment out the container mc variable and just add Child to root timeline I see everything which means me container is not being added to the stage correctly.
stop(); import flash.display.MovieClip; var i:int = 0; var a:Number = 10; var ageString:String; var ageText:Array = new Array(); [Code] .....
How do I remove all children from a display object container? I want to make sure that when I re-enter a particular frame that there are no imageLoaders loaded into my photoGallery.
lets say i have 2 classes in the same package.and i add the same event listener to each of them, for example i add event.resize to some display object container in both of them.how can i prevent the code attached to that listener to execute in one of the classes if that event happens?
Basically I've got a class called Controller and another class called:"EnemyShip".In EnemyShip's step() event (the ENTER_FRAME event), I call myStage.removeChild(this);[code]myStage is a reference in the constructor of the EnemyShip.as class
This has to be simple, if only I knew how. I'm an AS3 newbie, and am having difficulty setting up multiple specific EventListeners within a code generated display object container.
I am generating a 'page' (Sprite) with a heap of 'cards' (Sprites) on it. Each of those cards, in turn, contains a selection of text boxes and other objects generated from database output using a 'for' loop. My hope is to attach an EventListener to each 'card' so that a MouseEvent will let me manipulate the data that lead to the content of that actual card (the i-th iteration of my for loop). I've been playing with everything I can think of (limited repertoire of thoughts though) and the best I've managed is for my EventListener to access the final set of data, whichever 'card' I click on. I've summarised and attached my code for the function, how to get back to the i-set of data from the EventListener attached to the i-th card. I can handle the PHP and MySQL side of things but am fumbling my way into the OOP of AS3.
i open a box which has selecable text init and when that is clicked it closes the first box and opens the next. but the container will not empty when the close button is clicked. i use the same method on about 6 other items and all work fin. the 1st box closes fine but the 2nd wont any 1 no y. here code
I'm working with a window scroller component, where the dynamically loaded scrolling content has buttons that load attach mc's to a clip holder in front of the window scroller. To do this I use this bit of code, which works fine:
The "this.enabled=false" is to deactivate the button in the scroll content, otherwise it will still be active in the background. So far so good.
What I need to do, once the "close" button on the attached mc is clicked, is re-enable the button. I'm thinking the way is to check if the attached mc has been unloaded, which I'm trying to do with this:
Code: if (!_level0.slideHolder_mc.content) this.calendarPagesBtn_mc.enabled = true;
I'm trying to somehow target a MC being loaded into an empty container MC. I've tried everything I could think of.
Basically, I'm making a movie editor. Right now clips are added to the stage on initial load, then when they are clicked on they are added to the "reel" and they can be previewed in the order that they are added. Now, I'm trying to get it so that when they are on the "reel" they can be click and dragged and rearranged.
Here's how the clips are added to the stage in a function called loadClips():
Here's how they are being added to the "reel" in addClips():
ActionScript Code: if (currentTarget.name == "1") { clipCopy = new Clip1();
[Code]....
Now, I just want the clips that are on the reel to be click and drag-able (along the X axis but I'll worry about that later). I realize now they're all being added as clipCopy. That's going to be an issue huh? Is there a way that I can target the container and make that mobile?
Rather than typing out each child to add to a container mc, I wish to use a for loop to do so. However, in AS2, when adding an instance of an object, I could specify a unique name based on the current number of the loop. In AS3, I dont know how to even give the same object a unique name if multiple versions a re being pulled from the library to the Stage!
See this step of basic code:: and perhaps someone may have an obvious point to make about the differences of standard procedures, moving from AS2 to AS3::�
Code: var container:MovieClip = new MovieClip(); var wing:MovieClip = new MovieClip(); addChild(container);
I have a main SWF with an empty MC holder and all of the main navigation button on actions. When the buttons are clicked it then loads an external SWF into the empty MC. I am having trouble telling the button to load the movie once and then stop loading if someone clicks on the link again. I want to prevent someone from double clicking to cause the animation to blink. *rapidly click on "home" to see what I mean.
I have a button on stage which has a child menu movieclip and that movieclip has three submenu button children.On each of these 3rd level buttons an event listener draws a new container on the stage and adds a new movieClip holding various info.This all works nicely, but I cannot work out a way to get an eventListener on the menu buttons to check if the container already exists so I can then stop the button repeating the add container function. So, at the moment you can repeatedly hit any of these menu buttons and they will just continue to add info movieClip children.I've tried some nice Boolean commands that should work, but I think it's the nesting of the children/relationships that are not allowing me to get this to work.So, basically for arguments sake, let's say I only have one of each item... here's the nesting of children:[code]
i have a little problem with the unloadMovie command. i have a button which is mc2_about here is the code
[Code]...
where i want to unload level1 which is a scrollbar with a text and load the portfolio section in an empty container... my structure i want to load in an empty container the swf's of the main navigation (home- portfolio,etc) and the sub-menus of it's categories[about me-print-web design) into levels. is there a simpliest way of doing that?
If I create a rectangle with 100px width and 100px height and then rotate it, the size of the element's "box" will have increased.With 45 rotation, the size becomes about 143x143 (from 100x100).Doing sometimes like cos(angleRad) * currentWidth seems to work for 45 rotation, but for other bigger angles it doesn't.At the moment I am doing this:
var currentRotation = object.rotation; object.rotation = 0; var normalizedWidth = object.width;
I have a problem with buttons and transitions and it is similar to a problem I had a couple of days ago that I posted and that was sorted out. I have two buttons onstage (they're inside a movie clip) inside the movie, on the button one I have the following
[Code]....
I have similar code on button two and this does indeed make the buttons move into place as required. My problem is this, I need to load in external swf files into an empty movie clip on the main stage called container. These External SWF files have transitions and this is where my problem is. If I place a normal button on the stage it works but not if the button is inside a movie clip and has actions applied as above. The code next is what I have believe should also be placed on the button to make swf transition one load in.
how in Flex can I display a message within a Spark List component that states that the List is empty. For example if I have a List showing number of jobs outstanding, if my List is empty then I want a message displayed across the List stating "there are no jobs to perform".
I'd rather not use an Item Renderer because then it's an Item (the list is not empty) and the item can be selected.
was just trying to make my site more efficient when its online. I have an image/video gallery. When the thumbnail is clicked, an image or video will be displayed in the container I have. Currently, the code is like
[Code]...
And if so, will it be in the cache or anything when it is loaded again within the click event?
How can i draw sound spectrum inside a display container other than stage?I tried to display it inside the rectangle movieclip but end up in failure.[code]...
I want to check in my function if a passed argument of type object is empty or not. Sometimes it is empty but still not null thus I can not rely on null condition. Is there some property like 'length'/'size' for flex objects which I can use here.
I'm doing some Actionscript work right now and I'd like to know whether there's a way to initiate an empty object's value programatically like this:
var myObj:Object = new Object; myObj.add("aKey","aValue");
To add a property called aKey whose value is aValue.I need to create a "Dumb" (data-only) object to use as a parameter to send via POST. So I don't know offhand how long and/or how many attributes it's gonna have.
Can you make one Bitmap Object (I'm using an external jpg) or something similar, and then display it many times simultaneously without creating a separate object each time?
Also, would they be easily removed or hidden?
I've got a little checkmark jpg graphic loaded here, but I'm not sure how to go about using it in many places at once.. I can only display it in the one place at any one time...
I'm thinking there might be a way to load the picture once, then use its bitmapData elsewhere in new display objects somehow, without needing to reload the image over and over?
It's my understanding that a display object cannot be in the display list more that once.So if I add something to the stage shouldn't a second addition of the same object replace the first? for instance:
[code]...
there should now only be one "myDisplayObject" on the stage.