ActionScript Code:
var insert4:spin2MC = new spin2MC();
insert4.x = 490;
insert4.y = 380;
addChild(insert4);
setChildIndex(insert4, 12);
This MC is communicating with other MC's on this frame. It is for example placing MC hitspider at the same x as itself on EnterFrame.
[Code]....
But it still gives me an error. That it can't find the hitspider MC. Which is true cause it's not there. But since I removed the child why does it still look for this MC hitspider?
if i have a movie clip with an even listener attached to it, is the event listener being removed automatically when the movie clip is removed from the stage or should i always remove the event listeners manually?
I want to remove all children of the name (mc1) but be able to add new one when I call the add function again Heres what I have
// Draws the squares
Code: function drawIt(e:Event=null):void{ mc1.graphics.lineStyle(1); mc1.graphics.beginFill(ITsColor);
[code]....
Removing all the (mc1) movieclips works fine, but when i click on the butotn to call drawIt again, all previous mc1's are displayed again with the new ones
I was making a game and i made a back button so when you click it you go to frame 3.OK so i tested it out and when i clicked it my people and my tiles and everything was still there.
I am trying to remove a MC and then regenerate it later.I can remove the darn thing, but I am having issues regenerating it after it has been removed. Here's the code that I have:
I've got a shell movie clip which loads some other clips. In one of the sub clips, I have a key listener. Inbetween loading of the sub clips, I have it removing the key listener and the movie clip.
But the function that was attached to the key listener is persistant, even after the sub clip has been deleted, and I've attempted to remove the key listener from the main shell. What ends up happening is the second time you load the sub clip, it runs the function *twice*, or three times, or as many times as you click the link to load it.
When i run the shell movie, it shows trace actions from the sub clip even after it's been removed!
Using contextMenu, i removed all BuiltInItems. Its working fine in IE.when i am viewing the same html file in mozilla, "Show Redraw Regions" option is still visible when i am right clicking on browser. In IE, its fine.
I am sorry if this is a truly basic question, but how would I code as3 to remove an event listener when the current frame (in my case, section of my site) is no longer on the stage?ke the following code as an example:
function onClick(event:MouseEvent):void { doSomething();
I've got several images and when you scroll over each of them a window pops up with a slightly larger image of itself, and scroll off it removes itself, but when I scroll over it again it won't load the image.
/////// function preview0(e:MouseEvent):void { loader1 = new Loader();
I have a slideshow component that I want to remove when a menu button is pressed. My as3 for the menu is from the snippets pallet and I added to it to give the following:
the example is this, wich i am trying to remove a movieClip wich is 'mc' by clicking button, but after i click it, the object mc is still traced every time the startTrace initiates, that means its still there right? im using flash cs4,
Quote:
var mcRef; var mc:MovieClip = new MovieClip(); this.addChild(mc); mc.name = 'mc';
I am using addChild() to add a movieclip from the library... the movieclip being added has some functions inside of it. When I do a removeChild on the movieclip .. the functions are still running even though the movieclip is gone. how to kill everything in the movieclip once it is removed?
I have a tree component in my stage and i am using _visible property to make that component hide and show. but even after setting the _visible propery false the space of that component is showing a small green shade in my page. So i tried the
Code: tree.removeMovieClip();
property to remove the component fully from the stage. thats working fine but thats not restoring the same movieClip. Is there any options to restore that movieClip again?
I have a function called addRoom.A scroll pane with thumbnails of rooms, each thumbnail is a button. The viewport is empty by default. When I click a button the function is called, it adds a room to my viewport. If I click another button a new room is added but the first room still remains. How do I get the first room to be removed? I assume there is something wrong with my index.
Code: // add room image to the viewport function addRoom(event:MouseEvent):void {[code].....
I'm having a bit of a problem here. My audio is still playing when my swf is removed. I tried using unloadAndStop(); but this isn't working for me (either that or I'm not putting it in the correct spot. The code I have is from a template I downloaded, I didn't actually write all this. with this:
Parent swf loads a Child Swf. Button on Child swf closes child swf and dispatches event to Parent Swf to listen for to remove the child swf from the stage. Here is the code on the Parent swf that does that:[code]function within the child swf is still going on... this function randomly calls different sounds and I can still hear those sounds!How can I stop this function?
Im loading an array of text and the problem right now is that if I want to remove the whole array i need to use several removes and thats not what i want. So I put everything into a container and want to remove the container but it doesn't work only the last object in the array gets removed when i run the swf. Below is my code:
When bullets hit the wall of multi-colored blocks, when shot one by one, they disappear like they should. But if you hold down the Left Mouse Button, you will see that bullets stop in mid-travel and I can't figure out how to fix that. See this occur in this SWF. Note:(Use A & D to move left to right, Z to add a new row, and Left Click to shoot)
Here's the important function in the Bullet class.
Code: public function update():void { if(global == null){ trace("Global es null.");
I've noticed that using stage.addChild(obj)(i.e. creating objects on the fly) can slow down frame rates.I was told by several sources that one way to speed up a flash game engine (or any animation where instances are generated as you progress), is to reuse objects in what is known as object pooling.
First of all a bit of background:The game engine I'm working on can be found at: http:[url]....Most objects (i.e. bullets, particles, enemies...) are exported for actionscript, each with a set of actions that are performed each frame, and another set of actions upon being created.Each class has an array called instanceList, which keeps track of all objects currently within play.The main timeline contains an event.ENTER_FRAME function mainActions(event:Event):void, that loops through each of the instances and performs the actions associated wit11h each.It goes through each instance of each class by going through the static array instanceList().
Now what I plan to do is:Have a seperate static array for each class, called inactiveInstances,which keeps track of deleted objects.Introduce a function for adding the objects back to the stage (with the nesscessary variables reset), to give the impression of a new object being created.When objects are destroyed:Should they be removed from the stage and readded latter e.g. removeChild(obj2)/addChild(obj1)? e.g.
Code: public function instance_destroy() { parent.removeChild(this) //Remove all refferences and listeners[code].....
I'll keep this simple (I hope). There's a button with an event listener on a frame of the main timeline. You click the button to go to the next frame and a movie clip plays. The instance of that button doesn't exist on that next frame. Does the event listener for the button automatically get removed when you go to that frame since the button doesn't exist there?
The movie clip is set up to send the main timeline back to the previous frame when it's finished and my event listener seems to vanish when I go back to that frame.
i've list-based components. when i no longer require them, i just use removeChild() method. i've applied setStyle() method to them. i'm a bit consufed, do i really need to use clearStyle() method or without doing it, flash will take them in garbage collection?