Removing Multiple Clips
I am attaching movie clips to the stage according to how many items are in an XML list. Everything works fine, but when I click on the next button I want the attached clips to be removed. when using itemAdd.removeMovieClip(), it only removes the last one.
I have modified the code to: Code: var item_spacing = 40; var item_count = 0;
function loadInfo(info_xml){
var info = info_xml.firstChild.childNodes;
for (var i=0; i<7; i++){ var itemAdd = attachMovie("holder_clip","holder_clip"+i, item_count); itemAdd._y = 0; itemAdd._x =(110)+(92*(i)); item_count++;
var TxtAdd = attachMovie("text_holders","text_holders"+i, item_count); TxtAdd._y = 58; TxtAdd._x = (125)+ (92*(i)); item_count++;
itemAdd.jpg_holder.loadMovie(info_xml.firstChild.childNodes[i].childNodes,1); TxtAdd.playedTxt = info_xml.firstChild.childNodes[i].attributes.played; TxtAdd.pointsTxt = info_xml.firstChild.childNodes[i].attributes.points;
next_but.onRelease = function(){ for(var i=0; i<7;i++){ this["holder_clip"+i].removeMovieClip(); } for (var z=7; z<14; z++){ var itemAdd2 = attachMovie("holder_clip","holder_clip"+z,item_count); itemAdd2._y = 0; itemAdd2._x =(-540)+(92*(z)); item_count++;
itemAdd2.jpg_holder.loadMovie(info_xml.firstChild.childNodes[z].childNodes,1);
} } } } var my_xml = new XML(); my_xml.ignoreWhite = true; my_xml.onLoad = function(success){ if(success) loadInfo(this); else trace("Error Loading") } my_xml.load("teams.xml");
stop(); using Code: for(var i=0; i<7;i++){ this["holder_clip"+i].removeMovieClip(); } but it does not work. Any help would be greatly appreciated.
KirupaForum > Flash > Flash 8 (and earlier)
Posted on: 08-07-2006, 05:25 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Removing Multiple Attached Clips
Hi, can someone help me out with this problem please?
I'm creating a 5 part game, im using the slider from the button library to navigate between each part.
on part 5 I have actionscript attaching balloons in random positions on the stage and as they float across the screen the player has to burst them.
the problem that I am having is that if the player decides that they dont what to complete part 5 and uses the slider half way through to navigate to another part the balloons still stay attached to the stage in there last position.
I've tried several different ways but still cant get the balloons to be removed if the player navigates to a different part after starting part 5.
can anyone help me out with this??
Evil Arrays (Removing Multiple Movie Clips)
[What I would like to do]
Create a button the removes multiple movieClips that are attached
[Details]
I have an array of names:
subMenu =["subA","subB","subC","subD","subE"];
and I would like to create a funtion that loops through
each of these names and use the .removeMovieClip() function.
All I really need it to do is loop through the array and remove any movieClips that correspond to an element inside the array...
For the love of T-Bone Steak please help me
Removing Clips
I have loaded a clip into my main movie as follows
createEmptyMovieClip("swf_Holder_mc",3);
introLoader.loadClip("slide.swf",swf_Holder_mc);
At some point I want to load a different or reload the same swf into this clip
I have tried the code below,but it is not removing and replacing the original clip although it does place a new clip below the original
swf_Holder_mc.stop();
swf_Holder_mc.removeMovieClip();
createEmptyMovieClip("swf_Holder_mc",3);
introLoader.loadClip("slide.swf",swf_Holder_mc);
Removing All Movie Clips
Hi,
Can anyone suggest me a method by which i can remove all the movie clips that i had created using duplicatemovieclip command.i am currently maintaining an array of all the movie clips and removing all using the removeMovieClip command.but can i do it using a single command and avoid using the array of Movie Clips
Thanks
Jayant Chaudhuri
Removing Movie Clips
Hi all!
I am attempting to remove a series of movie clips created from a library item "Card".
The mc's are on root level, and the button to remove the clips is on level 1.
I have tried something like
for (i=0;i<25;i++) {
_root["Card"+i].removeMovieClip;
}
but with no luck!
Any help would be appreciated
Thanks
Removing Movie Clips
I was looking at the code in the Tile Based World Part 1 tutorial (http://www.flashkit.com/tutorials/Games/Tile_Bas-Steven_R-730/index.php).The main scene attatches a movie clip called "man", and a movie clip called "mapcontainer". Within "mapcontainer", it attatches several movies "wall" and "floor". Now from the "man" movie clip, I want to remove one of the "wall" or "floor" clips from the "mapcontainer" How do I do this???
(Did that make any sense?)
Removing Movie Clips.
Is it possible to remove an mc that has been dragged from the library into the scene not created using duplicateMovieClip?
Removing Movie Clips
i'm duplicating a movie clip for a game. each new movie clip that is generated by the code gives a new name to each instance. for example:
original mc name: bomb
instance 1: bomb0
instance 2: bomb1
instance 3: bomb2
etc...
my question is, i want to remove the original movie clip that is being used to create all the new instances. so in the above example i want to get rid of the original mc named "bomb".
is this possible? i tried using removeMovieClip(), but it only works on the newly created instances. it won't work on the original one.
please help!!!
Removing Movie Clips...again...
I have a movie clip playing on level 22, a checkmark showing a question answered correctly...
when I prees the "next question" button to go to the next frame and next question, the checkmark is still there, on every frame I go to...
I have tried every remove code I could find on the searches here, and none work......
here is what i have....
on(release){
_root.gotoAndPlay("q2"); //my next frame
this.removeMovieClip(); //unloads current mc _level22.unloadMovie("check1");// does not work
}
Removing Clips - Newbie Here
Hi,
I have created a MC in which 3 MCs are placed. Each individual MCs has a button which makes it play. When I place these 3MCs in the first MC (I'll call it MAIN), and preview it, my 3 buttons react fine. Except, if I press button 1-MC1, it plays - then press button 2-MC2, plays fine also but MC1 is still on the stage and I don't want that.
I have tried on the button 2-MC2
on (release) {
MC1.removeMovieClip();
gotoAndPlay("boite blanche");
}
It does not work.... Please help Newbie here.
Thanks,
Luke
[help]removing All Attached Clips
sorry, but this is elementary, and i cant find it in the search...
when a movie changes scenes, i want it to remove all the attached clips. is there some easy way to refer to all attached clips on the stage?
(im sure there is, but im derned pleased if i can find my pants in the morning much less a specific piece of code)
Removing Movie Clips ?
hi there...
im loading an external swf file in to an blank movie clip in my flash site...
the swf im loading in plays 100 frames then i want to rmove it...
on the last frame of the swf i put this code :
stop();
this.removeMovieClip();
but nothing happens it just stops and stays there
any suggestions
Removing Movie Clips
Code:
//Remove block
function removeClip(x, y) {
//Depending on the number, remove correct block
switch (_root.grid[x][y]) {
case 1 :
removeMovieClip("_root.block"+x+""+y.red);
break;
case 2 :
removeMovieClip("_root.block"+x+""+y.red);
break;
case 3 :
removeMovieClip("_root.block"+x+""+y.yellow);
break;
case 4 :
removeMovieClip("_root.block"+x+""+y.yellow);
break;
case 5 :
removeMovieClip("_root.block"+x+""+y.blue);
break;
case 6 :
removeMovieClip("_root.block"+x+""+y.blue);
break;
case 7 :
removeMovieClip("_root.block"+x+""+y.green);
break;
case 8 :
removeMovieClip("_root.block"+x+""+y.green);
break;
case 9 :
removeMovieClip("_root.block"+x+""+y.Rbreaker);
break;
case 10 :
removeMovieClip("_root.block"+x+""+y.Ybreaker);
break;
case 11 :
removeMovieClip("_root.block"+x+""+y.Bbreaker);
break;
case 12 :
removeMovieClip("_root.block"+x+""+y.Gbreaker);
break;
}
}
I have this code to remove an attach movie clip in a movie clip. I want it so that it will go into the movie clip depending on the x and y position on an array. I have tested that if I put _root.block120.red for example, it will work but I need it to pick depending on the array position.If you can tell me how fix this please help or if you have any ideas to do this please post. Thank you.
RemoveMovieClip Only Removing Some Of The Clips
hey, im having a little problem in my game on the first frame of the game i have this code
code:
for (i=2; i<=numEnemy; i++){
enemy1.duplicateMovieClip( "enemy"+i, i+100 );
}
for (a=1; a<=numEnemy1; a++){
enemy2.duplicateMovieClip( "enemy1"+a, a+100 );
}
for (b=2; b<=numEnemy; b++){
enemy3.duplicateMovieClip( "enemy3"+b, b+100 );
}
for (j=2; j<=numRock; j++){
rock1.duplicateMovieClip( "rock"+j, j+100 );
}
and using this code i get the following instance names on objects
enemy0
enemy1
enemy2
enemy10
enemy11
enemy12
enemy30
enemy31
enemy32
rock0
rock1
rock2
(dont ask me why theres no enemy2... cause im not sure)
now when i use that code i then want to remove all these MC's on frame 3 of my game (game over screen)
so i have this code
code:
removeMovieClip("enemy0");
removeMovieClip("enemy1");
removeMovieClip("enemy2");
removeMovieClip("enemy10");
removeMovieClip("enemy11");
removeMovieClip("enemy12");
removeMovieClip("enemy30");
removeMovieClip("enemy31");
removeMovieClip("enemy32");
removeMovieClip("rock0");
removeMovieClip("rock1");
removeMovieClip("rock2");
so i thought this would all work but then when it gets to frame 3 only
enemy0
enemy1
enemy2
enemy10
enemy11
enemy12
are removed and
enemy30
enemy31
enemy32
rock0
rock1
rock2
are still there, any ideas on how to fix?
[MX] Removing Movie Clips?
Hello, I was trying to remove movie clips...but it wouldnt work when I used removeMovieClip(this); and this.removeMovieClip... How do you remove movie clips in actionscript?
Removing Move Clips
I have a movie clip by the name of coin. On hit test with char, I want the movie clip, coin to be removed forever. Even if you returned to that frame, i still want the mc coin to be gone. I tried using removeMovieClip(); but it didn't do anything. Help would be appreciated
As3 Removing Parent Clips
hi all, i am new to this as3 thing, so a little bit of a newbie question, which is pretty fundamental i think!
so in (the good old days of!!) as2, i was able to do something like this
Code:
//create a new mc
var m = createEmptyMovieClip("m",1)
//attach 2 mcs
var mc2 = m.attachMovie("main_movieclip","_mc2",2)
var mc3 = m.attachMovie("main_movieclip","_mc3",3)
so if i wanted to remove mc2 for instance i could just remove it, if i wanted to remove both mc's i could remove the parent movie 'm' and both the attached movie clips would be removed!!
so how do i replicate that, i have this in as3
Code:
var m:MovieClip = new MovieClip();
m = new headUp();
addChild(m);
m.name="b1"
m.x=100;
m = new h();
m.name="b2"
addChild(m);
m.x=200;
if i want to remove ' m.name="b1" ' easy, but if i want to try and remove both and try and remove the parent 'm' movie clip, only the last attached child would remove, in this case ' m.name="b2" '
so how do i remove both children in one go? surely removing the parent is the obvious method? do i have to attach the children at different levels?
I guess i am been stupid, but some advice would go down well here:-)
Thanks in advance Sam
(serial poster!!!)
Removing Movie Clips
I'm a begginer in flash and action script. I've created a movie in which some on stage animation happens until a frame with a stop() function on it.
on This frame I have a function that creates a bunch of child movie clips on a mouse event.
what would be the best way to remove them on another mouse event and how would I go about tweening them before removal.
so far my structure is as follows:
var stateQ:Boolean;
ActionScript Code:
button.addEventListener(MouseEvent.MOUSE_UP, createState);
function createState(e:MouseEvent):void
{
var mc:clip = new clip;
addChild(mc);
stateQ = true;
}
button2.addEventListener(MouseEvent.MOUSE_UP, createState2);
{
if(stateQ)
{
removal();
}
}
function removal();
{
removeChild(mc);
}
this doesnt work for obvious reasons being that if the mouse event hasnt been triggered the mc clip doesnt yet exist.
If someone can point me in the right direction it would help alot.
Removing Movie Clips
I am having trouble removing a movie clip from the stage, here's the code:
ActionScript Code:
onClipEvent (enterFrame)
{
if (this, hitTest(_root.car))
{
_root.createEmptyMovieClip("box", 1)
_root.box.loadMovie("option box.swf")
_root.box._x = 50;
_root.box._y = 100;
_root.warning.text = "You hit the person !";
this.removeMovieClip ();
}
}
Any suggestions how to fix this?
Thanks
Removing Attached Clips
I have code that attaches a number of movie clips using an array as the variable name. I would like to remove these clips when I press a button. I have attach my code to create and remove the clips. The create function works just fine but the remove when I press the button doesn't work at all. Can someone tell me where I am going wrong?
Thanks
Attach Code
var createCode:Function = function(currentWord:String){
var pos = placeholder_mc._x;
for(i=0;i<=currentWord.length-1;i++)
{
attachedClips[i] = attachMovie(currentWord.charAt(i),"letter"+i+"_mc",this.getNextHighestDepth(), {_x:pos, _y:placeholder_mc._y});
pos = pos + (attachedClips[i]._width + 10);
}
}
tryAgain_btn.onRelease = function(){
for(i=0;i<=attachedClips.length - 1;i++){
attachedClips[i].removeMovieClip();
}
}
Removing Movie Clips In AS3
Hello, I'm having a bit of trouble with AS 3.0, would be really grateful for anyone out there who can give me a hand!
I've got two classes that extend movieClips, one of them creates new instances of the other.
After the Parent class creates a Child instance if stores a reference to it in an array and addChild's the Child reference to itself.
The Child then loads an image into itself using the Loader.
I have a function in Parent that goes through the array and checks to see if each Child is on the visible portion of the stage, if it's not it deletes it and creates a new Child which loads a different image in.
Looking at the memory useage (shoots through the roof!) it's not removing the Child clips!
I've tried to read up on this as much as I can and be pedantic about removing references etc, but it doesn;t seem to work, code's at the base of the page.
as far as I know that's all references to the Child removed, and it's gone from the stage.
There are other temporary references to the Child defined in other functions, but they should surely be junked at the end of the function, and not count?
When the Child is destroyed, the image loaded into the Child should be destroyed too shouldn't it?
Anything else anyone could please suggest as to why this isn't working? I can't even debug the file as the AS3 debugger doesn't give the same tree structure of movieclips so the only way I know its not been removed is from the memory useage.. :S
It's really frustrating, and tips or hints would be helpful! Most of AS3 I prefer to AS2, but this is annoying!
Attach Code
var pChild:MovieClip=Children_array[I] // references a Child for deletion
pChild.unLoad() // this function unloads the bitmap loaded into the Child
removeChild(pChild) // gets rid of the Child from the display.
pChild=null // clears the temporary reference to the Child.
Children_array[I]=null // clears the class's reference in the
Children_array.splice(i,1) // deletes that null item
Edited: 12/02/2008 at 09:29:18 AM by MarkCaz
Removing Movie Clips
I got a small problem.
I have the main timeline with frame 1 and frame 5. Both frames have stop() on them.
I also have a movieclip called introasteriod that plays on frame 1, however, when I click a button and go to frame 5, I want it to stop playing and disappear. I cannot accomplish this.
This is what I have so far:
On frame 1:
Code:
ctr.onRelease=function()
{
root["introasteriod"].removeMovieClip();
root["introasteriod"].stop();
gotoAndPlay(5);
}
On frame5:
Code:
stop();
root["introasteriod"].removeMovieClip();
root["introasteriod"].stop();
ok1.onRelease=function()
{
gotoAndPlay(1);
}
I also tried root.introasteriod.stop() too.
However, the movie clip introasteriod keep playing when I click on the button to go to frame 5. How do I stop this? I need to kill all 6 asteriod when I click the button.
Removing All Clips From The Stage
Hi,
Has anyone got a function that will remove all movieclips from the stage (except for the stage itself that is). I just want to kill all the blocks and characters from my game after completing each level.
Thanks in advance!
Jon
One day I will find a signature worthy of this space. That day has not yet come.
Removing Multiple MC's At Once
Hello folks,
I've a problem with movie clips at the moment. I have multiple clips in a scene (which I'm using to build a windows style menu system), except for most of the time they are hidden to the viewer outside the screen. I call them in with a bit of script like this:
on (rollOver) {
setProperty ("/animation_menu", _x, "278");
}
on (rollOver) {
setProperty ("/animation_menu", _y, "36");
}
Then on mouse out i tell it to go back to somewhere far outside the screen, but I also have to tell every other clip to get out of the way too.
My problem is however that I have SO many movie clips now, and I'm ending up with having to write far to much actionscript to get my menus to appear and disappear. Is there any way I can use actionscript to do something like
remove all of the movies in this scene no matter what the name is, EXCEPT for this one which will stay here?
I'd really appreciate anyone's insight on this becuase it could save me a tremendous amount of time
Judder
Removing Movie Clips, Please Help Meeeeeeeeeeeeeeeeee
I have a movive clip which i use as a pop up window for a login screen. The movie clip is opened from a button on the main timeline using an attach command. This works fine, however i have put a close button on the mc pop up using the 'removemovieclip' but this doesnt work. The only thing that does work is an 'unload' command but then if you try to login again it doesnt attach the movie.
I'm guessing that cos the button i am using to close the clip is on the actual pop up window it wont work proper.
Does anyone know how i can close the window with a button on the actual mc pop up.
I hope you understand all that.
Removing Duplicated Movie Clips
Please help me!
I've got a movie clip that is duplicated that I'd like to remove/ or make invisible through a button action. I can remove the original clip, but not the duplicates of it. Can anyone help me?
Thanking you kindly!
Removing Sound From Movie Clips
i have some movie clips in my movie which are just clips i created in windows movie maker,
they have sound with them though and they need to be silent while there is my background music playing behind,
i have looked for programs to remove the sound from movie clips but had no luck so far, if anyone can help me please do soon
cheers
James
Removing Duplicated Movie Clips
Does anyone know how to remove mulitple movie clips at one time (like when a user clicks a button)?
I need to clear an area of duplicated movie clips, all with different instance names at different levels.
Since they are on consecutive levels, I was going to run a loop to remove them based on their level position, but I don't know how to target a movie clip based on its level.
Thanks!!!
Removing And Adding Moving Clips
I am making a game, were you can move a person to a car, and by being in a center zone, and pressing enter, the man enters the car. I have a movable man, and a movable car, and i can make the zone, and have the zone acknowlegde when i am standing there and hitting enter.
what i want to know is how i make the movable man disappear, play little animation of him entering the car, and then replacing the "fake car" with the car that can actually move.
so i am looking at, pretty much, replacing on movieclip with another, how would i do this?
any help would be great, thanks.
Removing Duplicated Movie Clips
I have a movie clip that can be dragged and when released a duplicate movie clips clip is created. This is the script that I used:
on (press) {
startDrag(_this);
}
on (release) {
stopDrag();
_root.i++;
_root.draw.green_circle.duplicateMovieClip("green_ circle"+_root.i, _root.i);
}
Now I would like to create a button that removes all of the duplicate movies clips. I have tried this with no success:
on(release){
for (var j = 1; j<_root.i; j++) {
_root.draw["green_circle"+j].removeMovieClip();
}_root.i=0;
}
Any suggestions?
Removing Attached Movie Clips
here is the code I am using to attach an exported movie clip from the library called birdMC:
PHP Code:
createEmptyMovieClip("emptyBird", 16);
_root.stamps.birdb.onPress = function() {
_root.actions.penmode = "stamp";
c = c+1;
emptyBird.attachMovie("birdMC", "newBird"+c, 5000+c, {_x:_root.emptyBird._xmouse, _y:_root.emptyBird._ymouse});
var copyBird = _root.emptyBird["newBird"+c];
startDrag(copyBird);
copyBird.onPress = function() {
if (_root.remove == true) {
copyBird.removeMovieClip(this);
_root.actions.penmode = "stamp";
c = c-1;
} else {
startDrag(copyBird);
_root.actions.penmode = "stamp";
}
copyBird.onRelease = function() {
stopDrag();
_root.actions.penmode = "draw";
_global.current = this;
};
};
};
my question is, what script would I put on a button inside of the birdMC movie clip that would cause the movie clip to be removed? I would like it to only remove that instance of the movie clip, no other instances that may be on the stage.
thanks in advance....
Unloading / Removing Movie Clips
rather than using, for example:
removeMovieClip(movie1_mc);
removeMovieClip(movie2_mc);
removeMovieClip(movie3_mc);
removeMovieClip(movie4_mc);
etc...
for each of several movie clips on a scene, is there a parameter, or wild card that would unload or remove all movie clips on a given scene irregardless of which level they are on?
Flash 8 : Removing Movie Clips?
Im using the 8 pro trial, and for some reason this code isnt working:
removeMovieClip(_parent);
removeMovieClip(this);
And the mc.removeMovieClip() doesnt work any more.
what happens is, the movie clip just gets moved to the opposite side of the screen. Can anyone tell me how to properly remove a movie clip in flash 8 ?
Removing All Duplicated Movie Clips
I have a whole bunch of different duplicated movie clips called "unit+_root.i". (like unit0, unit1, unit2... etc) and when they defeat this castle thing, it moves to the next frame. The thing i want is when it goes to the next frame, it will take off all of those duplicated movie clips i just made. can anyone help me?
[F8] Help Wanted: Removing Movie Clips
I have movie clips on my main stage. Each MC loads a side menu that is another MC. Before loading, they are scripted through action script to remove any other potential open MCs. The action script is as follows:
on(release){
removeMovieClip("Profile_Menu");
removeMovieClip("Contact_Menu");
removeMovieClip("Box_Skills");
removeMovieClip("Box_Studies");
removeMovieClip("Box_Education");
removeMovieClip("Box_Honors");
removeMovieClip("Box_Work");
_root.attachMovie("Contact_Menu", "Contact_Menu", _root.getNextHighestDepth());
}
This is working perfectly.
However, in the side menus that are loaded, the script is not working properly. When a MC is clicked, it loads the appropriate MC. However, it does not remove the previous MC. The result is that the MCs are stacking on top of each other, which is really horrible considering they all have opaque backgrounds.
To show that I haven't fluffed up the copy n pasting process, here is an action script for a button in a MC that is not working:
on(release){
removeMovieClip("Box_Skills");
removeMovieClip("Box_Studies");
removeMovieClip("Box_Education");
removeMovieClip("Box_Honors");
removeMovieClip("Box_Work");
_root.attachMovie("Box_Skills", "Box_Skills", _root.getNextHighestDepth());
}
What should I do?
Should I change the MCs that arent getting removed properly to buttons since they're just plain text? If that is the case, what would the new load/remove tags be?
[F8] Help Wanted: Removing Movie Clips
I have movie clips on my main stage. Each MC loads a side menu that is another MC. Before loading, they are scripted through action script to remove any other potential open MCs. The action script is as follows:
on(release){
removeMovieClip("Profile_Menu");
removeMovieClip("Contact_Menu");
removeMovieClip("Box_Skills");
removeMovieClip("Box_Studies");
removeMovieClip("Box_Education");
removeMovieClip("Box_Honors");
removeMovieClip("Box_Work");
_root.attachMovie("Contact_Menu", "Contact_Menu", _root.getNextHighestDepth());
}
This is working perfectly.
However, in the side menus that are loaded, the script is not working properly. When a MC is clicked, it loads the appropriate MC. However, it does not remove the previous MC. The result is that the MCs are stacking on top of each other, which is really horrible considering they all have opaque backgrounds.
To show that I haven't fluffed up the copy n pasting process, here is an action script for a button in a MC that is not working:
on(release){
removeMovieClip("Box_Skills");
removeMovieClip("Box_Studies");
removeMovieClip("Box_Education");
removeMovieClip("Box_Honors");
removeMovieClip("Box_Work");
_root.attachMovie("Box_Skills", "Box_Skills", _root.getNextHighestDepth());
}
What should I do?
Should I change the MCs that arent getting removed properly to buttons since they're just plain text? If that is the case, what would the new load/remove tags be?
[F8] Attaching/Removing Movie Clips
I'm having trouble adding and removing a movieclip to my game, when one movie clip is moused over (ie shot..), I'm tyring to get a blood splat movie attached to it, at the location it was shot. However, of the code I've tried, I've only managed to get it to attach the "splat" movieclip to the top left corner of the movie and repeat itself.
I'm thinking of either having use actionscript to change its alpha from 100 to 0, then when it reaches 0, to use code to remove the clip, as currently I am animating the fade of the blood splat.
Current code is as follows:
Bee movie clips name is "bee"
Splat movie clips name is "splat" (splat is a 12 second animation tween of blood enlarging and fading out)
Code:
splat = function () {
attachMovie( "splat", "splat");
if (splat._alpha <0) {
splat.removeMovieClip();
};
}
bee.onRollOver = function() {
moveBee();
//score += 1;
splat();
//soundInstance.start(0,0);
//playing = true;
}
I also tried the following code to attach the splat to the bee's "death" location:
Code:
attachMovie( "splat", "splat", 2);
this._x = bee._x;
this._y = bee._y;
if (splat._alpha <0) {
splat.removeMovieClip();
};
}
But found it was attaching to the bee's new location, and moving everything around and messing up the whole movie..
Feedback is much appreciated on this one, cheers!
[MX04] Removing Movie Clips
I am making a platformer game that calls certain sectors of the level, and loads them when the current sector is off the screen. But when i do this, I use this code to unload the clip when it runs off of the screen. It doesn't do it though.
Code:
function sectorSwap(){
sectorCoords = platform["sector" + (sectorFocus - 1)].getBounds(_root)
if(sectorCoords.xMax <= 0){
platform["sector" + (sectorFocus - 1)].unloadMovie();
}
sectorCoords2 = platform["sector" + sectorFocus].getBounds(_root)
if(sectorCoords2.xMax <= 800){
sectorFocus = sectorFocus + 1;
attachNextSector();
}
}
Will it not unload because I put the movie in with AttachMovie?
Removing Attached Movie Clips
Hey again.
I used the Attach movie clip method to create bricks in a game i'm making. The problem is, I don't know how to remove them. Any help would be appreciated.
Quote:
var ref:MovieClip = _root.attachMovie("brick", "brick"+movieNum, movieNum);
//line them up
ref._x = 58 + ref._width * row;
ref._y = 50 + ref._height * col;
Removing Duplicated Movie Clips
HI There
I know this has been discussed before, but I was unable to resolve the following problem using the proposed answer. I am working on a Flash / ASP application for logging IT related requests. In order to display all requests logged by the current logged in user, I query the database, and return the results as arrays. Using the arrays, I create a set of duplicated movieclips using the following code:
ActionScript Code:
stop();
// hide the origional clips
RefID._visible = 0;
Subject._visible = 0;
DateLogged._visible = 0;
// split up the array by looking for the commas
ID_array = IDoutput.split(",");
Subject_array = SUBoutput.split(",");
DateLogged_array = LOGoutput.split(",");
// get the length of the array
ID_length = ID_array.length;
// set the start y position (x position depends on where you put it on the screen)
yposition = 70;
// looping everything
for (i=0; i<ID_length; i++) {
// RefID
duplicateMovieClip(RefID, "RefID" add i, depth);
setProperty("RefID" add i, _y, yposition);
RefID.RefID = ID_array[1];
set("RefID" add i add ".info", ID_array[i]);
depth--;
// Subject
duplicateMovieClip(Subject, "Subject" add i, depth);
setProperty("Subject" add i, _y, yposition);
Subject.Subject = Subject_array[1];
set("Subject" add i add ".info", Subject_array[i]);
depth--;
//Date_Logged
duplicateMovieClip(DateLogged, "DateLogged" add i, depth);
setProperty("DateLogged" add i, _y, yposition);
DateLogged.DateLogged = DateLogged_array[1];
set("DateLogged" add i add ".info", DateLogged_array[i]);
depth--;
// Set the y position plus 25
yposition = yposition+25;
}
The code above works fine. When the user clicks on the "RefID" movie clip, it must take him/her to the details of that issue. This once again works fine, but when I try to remove the movieclip, it only removes the first one, and the rest remains visible.
I tired the following code to remove the duplicated clips:
ActionScript Code:
stop();
for (i=0; i<ID_length; i++) {
test = "RefID" add i;
removeMovieClip(test);
}
Thank you in advance
O-Grrrrr
Removing Movie Clips On A Game
I am still making my space invaders game, however once the person completes the first level the same enemies appear on the following frame after they have been defeated, where it also says go to the next level. How can I get these enemies to dissapear on my 'go to next level' frame and the frames after that?
So far I have tried out coding like _root.removeAllMovies and _root.removeMovieClip and none of these seem to work, what is the script I need to do this?
Many thanks if you can help me out
Removing Movie Clips Problem
Okay, basically I'm having trouble removing movieclips created with attachMovie.
Every movieclip I create is a piece that moves across the screen and then falls and goes outside the borders of the screen. I want to delete all these created movieclips once they go outside the screen (to free up memory etc.)
A different movieclip is attached depending on a random value like this, for example:
Code:
if (genvar == 3) {
var depth = _root.getNextHighestDepth();
_root.attachMovie ("lhandnew", "lhandnew"+depth, depth);
_root["lhandnew"+depth]._x = -237.1;
_root["lhandnew"+depth]._y = 460.4;
}
Where genvar is the random variable.
Basically, this all works and my movieclips are generated randomly (at the push of a button) but I cannot seem to remove the movieclips after they move outside the screen.
Now, _root["lhandnew"+depth]._y in this case, will always be 460.4, but I'm not trying to check for that, I'm trying to check for the child of "lhandnew"+depth because every movie clip that is created has a nested movie clip inside of it.
I want flash to check for the position of the nested movie clip inside the generated mc as eventually, the position exceeds the screen's height.
I've tried this sort of thing:
if (_root["lhandnew"+depth].lefthand._y > stageHeight) {
_root["lhandnew"+depth].removeMovieClip();
}
but that simply doesn't work.
And I've also tried
trace (_root["lhandnew"+depth].lefthand._y);
but that simply returns "undefined" all the time.
What am I doing wrong here? Obviously its a problem with the nested movie clips but I'm not quite sure how to reference/check for things within a nested movie clip.
Removing Duplicate Movie Clips
Hi everyone,
I have a problem that I can't seem to work out. I have some code on my page that duplicates movie clips from a linked clip in the library. It works fine but when I go to other frames in my movie the duplicated movie clips are still playing over top of everything else
So I wanted to attach some code to a button that removes the movie clips before taking you to where the button points.
This is part of the code I'm using:
particle.prototype = new MovieClip();
for (i=0; i<10; i++) {
scale = random(250)+50;
_root.attachMovie("dust_mc", "dust"+i, 1000+i);
_root["dust"+i]._alpha = random(50)+50;
_root["dust"+i]._xscale = scale;
_root["dust"+i]._yscale = scale;
_root["dust"+i]._x = random(640);
_root["dust"+i]._y = random(480);
particle.apply(_root["dust"+i]);
}
I tried this on the button:
on (release) {
removeMovieClip("_root.dust_mc" +i);
gotoAndStop("main");
}
I did a search and have been reading through so related material and from what I can gather I need to swap depths or something before I can remove the clips I'm just learning actionscript and I am finding it hard to get around this problem. I think it must be something simple that I am overlooking.
What am I doing wrong? Any helpful answers appreciated.
Removing And Adding Movie Clips
Hey guys,
I am making a platform game and I decided to do the scrolling background by cacheing it so I could repeat the background and it would make it faster. But the actual platforms, I will put in another mc, which I will put the same code as the moving background so it moves but I'm not going to have it repeat so I need to make a lot of these for a very long level. I will store these off stage but I know this will slow it down significantly so any ideas on how to store these movie clips somewhere like the library and call them up when the character is approaching it and removing the other mc of platform so it makes the game run faster?
Please help!! Thanks
Duplicating/removing Movie Clips
www.geocities.com/nitihasa/duplicate.fla
I tried to make it so:Every second a new ball ("Q") will be duplicated.
When a ball touches one of the two walls, it comes back.
When a ball gets out of the boundary, the movie clip is removed.
However, it works only with the first ball. When the third ball is out, the second ball disappears in the same time (before leaving the boundary), and thus with the following balls.
Can anyone solve it?
Removing Dynamic Movie Clips
If i attach 50 movie clips to content_mc. and then i run another function where i want to:
1. clear all of the attached movie clips on content_mc
2. repopulate content_mc with new movie clips
how do i clear content_mc?
i want to just do a magic content_mc.clear like you do with the drawing junk.
Removing Movie Clips From The Timeline With AS 3.0
Try this test:
Creat a new Flash movie with 2 bank keyframes.
Draw a rectangle on the first frame, convert it to a movieclip and give it an instance name of testSym
Add this code to the first frame:
////////////////////////////
removeChild(testSym);
testSym = null;
/////////////////////////
and then this code to the second frame:
//////////////////////
trace ("FORCING GC");
try {
new LocalConnection().connect('foo');
new LocalConnection().connect('foo');
} catch (e:*) {}
stop();
// this forces the garbage collector but is not recommended for published products
///////////////////////
give the rectangle movie clip 2 blank keyframes too. Put this code in the first frame:
///////////////////
trace("I'm still here");
/////////////////////
and this code in the second:
///////////////////
gotoAndPlay(1);
///////////////////
Now run the movie - I assumed that the clip would be marked for garbage collection and collected by the forced collect, but it still persists - presumably because it was put statically on the timeline?
Is there any way around this? Surely there must be a way to remove movie clips that have been placed statically on the timeline at design time rather than adding everything using code? Can anyone help?
Removing Movie Clips And Hit Tests
We're currently working on a project in class doing a space invaders type of game.
We've gotten all the movement down more or less, we have the collision detection down, when we shoot the aliens the aliens dissapear, but for some reason when we try to make the bullet dissapear well nothing happens.
First we have the collision detection code on the aliens
ActionScript Code:
onClipEvent (load) {
hit = "no";
}
onClipEvent (enterFrame) {
if (_name != "mine") {
setProperty("", _x, this._x+speed);
h = 0;
while (++h<=_root.ship.missile_max) {
if (_root["missile_"+h].hitTest(this) && hit == "no") {
hit = "yes";
this.removeMovieClip();
}
}
}
}
that works to make the aliens dissapear. Now, we're not sure exactly where to place the code to make the bullet dissapear, we tried placing it with the above code, but nothing happened.
On the bullet/missle we have
ActionScript Code:
onClipEvent (load)
{
speed = 8;
}
onClipEvent (enterFrame)
{
if (_name != "missile")
{
setProperty("", _y, this._y - speed);
}
//if (_root["win_1_1"].hitTest(this))
//{
//this.removeMovieClip();
//}
}
some of it is blocked out, left over trial and error stuff we're still trying to figure out.
On the ship itself we have
ActionScript Code:
//this controls the ships tilting animation
onClipEvent (enterFrame){
if (Key.isDown(Key.LEFT)) {
this.gotoAndStop("left");
} else
if (Key.isDown(Key.RIGHT))
{ this.gotoAndStop("right");
} else
{ gotoAndStop("center");
}
}
//this controls the speed of side to side movement and fire speed
//also the direction the missile goes
onClipEvent (load) {
_root.score = 0;
speed = 8;
i = 1;
shots = 0;
_root.shots = 0;
missile_max = 3;
xmov = speed;
shoot = "yes";
}
//left and right movement
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_x+=xmov;
} else if (Key.isDown(key.LEFT)) {
_x-=xmov;
}
//fire away, this is telling the thing to shoot
if (Key.isDown(key.SPACE))
{
if (shoot == "yes")
{
var missileNew:String = "missile_" + h;
_root.playSound("shoot")
shoot = "no";
duplicateMovieClip(_root.missile, "missile_" + i, i);
_root["missile_"+i]._x=_x;
_root["missile_"+i]._y=_y;
shots = ++shots;
i = ++i;
}
} else {
shoot = "yes";
}
if (i > missile_max) {
i = 1;
}
}
The above works fine as well. So any help on making the bullet/missile dissapear would be appreciated, also, where should we place it?
Thanks in advance
Removing Movie Clips And Hit Tests
I originally posted this on the newbie thread, got 10 reads, but no replies. I thought maybe since it was all actionscript I probably should've put it here, so here's my question from the newbie forum.
We're currently working on a project in class doing a space invaders type of game.
We've gotten all the movement down more or less, we have the collision detection down, when we shoot the aliens the aliens dissapear, but for some reason when we try to make the bullet dissapear well nothing happens.
First we have the collision detection code on the aliens
ActionScript Code:
onClipEvent (load) {
hit = "no";
}
onClipEvent (enterFrame) {
if (_name != "mine") {
setProperty("", _x, this._x+speed);
h = 0;
while (++h<=_root.ship.missile_max) {
if (_root["missile_"+h].hitTest(this) && hit == "no") {
hit = "yes";
this.removeMovieClip();
}
}
}
}
that works to make the aliens dissapear. Now, we're not sure exactly where to place the code to make the bullet dissapear, we tried placing it with the above code, but nothing happened.
On the bullet/missle we have
ActionScript Code:
onClipEvent (load)
{
speed = 8;
}
onClipEvent (enterFrame)
{
if (_name != "missile")
{
setProperty("", _y, this._y - speed);
}
//if (_root["win_1_1"].hitTest(this))
//{
//this.removeMovieClip();
//}
}
some of it is blocked out, left over trial and error stuff we're still trying to figure out.
On the ship itself we have
ActionScript Code:
//this controls the ships tilting animation
onClipEvent (enterFrame){
if (Key.isDown(Key.LEFT)) {
this.gotoAndStop("left");
} else
if (Key.isDown(Key.RIGHT))
{ this.gotoAndStop("right");
} else
{ gotoAndStop("center");
}
}
//this controls the speed of side to side movement and fire speed
//also the direction the missile goes
onClipEvent (load) {
_root.score = 0;
speed = 8;
i = 1;
shots = 0;
_root.shots = 0;
missile_max = 3;
xmov = speed;
shoot = "yes";
}
//left and right movement
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_x+=xmov;
} else if (Key.isDown(key.LEFT)) {
_x-=xmov;
}
//fire away, this is telling the thing to shoot
if (Key.isDown(key.SPACE))
{
if (shoot == "yes")
{
var missileNew:String = "missile_" + h;
_root.playSound("shoot")
shoot = "no";
duplicateMovieClip(_root.missile, "missile_" + i, i);
_root["missile_"+i]._x=_x;
_root["missile_"+i]._y=_y;
shots = ++shots;
i = ++i;
}
} else {
shoot = "yes";
}
if (i > missile_max) {
i = 1;
}
}
The above works fine as well. So any help on making the bullet/missile dissapear would be appreciated, also, where should we place it?
I had to make a new post on that thread with some stuff I thought might be important, so here it is as well.
ActionScript Code:
soundOn = true;
function playSound(name)
{
if (soundOn)
{
soundFX.gotoAndPlay(name);
}
}
//variables
var invaderwidth:Number = 60;
var spacebetween:Number = 6;
var col_max:Number = 20;
var row_max:Number = 1;
var moveDown:Number = 40;
var enemyA:Array = new Array();
var enemyB:Array = new Array();
var enemyC:Array = new Array();
var enemyD:Array = new Array();
//make enemy rows
for(i = 0; i <= row_max; i++)
{
//make enemy coloumns
for(j = 0; j <= col_max; j++)
{
var name1:String = "iExplorer_"+i+"_"+j;
duplicateMovieClip ("iExplorer","iExplorer_"+i+"_"+j, _root.getNextHighestDepth());
this[name1]._x = 0;
this[name1]._x += invaderwidth + spacebetween * j * 4;
this[name1]._y = invaderwidth + spacebetween + moveDown;
enemyA[j] = eval(name1);
var name2:String = "trash_"+i+"_"+j;
duplicateMovieClip ("trash","trash_"+i+"_"+j, _root.getNextHighestDepth());
this[name2]._x = 0;
this[name2]._x += invaderwidth + spacebetween * j * 4;
this[name2]._y = invaderwidth + spacebetween + moveDown + 25;
enemyB[j] = eval(name2);
var name3:String = "mine_"+i+"_"+j;
duplicateMovieClip ("mine","mine_"+i+"_"+j, _root.getNextHighestDepth());
this[name3]._x = 0;
this[name3]._x += invaderwidth + spacebetween * j * 4;
this[name3]._y = invaderwidth + spacebetween + moveDown + 50;
enemyC[j] = eval(name3);
var name4:String = "win_"+i+"_"+j;
duplicateMovieClip ("win","win_"+i+"_"+j, _root.getNextHighestDepth());
this[name4]._x = 0;
this[name4]._x += invaderwidth + spacebetween * j * 4;
this[name4]._y = invaderwidth + spacebetween + moveDown + 75;
enemyD[j] = eval(name4);
}
}
//show border
var border:String = "border2";
_root.attachMovie("border1", "border2", _root.getNextHighestDepth());
this[border]._x = -22;
this[border]._y = -3;
//make bills head
var name5:String = "bill_";
duplicateMovieClip ("bill","bill_", 0);
this[name5]._y = 65;
/*for(a = 0; a <= 20; a++)
{
enemyD[a]._y = invaderwidth + spacebetween + moveDown + 100;
}*/
Some of this is blocked out as well, we're also working on way to make the aliens move down, but that's not as important at the moment.
The above part is on the timeline, not placed on any movieclips. Hope that makes sense.
Thanks in advance
|