So, I'm running through a bunch of children in a container, doing stuff to them, then removing them from the container. Since I have both the index and the object reference, would it be better to call removeChild or removeChildAt? I'm leaning toward removeChildAt, but I don't know what's happening behind the scenes, and it's possible that one is just calling the other. Here's the loop:
Code: for (var i:int = container.numChildren - 1; i >= 0; --i) { var kid:CustomClass = container.getChildAt(i) as CustomClass; if (kid != null)
I published my swf work in progress, it can be seen at [URL]
[Code]...
is where I'm trying to show the motorcycles... click on the tile list, a bike shows up... click another one, the first one is to go away to be replaced by the next clicked one. But all the bikes stay there, no removeChildAt(0) is happening.
I think removeChild() is the most confusing thing in my life at the moment when it really shouldnt be. I'm dynamically adding a set of mc's on the stage, im tweening them from alpha 0 to 1 with tweenlite, I then have a button to remove the items in reverse, but for some reason I can seem to get my head around tweening them back to alpha 0 in reverse order. I can remove them from the stage with removeChildAt(0), but I would like the animation. Any one have any solutions for this. I have attached the code and a test file =]
i made an external .swf with the "Displaycontent = image slideshow" in it voor the main site called Teaser, so when i press a button on the main site, it loads the Teaser.swf.when i press that button again, it loads again the Teaser.swf on top of the first Teaser.swf. so i decided to remove the first swf, but then the problem started."TypeError: Error #1009: Cannot access a property or method of a null object reference at easer_fla::MainTimeline/onResizeStage() line 128at Teaser_fla::MainTimeline/onTeasLoaded() line 70
I have a movieclip that inside have secuence of image, I will like 1000 instances of this movieclip, but I not like reload the 100 of images inside the movieclip
It is posible.That the movieclip have a child share with more objects
The zipped attachment for this post, contains two files trial.fla and img.jpg. In the flash movie, I have done the following: Created three frames with stop() on all the three. "Prev Frame" & "Next Frame" buttons allow us to move to all the three frames. There is a movieclip instance with the name: "abc" common to all the three frames. The button "Show/Hide Abc" makes "abc" visible & invisible. In the second frame, I am loading the external image "img.jpg" and setting the child index of "abc" to numChildren - 1.
Now if I move to frame 3 and try to hide "abc" (using "Show/Hide Abc"), it works fine. But once I switch back to frame 2 or subsequently to frame 1, I can see two instances named "abc" in the trace window. (I display all the children of the displayList on every frame). Why do two instances named "abc" appear? Due to two instances of "abc", the button to hide "abc" no longer works. Its very important. NOTE: If I do not change the childIndex of "abc" to numChildren - 1 then everything works fine. But I have to do this in my project where a similar problem has crept up.
I'm trying to make a simple maze game. I have movement working, and now I'm trying to implement collision. Here's what I have:
An 8x8 grid, with walls of length 1 to break the grid up into a maze. the walls are instances of a movieclip I've named "mc_wall" a guitar-pick-shaped chip I'll control the movement of a cross-hair called "arms" that will check if there are walls immediately surrounding my chip by way of collision. "arms" is a movieclip made up of four individual movieclips: "uparm", "leftarm", "rightarm", and "downarm"
I have currently named each instance of "mc_wall" to be "wall" this is the code I have now (using only right as an example):
function moveRobot(event:KeyboardEvent):void { doslide = true; if (event.keyCode == Keyboard.RIGHT)
[Code]....
this will work, causing the chip to remain in place if the rightarm detects "wall", and move if the rightarm does not detect "wall". My problem is that, although I have named every instance of "mc_wall" to be "wall", the only "wall" flash will recognize is the last one.
Is there a way to adjust this code to look at all 70-or-so instances of "mc_wall" instead of only the last one?
I've built a dropdown menu movieclip that I need to use in a contact form- or more specifically, I need 2 dropdowns with different options in them in the same form. My problem is that when I change the properties in one instance of the dropdown_mc, it changes the properties in the other as well. The two clips have different instance names, and I've been changing labels of the list items by clicking through to the actionscript imbedded in each dropdown (not through the dropdown_mc in the library). There must be an obvious solution to this that I somehow didn't catch....I've even tried dragging each dropdown from the stage back into the library and creating a new movie clip with a different symbol name and they're still connected. Do I need to create an entirely new copy of this dropdown with different instance names
I'm having some trouble trying to duplicate movieclips randomly. I have created an array with the instance names of the MCs i have on stage. Then I'm trying to create a variable that selects one random element from the array. Finally I want to use that variable as a target to duplicate my movie Clips... but it doesn't work.
Here is the code:
Code:
var Items = new Array('bombon', 'regalo', 'corazon'); pos = new Object(); pos._x=random(550);
Is there a code to remove all instances of a particular movieclip on stage? The code removeMovieClip(target);removes just one particular instance. That wont do for me at all! I need to remove all the instances. How do I do that?
I have a movieclip that inside have secuence of image, I will like 1000 instances of this movieclip, but I not like reload the 100 of images inside the movieclipIt is posible.That the movieclip have a child share with more objects
I'm trying to convert an old AS 2.0 file to 3.0, but keep getting this error:
[Code]....
I've been pulling my hair out trying to find the problem spot. Can someone take a look at this file and find where the problem lies? NOTE: the file needs to be updated to use strings within the Case statement: "Button_1", etc.
I am working on a project which looks like a crossword puzzle. When you mouse over on the white boxes they will light up. When you mouse over the letters they will have 3d rotations and when you rollover only some specific letters, they will flip some specific boxes.
Right now what happens is, when you mouse over the boxes with letters on them, the letters will rotate but the box will not light up. This is because I have created the box movieclip, with the invisible button inside it, and then just duplicated it in my scene to create a tile. But the invisible button for the letters are on the scene,so it's kinda overriding it.when I tried having the buttons on the scene rather than inside the movie clip, what happened is when you roll over one of the boxes, all of them will animate.
I need to remove all the instances of a movieclip that I am adding to the stage using addChild.I use a loop to add several copies of the same movieclip onto the stage. Is there a way to remove all these movieclips at once.I've tried several things but nothing seems to work.Below are the for loops that I am using to add and remove the children from the stage. Note that the initial for loop adds a number of instances of the movieclip "colorbox2" based on the contents of textboxes. This works fine, however when I trace(colbox.numChildren) it just shows "1" regardless of how many instances it adds to the stage. Shouldn't it reflect the number of instances it added to the stage? The 2nd loop removes one instance of the movieclip from the stage, but I can't get it to remove all the instances of the "colorbox2".[code]
I'm having trouble creating multiple instances of one movieclip. I've got an array set up that loads photos into flash and places them in a grid (sort of). I want those photos to have outlines around them. So, i created an outline. Now, when i try to place it on all of the photos, it will run through them and only apply itself to the latest photo (one instance overwrites the others). How do i make multiples of the outline?
What i'm trying to do is assign a script to several movieClip instances, and make that bounce when it hits another movieClip on satge.I guess basic collision really.But its not working, mainly as, i think, i have no idea how to make the script read things from the stage.This is what i have so far:
I have the following code on frame1 of my movie that I want to apply to multiple instances of the same movie clip:
mainClip_mc.subClip1_mc.specifiedClip_mc.onPress = function () { //code begins SpecifiedClip_mc exists in subClip1 through 4. Is there a way to do this once without having to say: mainClip_mc.subClip2_mc.specifiedClip_mc.onPress = function () { //same code mainClip_mc.subClip3_mc.specifiedClip_mc.onPress = function () { //same code mainClip_mc.subClip4_mc.specifiedClip_mc.onPress = function () { //same code
Essentially, specifiedClip_mc's parent clip is what's throwing me here. The code to be applied to specifiedClip_mc is identical and I'm not going the correct route by doing this the long repetitive way.
Trying to do hitTestObject on instances that are dynamically placed on the stage. Receiving an error:
TypeError: Error #2007: Parameter hitTestObject must be non-null. at flash.display::DisplayObject/_hitTest() at flash.display::DisplayObject/hitTestObject()
I have a number of instances of a MovieClip on stage. These are dragged onto the stage and arranged manually. Now, I would like to alter the instances during run time, using as2 code.
how can I name all the instances of the same MovieClip dragged onto the stage, using as2 code? (specify if the solution involves exporting the library MovieClip with an identifier name)
I am trying to add a single MovieClip in two different spots on my stage. I've added the first by using addChild but I have no idea about how I would also add the second. Basically, it's a button that the user interacts with using a keypress, but in two different spots.
I have a movieclip with one armature inside, and I want to make some instances of it. But after the registering of the armature, with registerElements, only the first instance's bones can be used/moved.