ActionScript 3.0 :: Deleting/freeing Memory Of Sound/Audio Files?
Jul 27, 2010
I am trying to create a .dispose method for my Sound files, however it seems I am unable to deallocate/free memory for Sound files, no matter what I do!this doesnt work:
ActionScript Code:
var mySound:MySound= new MySound();
mySound = null;
and neither does this: (the 'delete' dynamic variable was suggested somewhere)
ActionScript Code:
var playerObject:Object = new Object();
playerObject.sound =new MySound();
playerObject.sound = null;
delete playerObject.sound;
playerObject = null;
it seems if there was a reference to the SoundFile in the code, the Memory cannot be re-allocated.however If I am loading an external file, interestingly, this does work:
ActionScript Code:
var mySound:Sound= new Sound(newURLRequest("sound.mp3"));
mySound= null;
it looks like you cannot Free memory of Sound Files that are Loaded from the Library, but you can free it if its external.
View 5 Replies
Similar Posts:
Feb 9, 2010
I'm having a bit of trouble in a game application I'm building,I recently added a bit of code that makes the game more visually interesting. As you move your character around screen, it creates instances of the GFX_Dot class, which is tied to a small green dot.In the class file I have a timer which decreases the alpha of the dot until it hits zero, at which point I'd like it to delete itself. Here are the functions I've got in the GFX_Dot class:
//GFX_Dot class
public function GFX_Dot() {
randomize();[code]..........
The part at the end "delete this" is meant to delete reference to "this" and allow it's memory to be re-used, however upon running the program, it's clear that they must not be deleting themselves, because after half a minute of creating a new GFX_Dot every frame at 30 fps, the game begins to get very slow. Before adding these graphical elements the game ran snappy all the time, I'm almost certain it has to do with them not being deleted properly.
View 1 Replies
Sep 29, 2011
I'm having a problem where I load my SWF (Advertisement) into the dom after an event happens in a flash game. After viewing the ad, the SWF is removed with JavaScript and users continues to play, this continues several times without ever reloading the page.
The problem I am running into is in IE 8 & 9 performance of the game drops and frame rate becomes choppy after several ads are shown. Each advertisment has a timer built in and my thought is that the ad is not being fully removed from memory hence causing a slowdown.
Is there a way to ensure a full removal of the ad or at least a way to detect within the ad that it is no longer on the page & kill the timer?
View 1 Replies
Mar 26, 2004
Is it possible to delete a LoadVars object from memory, as well as its contents? Say I load 20k of data into a LoadVars, and I delete the LoadVars Object, does it stop loading variables into memory, and does it delete the memory that it importing?
View 1 Replies
Mar 26, 2004
Is it possible to delete a LoadVars object from memory, as well as its contents? Say I load 20k of data into a LoadVars, and I delete the LoadVars Object, does it stop loading variables into memory, and does it delete the memory that it importing?
View 1 Replies
Nov 11, 2010
Is it possible to play multiple sound files using a single sound object? (I've looked into this back when I was using Flash CS3, but I want to know if anything has changed.)
(I'm trying to make a playlist which will play music in the background of my SWF movie and then have a frame where users can change the song and the volume.)
View 2 Replies
Jan 20, 2010
I'm having some trouble getting Haxe to play audio files in Flash 8.At the top of my hx file, I have:import flash.MovieClip;import flash.Sound;and, within the class itself, I preload a lot of image files along with the names of the audio files.The idea is to do a slideshow with audio content. Basically, display the first slide and play the audio associated with it.Then, once that audio is finished, move on to the next slide and next audio file. I have the slides fading in and out okay but when I tried to add sound, nothing comes out the speakers.The following code is what I'm doing - the sound file associated with audios[0] never starts playing and I'm at a loss as to why.
class Whatever {
static var master : MovieClip;
static var slides : Array<MovieClip>;
[code]......
View 1 Replies
Sep 10, 2011
I wish users to be able to email me files. I know AS3 you can upload files (PDFs up to 25Mb). Is the best way to:1. Upload the file in flash, and get PHP to then directly email it to me2. Upload the file in flash, get PHP to save the file on a server, then email it to me3. Upload the file in flash, get PHP to save the file on a server, then email a link to me for me to download If it saves the file on the server (options 2 and 3), what happens about deleting the files as after a while they will take up lots of space.
View 4 Replies
Aug 4, 2009
I am converting from .FLV's to .F4V. Video outputs fine but the audio sound stops after a few seconds from the beginning.I have tried many different settings for the audio with no luck. Also, tried on a colleague's machine who is running CS3, which works fine, so something is buggy in CS4...
View 1 Replies
Dec 22, 2011
Say I got a live event called game in "C:FMSHOMEapplicationslivepkgrevents\_definst_game" and push a MBR stream for awhile and see the ".stream" files being created, everything works good.
However whenever I stop the stream, delete the contents and try to republish another stream to this event name never recreates the '.stream' files or stream directories.
1. Delete the files "C:FMSHOMEapplicationslivepkgrevents\_definst_gameMsadsaasa.str eam","C:FMSHOMEapplicationslivepkgrevents\_definst_gameMsadsaasa .stream".
2. Delete all the stream directories - "C:FMSHOMEapplicationslivepkgrstreams\_definst_game1", "C:FMSHOMEapplicationslivepkgrstreams\_definst_game2".
Is this normal behavior or is there a default waiting peroid before reusing an event name? Should I only publish to a liveevent name once?
View 2 Replies
Oct 6, 2011
I have a broadcasting project that I've got where the host of the show can have multiple sound effects they can use on their show.I'm wondering if the only way to go about this is for all the clients listening to the show need to download the mp3 of that sound effect or if the sound effect could come from the host ...like combining his mic (for his voice) but also straight audio (the sound effect) into the stream.
View 1 Replies
Jan 10, 2010
how o remove sound from the memory?I'm using an Object for this right now and I want to know if I am doing the right thing... or there's another alternative.[code]
View 2 Replies
Jul 30, 2009
Is anyone else seeing this? After several minutes (less than 10!) of doing nothing but editing a .as file, I see an impending crash in the form of little pink squares around the scroll bars. Most of the time, if I save right then, then exit Flash, I escape without losing any work. If I ignore the warning signs, or sometimes just by Ugly Surprise with no warning, Flash crashes. It doesn't seem like using the app as an IDE for AIR apps, especially when doing little but composing and editing source files, ought to be that taxing.
View 1 Replies
Jan 15, 2010
There are a number of posts on here about merging XML with Java, but I can't seem to find any reference to Actionscript for the same task. I have a group of XML files that I need to load. I want them to sort into one XML Object in memory. For example, let's say these were my XML files:
[Code]...
View 1 Replies
May 25, 2009
As titled, what is the way to record video/audio files using Flash Meida Server through rmtp, and allow users to access the recorded files through http?What I am trying to do, is to record a user's microphone's input and save it to the server.fterwards, I would like other users to be able to access the recorded files and mainuplating the audio data, by computeSpectrum(), to do some visualization of the audio. As I know computeSpectrum() cannot work on streaming files, so I think I need to access the recorded files using http instead of rmtp. Is that true?
View 1 Replies
Jun 27, 2009
I'm making a flash movie and I have all of the audio timed out right in the .fla, but when i hold Ctrl+Enter to play the .swf, the audio is not timed right. I haven't expoted the video yet so I'm hoping that the file will be fine when exported.In the file attached, (it is unfinished) the audio, "You talkin' to me?" should happen after the camera has already finished panning up to the man's head. Instead, the audio plays while the camera is panning upward.
View 3 Replies
Nov 24, 2009
How to compare two audio files to see the difference of them.
View 4 Replies
Nov 12, 2008
Is it possible to mix several audio streams? I want to play several audio tracks simultaneously, but several factors that are at times, the audio tracks are out of sync, such as latency Sound.play method, the for loop, the spec of users PC, FLash Player version, operating system etc
View 1 Replies
Jul 1, 2010
I'm looking to start learning a scripting language for web audio and sound development. It needs to be able to handle simultaneous audio events, eg; to trigger a sound when another is playing (I'm not sure if and how this is possible, but have witnessed this kind of presentation: [URL] (can this kind of thing be done with JavaScipt?, this looks like AS / Flash)).
From what I can tell the choice appears to be between JavaScript (JS) and ActionScript (JS), with details as follows: - If going the JS route (look into JS and HTML(5) audio capability) Learn about the basics of HTML and CSS, and then start to look into JavaScript, Ajax, and JQurey (library / framework for JavaScript). If going the AS route Will not need to know as much about HTML and CSS. AS is the language behind Flash. Not supported on the i-phone(?) I know Java to around an intermmediate level.
[Code]...
View 3 Replies
Jan 28, 2012
I'm working on an app to stream audio from shoutcast. The streaming goes well on my computer and when debugging it with an Android-configuration. But when I deploy it to an APK-file and run it on a Samsung Galaxy S, the streaming doesn't work.
My code for streaming the audio:
var urlRequest:URLRequest = new URLRequest("http://.../;");
var soundContext:SoundLoaderContext = new SoundLoaderContext(2000, true);
soundChannel = new SoundChannel();
sound = new Sound(urlRequest, soundContext);
soundChannel = sound.play();
I've also tried an addEventListener(Event.COMPLETE), it seems my app doesn't get there when running on a Samsung Galaxy.
View 1 Replies
Sep 8, 2009
I've been working on a Flash/XML audio player and have been struggling with getting the audio to stream. Right now I have Flash create a list of songs based on the loaded XML file, which works, and I want to be able to click on one of the listed items for the song to start playing. When an item is clicked on, Flash will trace out a message from an onLoad command, but the audio never starts playing.
I opened a new Flash file to test the non-working segment of code and I still can't get it to co-operate.
Code:
var currentsong:Sound = new Sound();
currentsong.loadSound("http://www.vtspencer.com/recordjackets/beta/media/file_11.m4a",true);
[Code]...
All that happens is that the trace saying "Should be playing" comes through. The music still won't start.
View 1 Replies
Sep 8, 2010
I'm picking up Flash and AS3 after working with AS1 a few years back. My first project is a mp3 player that is able to take an mp3 file, a start loop point, and an end loop point to loop the mp3 without any gaps or breaks in the sound.
blog.andre-michelle.com/2010/playback-mp3-loop-gapless
I found this page that got me started, and went off of that code. The resulting player works perfectly except for one fatal flaw. As far as I know, the mp3 file must be fully loaded to be able to use the Sound.extract method on it, this can take a while when the files are 3-4 MB, especially on slow connections. I want to be able to have the audio start playing as soon as the mp3 file begins loading.Is there any way to use the Sound.extract method on a streaming audio file that has not fully loaded yet?
View 6 Replies
Nov 14, 2005
I am creating a flash project which contains video on a few pages. The project also contains background music which loops continuously. The goal is to have the background music stop whenever the user is on a page containing video and for the music to play again when the user leaves said page. The script I created works to stop the music, but it also stops the audio contained within the video and causes the video player (by proxxus) to lock up.
Here's the setup:
Library:
music.wav - linkage = "myMusic01"
Main Timeline:
Code:
//-- create a variable to determine if the current movie contains video
var currMovie:String = "notVideo";
//-- start playing sound object
myMusicMc.myMusic.start(0, 999);
[Code] .....
On the actions layer of the movie clip containing my navigation controls snippet of the callback used
Code:
videoLink_mc.onRelease = function() {
_parent.prodDetail_mc.gotoAndPlay("video");
_root.currMovie="Video";
}
on all the other buttons currMovie is set to "notVideo".
View 12 Replies
Feb 9, 2011
I'm converting some old RealMedia audio-only files to use with the SWFOBJECT Flash player on the web. What's the best container/format to use for the files? I think AAC is probably the best format, but then can you play a *.aac file in the Flash player?
View 2 Replies
Oct 5, 2005
If i load an external mp3 file from either the internet or a user's computer, can i use the file's details (artist, album, etc).I don't know how to explain it, i think you can set the file's details in windows media player or winamp, and it gets stored with the file.
View 5 Replies
Feb 14, 2010
As I've searched a lot and couldn't find it I thought of asking it here. Is there any good package or tutorial on Audio Manipulation? With this I'm not talking about play/stop/volume etc, but more on bitrate/speed manipulation etc. Or reading values in the sound (like an EQ does basically).
View 2 Replies
Feb 8, 2011
I have a few animations that run on different scenes each time a scene is loaded the external audio should start with it. Well here is the thing the animation always starts before my audio files and each scene gets bugged. I need to create an action that only allows my scene to start with the audio and also starts loading the next audio so it wont be dellayed.
On the first scene I have the following code:
scene 1 frame 1
var autoPlay:Boolean;
if(!autoPlay){
stop();}
scene 1 frame 2 animation starts and audio 1 loads
import flash.media.Sound;
[Code] .....
View 3 Replies
Sep 13, 2011
Is it possible to create functionality like fast forward and fast backward of given sound file that plays in swf with AtionScrip3 and how?
View 2 Replies
Oct 11, 2011
I would like to create a game that would analyze an mp3 a few seconds ahead of where it is playing live. A basic idea would be similar to guitar hero, the 'frets' you can see coming and prepare, then they hit and sync with the song in real time.
Is there a way to analyze a Sound file ahead of time, or analyze a muted Sound file?
View 1 Replies
Jan 19, 2009
I want to stop my background music(audio) from playing when i click on a button which loads video[code]...
View 0 Replies