ActionScript 3.0 :: Flash - Do SoundChannels Cleanup After Themselves
Sep 13, 2010
If I call the play() function of a Sound, which returns a SoundChannel object, will the SoundChannel still linger around after the sound clip is finished playing and eat up resources? Or will Flash's garbage collection scoop it up?
Generally when you unload an swf from another swf you would follow a cleanup utilzing removed from stage or unload events. But when you exit an as3 flash application by either navigating away from page or reloading the page or closing/removing the application. what is the best practices you would follow to ensure proper cleanup and garbage collection.
Question : what methods in solely as3 code can be used in this regard. It may be argued that once an swf is unloaded or removed its memory foot print can be verified to have decreased eg via the task manager Is this a good enough measure? Or is it advisable to handle the unloading/exiting in a proper manner ?
[URL] I needed to do clean up before the MC is gone ... so after some digging I found this event:
Event.REMOVED_FROM_STAGE
So I am trying to ask for some conformation here: Is this the ONLY situation that my MC will be deleted automatically by Flash? If so then I can just listen to this even and call my cleanup function when it happens...
Trying to reduce frame overhead in my game, im trying to figure out how to speed it up.These are some 'simple' questions if you know your way around sounds and channels so i'm hoping you'll read on and perhaps give me some insights.
I'm noticing that playing soundclips sometimes make it stutter so im looking for the best way to use sounds and channels.The main question is below: how costly is a soundtranform.volume and is it persistent on a channel?secondairy; does it matter howmany soundclips i drop into the same channel?What i noticed: The channel.soundtransform.volume only works after playing the sound. Q: How costly is a channel.soundtransform.volume?&; Will it stay this volume on the next sound that plays? or do i have to reset it each time?
Also: playing a lot of sounds in 1 channel isnt a good idea.So i created a channel for each gameobject that could produce sound.On each sound play i calculate distance from main player and set volume accordingly.
1: I could just pre create like 10 channels set the volume from 0.1 to 1.0 accordingly then play each sound in the specific range channel This way i wouldnt have to do soundtransforms on the fly.If however every sound producing object would be at the same distance it would clutter 1 channel with a lot of clips to play at the same time.
2: I could pre create 10 channels as a queue. On every play i would pick the next free channel, looping & wrapping through them as i go. Here however i will have to set the soundtransform volume again on each play according to distance.
I'm trying to synchronize 5 mp3 (128kbs 44hz stereo), each one in a different SoundChannel, and some animation. I've red a lot about the variable delay of the soundChannel, and how the "position" property return where the soundchannel should be, and not where it actually is. But I didn't find any real solution to these issues.
For the moment what i'm doing :
- load the 5 mp3 in their soundChannel
- start the soundChannels
- put a timer to check the first soundChannel position to change the animation
I've tryed to solve the delay between the soundchannels by resynchronizing them after a few seconds to the first soundchannel position, but it's only getting worse.
I'm using Flash CS4 / AS3 but I can easily go back to AS2 if needed. And I can embed the mp3 in the swf or using any other audio format.
I figure that this code can be reduced with a for statement, but I can't figure it out. Here is my code, and below that is my attempt.On the stage I have 6 movieclips named nav1_ani, nav2_ani, etc. I also have 6 buttons above them named nav1, nav2, nav3, etc.Here is my code, here I got #5 and #6 working. Instead of duplicating all this code, is there a way to bunch it all into one "for" statement?
Just finished some swf files update, but as computers retain information (cookies) if site as been visited before, im not sure that everybody will see the update. How can i prevent this?
I create some elements( UIComponents, mainly Panels) inside the "mx:Application name=¯tst¯ . I need to cleanup all those UIComponent's on MouseClick event , using Actionscript. Is there any way I access the children elements of mx:Application ( I used var totalChildren:Number = this['tst'].numChildren ; but looks like it fails to access the children list).
However I find that if I try to test my movie after making some quick changes, I can't bind to the same address:port. I'm guessing that somehow that the port is still occupied. I get a "Operation attempted on invalid socket" error.But if I wait a bit and then test my movie, I can bind to the address:port. The close() is not taking affect. Can I try to close() this when the user decides to exit the app? Is there some sort of event that allows me to do something before the app quits?
A project I'm working on is working just fine at first, but as I perform more actions, it slows down noticeably. I've made sure to clear any onEnterFrame and setInterval events, so I don't think the problem lies there. Most likely, it's because practically every time an action occurs, much of the content on the screen is redrawn/recreated. However, every time I create a movie clip, text field, shapes, etc., I call a function to remove it beforehand:
Code: function killThis(mc:MovieClip, thingsName:String):Void{ var obj:Object = mc[thingsName]; if (obj instanceof MovieClip){[code]..........
On a recent project I am working on, I created an event-based sound engine. Different components within Flex will be registered, and then the controller will listen to events and handle the information correctly. So, it just takes a custom SoundEvent or ChannelEvent to alter one of the channels, or play a sound.
I can not quite figure out what is wrong with my code, and I am finding myself snow-blind to the issue at hand. At first, I was going to rewrite it but I figured it would be better to learn from my mistake. Also, I realize that this is not correct for streaming sounds, but I am working off a local sound library until I get it up and running smoothly.
Here is the code for the SoundEvent:
package code.events { import flash.events.Event; public class SoundEvent extends Event
I have a Flex client application. I need a clean up function to run in Flex when the user closes the browser. I found the following solution on the net, but it only works half-way for me. How could I fix it?CustomEvent triggered, but not executed. >> EventHandler for CustomEvent.SEND_EVENTS is defined by a Mate EventMap. All the handler does is to call an HTTPServiceInvoker. In debug console, I'm able to see the handler and HTTPServiceInvoker being triggered, but neither the resultHandlers nor the faultHandlers were called. I know this event handler has no problem because when I dispatch the same CustomEvent.SEND_EVENTS in a button click handler, it behaves exactly as I expected)Browser seems to wait for cleanUp function to complete before it closes. (all traces were printed before browser closes down)
Code I added the following into the index.template.html window.onbeforeunload = clean_up;
I have an swf loaded in a browswer (fire fox) and i use log on console using [code]I have initialized my swf in the document class on the Event.Added to stage.and i have a clean up function performing all the clean up/exit process in the code on the event [code]Now Doubt that this is being called/ activated/trigered as i am not able to log the start and end of the function to the console.The console log is of firebug.What exactly am i missing here? I would like to call the cleanup function on reload of page or relode of swf or change of page.How do i trigger and log it properly
I'm working through Dreamweaver fairly well, and I'm now wanted to import Flash buttons I've created myself into Dreamweaver for a website I'm currently building, and it's here that I'm finding the problem. I have been to the 'get URL Function', but it says something about needing to link to a web page? But my problem is how can I link Flash Buttons to a web page, when my site is still being developed and not published? Do I have to publish first?
:confused:Does anybody know is Flash mx 2004 compatible with flash CS3 and flash 8?? I can not open flash cs3 on my laptop with flash mx2004 also can actionscript 3.0 be used with flash mx2004 and flash 8 because when I save my flash cs3 document as a flash 8 document it does not work? I am awful confused with all this. If you created a flash website in flash 8 or Flash mx2004 you can not open in in flash cs3 it dosent make sence?
Are there any programs or features in flash that can simplify flash vector art?
I just realized that one of the reasons why my program might be running so slow is that I made the images out of lots and lots of circles. When things didn't look right I often just put larger circles over smaller ones. I didn't think that flash might still be drawing the invisible circles underneath-
We've got a green screened video playing in a flash movie over top of our html content.when the movie ends, flash uses external interface .api to call a javascript function which swaps the flash movie out with a 5 x 5 pixel flash movie (rewrites the <div>).this works and you can interact with the html content after the flash movie in all browsers except firefox.anyone know of any work-arounds or is there a better way of handling flash over html in this fashion?
I have absolutely no idea where to post about this, please move if necessary.So, I've just installed flash player 10 and now my flash tracer plugin (in firefox) won't work. do i have to switch back to flash player 9 or is there a solution to this?
i have the correct path in Flash Tracer's settings (C:Documents and SettingsAdministratorApplication DataMacromediaFlash PlayerLogsflashlog.txt) as well as the mm.cfg file in C:Documents and SettingsAdministrator.
I have made a small rectangle in the flash with the tweening effect and export in to the FLEX. When i publish in the FLEX i could see the rectangle with out tweening effects.How can i see the tweening effects.
ive publish a html file with flash detection enabled from flash.[code]now since the default codes places my flash movie on upper left corner, ive made my own tables with the flash on it, how or where do i place this code to the upper codes?[code]
We are developing our app in flash/flex builder for the front end hitting .NET backend webservices. There is one section of the old app that will not be initially converted, so we need have it appear in an iFrame.
So far all that works fine.We shrink the size of the SWF in the host page to just be the menu/nav area. And underneat that I have an iframe control that loads in this page from the old site.Now the problem. in the SWF is a drop down list to enable picking a client. Since the SWF has been shrunk to about 100px high, the drop-down will only occupy within that 100px area which it's opened. This is NOT good as you can imagine. How can I make the drop-down list descend over-top of the IFRAME control and thus extend outside the SWF dimensions? Is this possible?
I tried to make the internal stage transparent and leave the SWF a little larger, about 400 px high, but the IFRAME still appears behind the SWF.
I'm familiar with C/C++/Scheme/Java/OpenGL/TCP/IP.I need to learn how to build a tile based / platform flash engine.What tools should I be using? What books should I buy?I strongly prefer tools that let me do things programatically rather than through a graphical UI.
Is the Flash Video (or Flex VideoDisplay) component capable of seeking to an exact moment in a video?It seems to always 'snap' to keyframes (which is understandable). I'm just wondering if there are any mechanisms in the video classes for seeking to exact frames, ie it should do the translation from keyframe to specific frame in the background rather than having to actually play the video forward to the desired frame.This is not a streaming file and has nothing to do with buffering. The player is just downloading a movie file from the web and playing it from memory.
Situation: Got a flash object with an icon bar (div with pngs) on top of it. Works on all browsers except Firefox 3.6 on Ubuntu 8. Example: http://ListAndPlay.com
Problem: Icons suddenly disappear after the flash is being loaded. See this screenshot: http:[url]...What I've tried: Setting z-index, recoding the JQuery behind it, nothing works.
Good day to everyone. I'm here today to seek help about Flash CS4 and ActionScript 3.0. The story starts when one day, my boss asked me to make a flash presentation about their upcoming user training for a newly developed software. I was enthusiastic and excited about it because it's been a long time that I did not use Flash (note that I don't have any experience in ActionScript 3.0). At first, everything was a bit rough as I need to recall how to properly use the frames to create a successful animation. As I was about to finish the project, my boss approached me again and asked if I could insert a menu page in front so that the users won't have to replay the whole thing again just to look for a little something on that part of the movie. So yea, at first I was abit hesitant to accept. I said that it will work with Powerpoint. But she's a total pusher and I was forced to say yes. Now I'm having this problem about how to make a flash button load a swf movie.I've tried searching all over the net for tutorials but most of the times the "getUrl" and other stuff are said to be outdated.