ActionScript 2.0 :: For...in Statement To Remove Multiple MovieClips?
Sep 5, 2005
I want to make a function that will remove every single mc symbol I've previously attached to a "mask" movieclip. So i created this:
removeAll = function(){
for(a in _root.mask){
a.removeMovieClip();
}
}
I thought if i do that itll remove each "a" it encounters but I guess I'm missing some part of that "for..in" syntax. Not sure how that works.
View 1 Replies
Similar Posts:
Apr 8, 2010
I am making a website with complete external xml data holding text and urls to images. I have several categories. One of the category has three sub categories as menu. When I click btn1 it gets the xml and start making text field, rectangles, lines and picture frame for thumbnails. Before that I use a single movieClip container to hold all that stuff and then point it to mask and scroller too.That is working fine. Now the problem is that when I click on btn2 I want to remove previous container and make a new one.
Now what happening is that it is creating one more container of different xml and putting over the previous one. I have used removeChild command and it is still not working. It only works if I use it alone and do not create a new container. All this process is done on a movieClip. That movieClip holds container, mask and scroller. The only thing that is made dynamically is the container. Rest of the items are on the timeline of the movieClip. I need to remove container inside of the movieClip and make a new container inside the movieClip.
View 9 Replies
Jun 10, 2009
I need the correct as to remove 3 movieclips from the stage at once. I can sucessfully remove a single clip using
reels_reels_btn.onRollOver = function(){removeMovieClip("musicvideo_dd_nav_mc");}
tried
reels_reels_btn.onRollOver = function()
[code].....
View 3 Replies
Mar 5, 2009
I have a tower defence and when you lose I have a button to go back to the main screen. Only problem is that I cannot find a way to remove the enemies from the screen as well. Here is all of the code for the game, because I figure I might as well give you everything now, than later. I also wanted to give you all my variable names that would be used...
Code:
stop();
// Params = Number, Health, Speed, Time between releases, Gold per creep);
_root.waves = [[10, 50, 2.500000E+000, 2000, 2],
[code]....
View 3 Replies
May 16, 2010
I've managed to add a bunch of movieClips dynamically from the library. But I don't how I can remove them ALL dynamically now.
I'd like to be able to remove all the buttons, and then add a new lot in afterwards.
Here's what I have so far:
It's not a syntax or a collision error,
Code:
var myBtn:myButton;
// I have a movieClip in the library with the linkage: "myButton"
function addButtons ():void {
[Code].....
View 3 Replies
Mar 23, 2010
I have a video being added to a mc:
mc.addChild(video);
I need to create a conditional statement to see if "video" is loaded in my mc so I can remove it to add an image into the mc
if (mc...=="video"){
removeChild(video);
mc.addChild(image);
}
Not sure how to create the "if" part.
View 6 Replies
Nov 1, 2011
I am trying to access movieclips within my movieclip using a for statement. To try and make this clear, here is how it looks at the moment:
sections = Holder movieclip where dtf_sections is placed, as well as other clips that are needed.
dtf_sections = Where all the title movieclips are placed that are going to be used when called. Placed in here to make it easier to move, within sections
title = Movieclip that contains the text that needs to be changed, within dtf_sections
Here is my code that works:
sections.dtf_sections.title1.dtf_title.text = "Section 1"
There are upto 10 titles within dtf_sections. So, what I thought would work is this:
for(var i:uint=1; i<10; i++){
sections.dtf_sections.["title"+String(i)].dtf_title.text = "Section" +(i)
}
The reason why they are within the movieclips is masking, and appearing at different times.
View 1 Replies
Mar 29, 2011
I have a code with statements like this
Code:
mc1.onRelease= mcfunction
mc2.onRelease= mcfunction
mc3.onRelease= mcfunction
mc4.onRelease= mcfunction
[Code]....
Is there a way to cut down the number of statements in this case?
View 4 Replies
Feb 5, 2012
[Code].....
I have a group of 16 images that I would like to load 1 of each into each movieclip. I want image1 to be inside of visual1, image 2 inside of visual2, and so on. the images are named like, 1960s_(1).png where the 1960 (year) part is coming from the rangeNum variable. The above gives me this error: 1061: Call to a possibly undefined method addChild through a reference with static type int.
View 4 Replies
May 7, 2009
I'm trying to declare a few variables in a for statement using the variable in the for statement. In older flash versions I would use something like this.
Code:
for(a=0;a<10;a++) {
_root["variable"+a] = "Some text "+a;
[code].....
View 3 Replies
May 18, 2005
I want to set multiple conditions for an if statement, but I don't want the conditions to all have to be true, I want to say if (a or b or c or d, etc. is true) then do this. I don't want to say if (a && b && c && d, etc. is true). Is it possible to have an if statement with an "or" in the condition? If so, what's the proper syntax for that?
View 1 Replies
Jul 8, 2009
This is my code
Code:
if (mp1._y != 555) {
new Tween(mp1, "_y", Strong.easeOut, 650, 555, .5, true);
how/where can I ad a second condition like
Code:
mp1._alpha!=100)
to that same statment before that tween plays
View 2 Replies
May 18, 2005
I want to set multiple conditions for an if statement, but I don't want the conditions to all have to be true, I want to say if (a or b or c or d, etc. is true) then do this. I don't want to say if (a && b && c && d, etc. is true). Is it possible to have an if statement with an "or" in the condition? If so, what's the proper syntax for that?
View 1 Replies
Sep 16, 2009
I have 50 images that need to be on stage, which will be embedded into 50 different movie clips. I named the movie clips image1-image50 and the images are in an external folder named 1-50. Every freaking article or tutorial I have found clearly explains how to upload one image, or just one at a time. I can do that, and spend 2 days renaming all the functions, but I do not want to do that. Is there a better way to just load all 50 images, place them accordingly?
View 3 Replies
Oct 26, 2009
I have 24 movie clips on the stage: my_menu.image_holder_mc1 thru my_menu.image_holder_mc24. I want to load an image in each one. How do I identify the holder which to add a child.
The Code I have so far is....
Code:
for (var i:Number=1; i<=24;i++){
var myLoader:Loader = new Loader();
myLoader.name = "image_"+i;
[Code].....
View 2 Replies
Dec 11, 2009
I am trying to do a multiple if statement checking to determine which frame label within a MC (NE) and is located on frame 3 of the main timeline, to display. In the main timeline frame 1, I have declared a new var:
var n_e;
button1.onRelease = function (){
n_e1 = 1;
main timeline go to and stop at frame 3
}
[Code] .....
But it doesn't seem to work, and most of the time it lands up on Ne("2") instead...
View 6 Replies
Apr 5, 2011
I'm afraid I know the answer but I wanted to check first.
I want to run a single function based on multiple values.
[Code].....
View 2 Replies
Oct 27, 2009
I have a conditional statement (if) that I am trying to use contingent on multiple variables being true. So the AS I have right now is:
[Code]...
But when I run that I get the following error message: "Error 1050: Can not assign to a non reference value" What do I need to change so that once 1,2 and 3 have been visited visitComplete is set to true?
View 3 Replies
Mar 13, 2002
I have a button that I want to play first one frame label in a movie clip, and then another, depending on a variable.
The problem that I am having is that the movie does not wait for the first part to finish before jumping to the next.
Here is an example of the code
on (release) {
if (_root.busMove.bus == 2) {
_root.busMove.gotoAndStop ("A2beg");
_root.busMove.gotoAndPlay ("Bbeg") ;
}
}
It goes right to Bbeg, flickering briefly over A2beg which will not do!
View 10 Replies
Aug 29, 2009
I have a menu movieclip and an externally loaded swf on my main stage. The menu mc needs to control the externally loaded swf. For example the swf plays and pauses, then when any of the menu buttons are clicked the swf needs to play thru and be removed. currently I am dispatching an event for each button clicked with a switch statement. In the main timeline I need to listen for each of theses events and based on what button is clicked proceed to the correct content frame. How can I listen for different events and run one function that based on which event is registered perform a task with a switch or if statement?
View 4 Replies
Jul 30, 2006
This shouldn't be too difficult. Heres my code:
for(i=0; i<30; i++){
var box[i]:Object = new Object()
box[i].id = [i]
box[i].name = "default"
box[i].location = "default"
box[i].type = "default"
But its not working. I keep getting error messages concerning the var box[i] statement.
View 2 Replies
Dec 12, 2010
Where and how I'd put the rest for the score tracker? I'm going to be making 3 of these multiple choice questions, so what would be the best way I lay that out and transition from one question to another?[code]...
View 1 Replies
Jul 12, 2010
I want to remove movieclips that have been named by a variable using a button:
this works where I actually name the movieclip (underlined bit)
removeMovieClip(_level0.canvas_mc.object1)
but if I try to remove the clip where the (object1) bit is a variable - nothing happens.[code]...
View 5 Replies
May 19, 2011
I want to remove two movieclips at once, with one function but I can not get it to work.
Code:
function createLightBox(){
var ol:overlay = new overlay();
ol.scaleX = stage.width;
[Code]....
With the above code I am only able to remove the ol movieclip, I need to remove the lb movieclip as well.
View 7 Replies
Nov 9, 2009
I've created an XML thumbnail gallery, and would dearly love to add a simple looping preloader animation to each of the thumbnails whilst they are still loading. I'm struggling to remove the preloader movieclip, once the corresponding image has been loaded.
I'm currently creating the new movieclips within the loop, so I'm having problems referencing them in the following load complete function. I gave naming the "spin_loader" instances a go (i.e. spin_loader.name = "spin" + i), and then trying to remove it in the "thumbLoaded" function ( i.e. project_mc.removeChild(getChildByName("spin" + spinNum)), where spinNum is the equivalent number to "i"), but I just can't seem to crack it.
Code:
function createThumbs()
{
for (var i:Number = 0; i<my_total_project; i++)
[code]....
View 2 Replies
Jan 11, 2009
I have a slider on my stage that returns a number between 0 - 300 depending on where the user moves the slide.What I would like to do is add and remove movieclips as the user slides the slider so that the number of movieclips on the stage is proportional to the slider's value.An example: If the slider value is 300, I want 300 circles on the stage. As the slider moves down to zero, the number of circles on the stage decrease.I've been trying to think of the best way to do this. Should I use addChild and removeChild? Or just change the visibility?And what would be the best way to refer to each movieclip? Should I use an array? Or maybe an if/else statement?
View 4 Replies
Nov 19, 2009
I have a movieclip, let's call it MC1. Inside the actions timeline of MC1, I create a loader and when a button in MC1 is clicked, the loader is added to the stage with an image.
On my maintimeline, you can click a button to bring a second movieclip onto the stage, let's call it MC2. MC2 has the same set up as MC1 where you click a button within MC2 and it adds its own loader with an image to the stage.
The problem is, when I click on MC2, MC1's loader is still on the stage, and I'm having trouble getting rid of it! I tried removeChild(loaderfromMC1) within the actions panel of MC2 but it can't reference variables created in MC1? and I tried removeChild(loaderfromMC1) when the button on the maintimeline is clicked, but it seems that I still cannot reference the MC1 defined variable.
View 1 Replies
Oct 2, 2007
I have made 4 arrays and filled the with movieclips using the array.push(movieclip) method. I have then made a function that is supposed to remove everything in those arrays. This is the code for it:
[Code]...
But when I call this function it does nothing but remove p1s, p2s, p3s and p4s. Also when I type trace(s) in one of the for loops, it outputs 0 for some reason.
View 6 Replies
Aug 1, 2008
trying to hide all submenu's when not equal to the current
Code:
function removeAllOtherMenus(mc) {
trace("remove movieclips not equals: "+mc);
for (var i = 1; i <=3; i++){
[Code]...
but it keeps tracing all subsubmenu_mc (that is subsubmenu_mc1, subsubmenu_mc2 and subsubmenu_mc3 when mc = subsubmenu_mc2)
View 1 Replies
Jan 16, 2009
I have a sprite
Code:
var holder:Sprite = new Sprite();
I then add lots of thumbnails into this sprite from a loop
[code].....
View 9 Replies