ActionScript 2.0 :: Clarification On Doing A Killing?
Jan 23, 2009
deleting, killing objects and functions. There seem to be a few different ways to achieve to completely get rid of unwanted objects and functions(which are in turn objects as well, no?)
Just to refresh:
objects:
Code:
object = undefined // does the job
object = null // does the job
exception: if the object is referenced anywhere else in the application, the object is still in memory, unless the object's reference is killed as above. also: if you attempt to try cleaning up and object , which has objects itself, (e.g. object.subObject = new Object()), then those subObjects are still alive.
To properly clean up the object with subObjects, the subObjects have to be killed off seperately.
My understanding is that calling clear() on a sprite object will wipe the screen clear of previous drawings for the next draw. But my code below renders nothing to the screen when there is a clear() called.
Code: var sp:Sprite = new Sprite(); addChild(sp); var g:Graphics = sp.graphics;
Does anyone know if we have to specifically remove event listeners that are added in a custom class that *only* listen to events dispatched from within the very same same class?
For instance, if I have a parent class that instantiates a child class that builds a simple UI which contains a few buttons that are only listened for in that child class, do I have to worry about removing them before removing the child from the display list & setting to null (on the parent-level)?
i have buttons in my library.url...into it when i edit it from the library but it always says "current selections can't have actions applied to it". How do i get to it so i can have a link pop up when i click the button? does the "getURL" also work for files on my computer? for instance i want to click a button and have a movie pop up from one of my folders on the c drive.
I have an MC(named "mouseTip") that gets added to the stage and follows my mouse on MOUSE_OVER. On MOUSE_OUT it gets removed. I just created a dynamic text field inside mouseTip so I can display type when mouseTip is present. For some reason, when that happens the mouse gets blocked by the textfield inside mouseTip and the MOUSE_OUT gets triggered.Once mouseTip is removed, the MOUSE_OVER gets triggered since the mouse is still over the button and my mouseTip MC just flickers rapidly.
i have some drop downs that i am trying to create but when i add some actionscript on (rollover) {stuff} it kills the over state of the button.I can add actionscript to a button and still have its over state show
I've attached the FLA.I'm trying to make a game where the guy kills rats that appear randomly as the scenery moves down, however every time I shoot the rat and remove the rat child, it throws an error that my actionscript is pointing to an inexistent rat. Hence my problem... is there a way to add many instances of the same class with AS3 at random intervals and remove them when it's shot with the bullet???
I'm confused on the parent/child thing. Seems like the "child" statement would refer to the file I'm loading, not the file I'm in? I want the file I'm IN to kill ITSELF when it loads the next swf (it's child?)And then there are other times when I want them to stack one on top of the other. I've added comments above each set of button code to explain./This code is in home swf. Handles portfolio buttons. I do not want to unload Home.swf, so this works fine.
A user is reporting that a certain screen of our Flex app times out in Google Chrome and IE. I can reproduce this problem, but I don't know what is causing it. I cannot reproduce it with Firefox.
I was wondering if there is a way to temporarily disable this feature in Chrome because I know that in Firefox(at least in v3.6) when a Flex/Flash app executes for too long I get a stack trace from the Flash runtime pointing me to the problem. example:
Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds. at TimeoutTest/___TimeoutTest_Button1_click()[/TimeoutTest/src/TimeoutTest.mxml:5]
I think that Chrome is hijacking this process and denying me that information, so I would prefer to prevent this behavior for now to see if the runtime will detect the timeout and provide a similar trace.
I'm trying to make a game where the guy kills rats that appear randomly as the scenery moves down, however every time I shoot the rat and remove the rat child, it throws an error that my actionscript is pointing to an inexistent rat. Hence my problem... is there a way to add many instances of the same class with AS3 at random intervals and remove them when it's shot with the bullet?
I have several thumbnails in my portfolio that dynamically load a .png file into the Loader component called myLoader.Followed the tutorial from Kirupa. Simple enough.
When I (user) goes to click on a different client to view different work, artwork from the current client is still loaded, or being shown. I have the same myLoader Loader spread through the frames.I tried to put this
Code: on(press){ unloadMovie("myLoader"); } on each client button to clear the Loader before you go to each section, but that makes it disappear all together, than when you go to click a thumbnail, nothing happens because the Loader is gone.Is there a way to unload the .png files w/o killing the loader? Should I use a separate loader for each client? or will that just get messy.
I've got several objects on a stage, each is an instance of a different class. Inside each of those classes is a timer, set to loop (basically refresh) every 5 seconds.Even after removing the instance from the stage and setting it to null, the timers continue in the background. Is there some way I can stop and remove all the timers with an object when I null it, or do I have to do that manually before removing the object?
I'm working on an iPhone game using AS3 and I've got it working pretty well on the iPhone 3G. I intend to compile it with AIR 2.7 (or 3.0 when it drops), but for testing purposes, I do everything on my 3G. Here's the problem,I get a solid consistant 24fps until one of my objects moves offscreen - even partially. If my "character" even goes a few pixels past the edge, frame rates drop tp 9-10 fps. I've had a few people already suggest not allowing anything to move offscreen, but that's not feasible. I've gone through my code to make sure there isn't a programmatic reason this happens, and I've created a seperate project specifically to test this - with no game logic, simply moving an image across the screen, frame rates bottom out once content goes over the screen edge. I've tried using masks, I've tried using scrollRect, I'm using cacheAsBitmap, and there is no scaling, only x,y translation.
I'm developing a game in as3 for iPhone, and I've gotten it running reasonably well (consistanty 24fps on iPhone 3G), but I've noticed that when the "character" goes partly off the screen, the frame rate drops to 10-12fps. Does anyone know why this is and what I can do to remedy it?
Update - Been through the code pretty thoroughly, even made a new project just to test animations. Started a image offscreen and moved it across the screen and back off. Any time the image is offscreen, even partially, the frame rates are terrible. Once the image is fully on the screen, things pick back up to a solid 24fps. I'm using cacheAsBitmap, I've tried masking the stage, I've tried placing the image in a movieclip and using scrollRect. I would keep objects from going off the screen, except that the nature of the game I'm working on has objects dropping from the top down (yes, I'm using object pooling. No, I'm not scaling anything. Striclt x,y translations).
When I am debugging broken code, after a while the browser announces that the Flash plugin has crashed, and I can't continue debugging my code. Can I prevent the browser from killing Flash?
I'm trying to kill a particle effect I've made for this animation upon a button event. Here's my script as it appears at the keyframe before the animation moves on:[code]When either of the buttons are pressed and the animation moves on, I want to remove the smoke children I've created at the top.
Why can't (or better yet) you kill client stream from server side - I seen some code that FME may call on server side like s= stream.get(streamOBJ.name); s.play(false); delete s; application.gc(); // over kill but still did not work