Actionscript 3 :: Sound Complete Not Firing ?
Mar 30, 2012
I have a bit of a quandary. I need to call a function inside a MovieClip once a particular sound has finished playing. The sound is played via a sound channel in an external class which I have imported. Playback is working perfectly.Here is the relevent code from my external class, Sonus.
public var SFXPRChannel:SoundChannel = new SoundChannel;
var SFXPRfishbeg:Sound = new sfxpr_fishbeg();
var SFXPRfishmid:Sound = new sfxpr_fishmid();[code]....
osr.Sonus.PlayPrompt(...) and gui.Wait(...)
both work perfectly, as I use them in other contexts in this part of the project without error.Basically, after the sound finishes playing, I need Wait(false); to be called, but the event listener does not appear to be "hearing" the SOUND_COMPLETE event. Did I make a mistake somewhere? For the record, due to my project structure, I cannot call the appropriate Wait(...) function from within Sonus.
View 1 Replies
Similar Posts:
Sep 21, 2009
Can anyone see why my event.Complete isn't firing
[Code]...
View 4 Replies
Dec 5, 2009
I'm sure some users on this forum will be aware that AddThis are dropping the Clearspring Launchpad, so I'm writing a new API to get ready for the changeover. Part of that is a base UI that will create buttons for social network sharing destinations. At the moment, AddThis contain all the icons in a single long strip that is 16x3520 pixels in size [URL]...
What I'm trying to do is load this into a utility class, but the Event.COMPLETE event never fires, and if the Loader class that loads it is added to the stage, the bitmap is never shown. I thought it was maybe a dimensions issue, but what is curious is that if I place the PNG on a Flash stage and export as a SWF, it loads no problem. If I dump it out as a JPEG, no problem. Its ONLY when the file is a PNG that there are problems trying to load it. I even tried dropping it out as a 24-bit PNG (the original is 8) but that had no effect.
View 2 Replies
Oct 13, 2009
I'm dynamically creating instances of a loader in a loop, adding a complete listener to it, and loading it. For some reason the complete function is not called. Is this syntax wrong?
[Code]...
View 2 Replies
May 5, 2008
I've got a problem with the FLVPlayback Component: I'm using it to load multiple .flvs simultaneously.There are 3 Listeners listening:
vidListener.playheadUpdate,
vidListener.ready,
vidListener.complete
Now on some computers sometimes (But frequently enough, ) the complete event just does not fire. I really can't find a pattern or anything here. Sometimes it works, sometimes it doesn't.The videos were encoded using the Flash Video Encoder...
View 2 Replies
Feb 2, 2009
This was working just fine, then flash crashed last night, and now the first event listener keeps firing over and over, endlessly... Even if I remove the listener right there in the function being called...
Edit: Argh, somehow, I must have added a second frame to the timeline (which I have hidden because I'm not using it) so flash was looping the 2 frames over and over...
Code:
var xmlLoader:URLLoader = new URLLoader()
xmlLoader.addEventListener(Event.COMPLETE, LoadXML_complete)
xmlLoader.load(new URLRequest("filename.xml"))
[code]....
View 1 Replies
Mar 25, 2010
enter code hereBeen really frustrating just trying to load a swf from a swfloader in Flex and then accessing it's content. I'm sure once I figure out how to do it once then it'll be fine, but I've gone thorugh a bunch of tutorials and somethings not right. Here's my flex code:and the as code:
public function initHeaderSwf():void
{
trace("INITIATIED");[code]........
Here's the problem: The swf loads, there is no problem there.i see it in my compiled swf. but the complete event doesn't fire. CreationComplete will fire, and then I try, after that, to make a event listener for loading the actual swf, that doesn't fire.I've tried it a variety of different ways with no luck.All I am trying to do is change a text field in the loaded swf.I imagine this might be a problem with the sequence of things loading or something like that, but not sure.
View 1 Replies
Jan 24, 2007
I've got a custom Thumbnail class that reads in an image path, a label, and an index. The class simply loads the image and and onComplete it pulls the bitmap out of loader.content, assigns it to a public variable and then dispatches an event saying its completed.
I use these thumbnails in a thumbnail gallery and I don't build the gallery in until all thumbnails are loaded and ready. The problem is the COMPLETE event doesn't always fire for every thumbnail, therefore not allowing the gallery to build.
I used a ProgressEvent.PROGRESS to make sure the files were being loaded, and found that when the loads failed the loader still loaded the totalBytes.
I've also tried Event.INIT and its the same issue.
INIT and COMPLETE just don't seem to be either caught or dispatched.
Code:
public class Thumbnail extends Sprite
{
/******************************************************************************************
* VARIABLES
[Code].....
View 9 Replies
Aug 1, 2010
I write directly on the time line on the scene and, well... the code looks fine to me, but my list of slideshows (which is what the xml contains) keeps on repeating itselfe... here is the code:
var uloader:URLLoader = new URLLoader();
//var slide:Slideshow = new Slideshow();
uloader.addEventListener(Event.COMPLETE, loaderCompleteHandler);
[code]....
View 1 Replies
May 10, 2010
I'm using this.loaderInfo.addEventListener(Event.COMPLETE to call a function when the flashVars are available as many tutorials/examples suggest. Is it correct to use it in the root of the main swf? The event is often not firing in firefox.
Here's the test code. Am I doing something wrong?
Code:
import flash.display.Loader;
import flash.events.Event;
var flashVars=new Object();
[code]....
View 2 Replies
Mar 19, 2011
I�m getting Error #2032 when my URLLoader complete event finishes firing. What I can�t figure out is why. The complete event fires successful (I ran a number of trace statements to make sure it made it all the way to the end of the method with no error) and I�m not getting any helpful output when I trap the IOError. Here is the error message:
[IOErrorEvent type=�ioError� bubbles=false cancelable=false eventPhase=2 text=�Error #2032: Stream Error. URL: file:////Volumes/Macintosh HD/Users/shanemcgarry/Documents/School/DGM 6122/Final Project/�]
here is my code:
Code:
import flash.display.MovieClip;
import flash.display.DisplayObject;
import flash.utils.getDefinitionByName;
[code]....
View 0 Replies
Jan 18, 2011
I am a bit stuck here for the past few days. I have a SWF running in Security.LOCAL_TRUSTED sandbox. I can load my JPEGs and simple SWFs without any problems
[Code]....
View 2 Replies
Nov 13, 2009
I am working with Flash CS 4 with AS 3.0. I use the following code to hook into Loading complete for mystage:this.loaderInfo.addEventListener(Event.COMPLETE, loaderComplete);The code works properly in IE 8.0 (Windows 7) and Chrome. I have Flash Player 10 installed and the movie is targeted for Flash Player 9. The movies are showing a random behavior on FireFox 3.5.3.The website is under construction. The top bar contains 7 small & 1 big flash movie. View the page first in IE or Chrome. Then see it in FF. The labels from the flashvars are not being picked up properly. The load Complete function is not working properly.
View 5 Replies
Sep 9, 2010
I'm not much of a programmer. I want to call a sound and then have it trace when the sound is complete and go to a specific frame.
View 10 Replies
Sep 9, 2010
I need a simple frame script that will track when a specific audio file is finsihed playing followed by a "go to" command that targets a marker or frame number after the sound is done.
View 7 Replies
Jan 20, 2012
i couldnt attach my demo, its basically two buttons on stage, that play two seperate sound files, they can be turned on and off by a simple boolean.All songs are short sound files (going to be 10 second loops)What i want to know is, is there anyway to not start either of the sounds until the other one has finished its loop, so they are synchronised, so if i start one button off, and then put button 2 on midway through, it actually waits until buttons 1 sound is back at the start of its loop cycle until it starts to play it.If this is possible then i am excited as i am going to make a small little project [code]i have started working my way through the tutorials and already understand so much more about the basic concepts of AS3,
View 4 Replies
Apr 10, 2010
Sound object. Event complete doesn't work
function init() {
this.soundsArray[i-1].addEventListener(Event.COMPLETE, completeSoundHandler);
this.soundsArray[i-1].play();
this.blHit=false;
} function completeSoundHandler():void {
[Code] .....
View 1 Replies
Oct 19, 2011
I have tried this too but the value keeps on changing as the sound load progresses.
View 3 Replies
Jul 30, 2009
I've been using AS2 in FL4 for 3 months so I'm fairly new at it. Background info on my file: I am creating a mini comic strip. I am using Cuarina tweeners to have movie clips of (images, main characters and speech bubbles) appear on and off stage. I'm trying to add audio files for each speech bubble that appears.
The audio files are dynamically loaded using onStartParams...with Caurina. The problem I have is that I want to add listeners in action script2 to listen "for when the sound is complete" BEFORE, it moves onto the next function in the code.
[Code]...
View 3 Replies
Jun 14, 2011
I made a test where I download a file using URLLoader - something like this:
[Code]....
in the middle of the downloading process I physically disconnect the internet connection. the download stalls - but after aproximately 30 seconds downloadSuccessful is invoked, although only half of the data was downloaded. how can I make sure that the data to be downloaded is complete and correct?
View 2 Replies
Feb 17, 2011
I am loading in binary files with the url class which can be quite large 10mb + and it works fine on my server but another server I am testing on it can sometimes not work. Sometimes it will not load the file and other times it will only load about 20% and it throw a complete event??? Then of course other times it works fine. This server is https maybe that has something to do this it?
View 0 Replies
Apr 16, 2011
I am triggering short sounds dynamically from the library for a game (Specifically Air for Android). When the user clicks a button the sound can take up to 600ms to actually play. I have set it for any silence before the actual sound by calling the sound like so:
[Code]...
All return the same results. I know there are threads here that talk about this but none have offered a real solution that I can find. Is there no way to cache the sound or store it in a buffer?
View 1 Replies
Oct 4, 2010
here's the code.
var zipTimer:Timer = new Timer(1000, zipArray.length-1);
zipTimer.addEventListener(TimerEvent.TIMER, onTick);
zipTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
[code]....
Now, I can't see, for the life of me, why this isn't firing. It's almost exactly the code from Adobe's docs...zipArray.length is at least 32.
View 1 Replies
Dec 15, 2011
I'm working on a scene where the user can drag sugar, honey and syrup flavour to a cup of coffee and each time they collide, the coffee's happiness is increased by 1. I added a TweenLite so that sending any of the objects to their original positions is much more fluid. The problem is that the hitTestObject is now firing more than once (which makes sense and now happiness is increasing at more than one increment at a time) but how can I make it so happiness is increased just once?
Code:
public function hitsDecaf(e:Event):void{
if (myCounter.myHoney.hitTestObject(myCounter.decafSweetened)){
ifStartTimer = true;
stopDrag();
myCounter.steamHappy.gotoAndPlay(2);
[Code] .....
View 4 Replies
Jan 24, 2008
I have the following:A document class, extending from a custom class, extending from MovieClip. In my document class, I assign a handler to the FullScreenEvent like so:
Code:
addEventListener(FullScreenEvent.FULL_SCREEN, function(e) { toggle_fullscreen(); });
Also, I've set up a SimpleButton to call that same function, toggle_fullscreen, when clicked.Here's the catch:When I click the button, my app goes fullscreen. When I press Esc, the app goes back to normal but the FullScreenEvent doesn't get fired,so I can't catch it to re-align the elements on my stage.I've also tried to add the event listener to the stage object of my document class, but that doesn't work either.
View 4 Replies
Sep 20, 2010
The problem is that I've done a lot of work in my game, and there's too much code bound to shift and control keys. For example you need to hold shift key to select multiple soldiers or control key to shoot or sometimes pause the game or even call a map, a lot of stuff in GUI depends on those keys as well. Both KEY_UP and KEY_DOWN are added to the stage object. But, time after time, there happens a very annoying thing, KEY_UP event just doesn't fire for shift or control (in most cases it does, but not always). That is, I press shift, start selecting soldiers, then release shift but Flash Player keeps thinking it's still pressed, so I can still select multiple soldiers, which is not good.
I found the exact same problem here: [URL]
View 6 Replies
Jan 19, 2010
I have some code where an event handler listening to Event.ID3 fires twice for an MP3 file. From searching the web, I found a few others asking a similar question, but I haven't seen any response.
Does anybody know what would cause the ID3 Event to fire twice for a single file? My only guess is that the MP3 file contains two versions of ID3 format.
The code looks like this:
Code:
var mySound:Sound;
function setup()
{
[Code]...
View 2 Replies
Feb 14, 2010
I am having a problem with my ProgressEvent.PROGRESS handler. It looks like this:
Code:
function handleProgress( event:ProgressEvent ):void {
var percent:Number = Math.round( event.bytesLoaded / event.bytesTotal * 100 );
trace("Uploading %" + percent);
}
It just traces "Uploading %100" every time
I am using a big file so I know its taking several seconds between calling URLLoader.load and complete. There just doesn't seem to be a report in between 0-100..
View 12 Replies
Nov 18, 2009
I keep running into problems where I want to add an event listener onto a class instance RIGHT after it's instantiated, like this:
Code:
storiesXML = new XML(XMLdata);
storyBook = new vStories(XML(storiesXML.stories));
storyBook.addEventListener("storyBookLoaded", storyBookLoaded);
. . .
But by the time we arrive at the third line, the "storyBookLoaded" event has very often (inconsistent) already been dispatched from my class instance:
Code:
var evt:Event = new Event("storyBookLoaded", true, false);
dispatchEvent( evt );
...
(Even though quite a lot has happened in the class before that.) To be clear, I don't want to add storyBook as a display child, and even if I did, the addChild() method would have to be called after instantiation of storyBook, so we'd have the same problem. I know I could set a timer in the vStories class to artificially delay the dispatching of the event, but that seems really hack-ish, and would have a real compounding problem if I have to do it too often as everything builds up. How to make sure custom communication events happen after their listeners are set?
View 4 Replies
Jul 13, 2010
I have a little flash app that I have running constantly on my server (I made it an exe). It runs great for a few days, but then eventually it just stops.
Code:
trace("test1");
var myTimer:Timer = new Timer(5000, 1);
myTimer.addEventListener(TimerEvent.TIMER, getData,false,0,true);
[Code].....
The code above should call the function getData once after 5 seconds have passed. This works 99.99% of the time, but for some reason (usually after a few days of it running) it doesn't call the getData function.
I have verified this through trace statements. When it eventually fails, it traces out test1, test2..... then nothing else. No test3.
I'm assuming I need to add an event listener for the timer object to check if it fails for whatever reason. How do I do this?
View 4 Replies