flash sound malfunction - audio

Problem summary:
A sound (stream) placed inside a movie clip that is within another movie clip will start playing continuously when I use the play control to jump around on the main timeline.
Details:
I am using Flash CS3 but the same issue occurs with CS6. I've spent quite a bit time to search/research for the issue but didn't find a solution. To demonstrate the problem, I've reduced the flash movie to a very simple structure.
One the main timeline:
The first frame has a movie clip (Game MC) and a stop action.
Following the first frame, there are several frames, mostly empty except some text.
The last frame has a stop action.
On the Game MC timeline:
There is only one frame. On that frame, there is a movie clip (Card MC), and the stop action.
On the Card MC timeline:
It starts with 3 blank frames and a stop action.
Starting at frame 4, a sound (.wav format) is placed and is set to be "stream."
At the end of this timeline, there is a stop action.
From Flash CS3, I press Ctrl+Enter to test the movie. The movie stops on frame 1 of the main timeline with the card showing, no sound, as expected. Now I use "." to move the play head forward one frame at a time. No problem. I see the frames after the first frame. Still no sound, as expected. So far so good.
The problem starts when I use "," to move the play head backward, the sound in the Card MC starts to play, regardless where the play head is, even when the Game MC (thence the Card MC) is not on the stage. Worse, each press of "," will trigger another start of the same sound overlapping with the previous one. And the sound would continue in loops until I close the swf.
However, the problem will not occur if I place the Card MC directly on the main timeline. It only occurs when it is inside another movie clip (Game MC).
I need to solve this problem because the full version of the flash card game is to be placed in an HTML page with a javascript based play control, which allows the viewer to jump around in the swf timeline.
The fla file is at: https://docs.google.com/file/d/0B_5mgotjr4l5RDZaOGxFeFFWN1U/edit?pli=1
Any insight will be greatly appreciated.
Keith

This turns out to be a bug in Flash indeed and was told that it would not be in the next version of Flash. The workaround is to use the Sound class to load and play the sound.

Related

Using jPlayer to play 2 audio files and switch between them without stopping

I am trying to implement JPlayer on my web site in order to play a "before and after" rendition of the same audio. I would like to use this to allow people to easily compare the effects of an audio processor (e.g. this is "with the EQ", this is "without the EQ").
To do it, I'd like to have:
1 player (1 "Play" button, as simple as that)
2 buttons with "before" and "after" or "without" and "with"
Example:
User clicks on Play, the "before.mp3" version plays...
...if they click on "after" the audio keeps going (it does not rewind) and switches to the "after.mp3" audio file.
...player eventually stops at the end of the clip.
Thanks in advance,
I still have not implemented it and I am brainstorming if this can be done with JPlayer.

Sound interaction between two sprites in MIT Scratch

I am trying to create a DJing program in which one song starts when a sprite is clicked and another song starts (and the first one stops) when a second sprite is clicked. My solution has been to create a variable and use it as an on/off boolean, however the first song continues when the second song is activated. The code for the other sprite is the same with the variables changed.
I misstated the question: I'd actually like to keep one song playing (even if the other song is activated) until the related sprite (button) is clicked again. But using the suggestion of 'set volume to 0%' I was able to create this solution:
In fact you need no boolean. For first sprite the code is
When sprite clicked
stop all sounds
start sound (whatever sound you have)
For other sprite you do the same thing

How can the following errors be resolve in SCRATCH?

I created a bouncing ball game in scratch for CS50 PSET0.
The game works well as I expected, except for the following bug/errors:
The game can be paused by pressing the UP Arrow key on the keyboard, even BEFORE it is started or AFTER the game is over. THIS SHOULD ONLY WORK WHEN A LEVEL HAS BEEN SELECTED AND GAME STARTED AND NOT BEFORE OR AFTER IT IS STARTED. [WORKING ON IT]
I set the Paddle dragmode to not draggable, yet it's not working as you can still drag the paddle using the mouse. [SOLVED]
Falling eggs/bomb won't stop falling when the game is over or paused. [TRYING TO SOLVE IT BROUGHT A NEW BUG] One egg appears at the bottom of the screen after I paused and resume the game. I'm not sure how to hide that one stubborn egg.
On hitting the paddle or edge, the ball bouncing isn't very smooth and natural. It sometimes lag. [WORKING ON IT]
JUST CURIOUS: Why is the code "when I receive Setting btn Clicked" not working on the sound and music button sprite? [SOLVED]
I will appreciate all your kind suggestions.
Here's my project
NB: if the question seems unclear and you tend to understand it. Kindly feel free to suggest an edit. Thanks.
For point 1, you could test with an if statement whether the game is currently running. (Using the same variable you use to pause the game.)
As for the dragging of the paddle, I can't seem to drag it. That is, I can't drag it when I am playing, but I can when in the editor. This is always the case, you can drag any sprite around while editing, but not when playing without the editor open. This is the default behaviour of sprites as well, you do not have to declare it each time. A reason for you to want to drag sprites is when you use the Pen Extension to create a drawing program.
To stop the eggs from falling, you could pause the clones the same way you pause the ball when moving.
To let the ball turn more smoothly you could let it turn between an angle from -90° to 90° opposite to the surface it hits. To implement this would be quite difficult with a single line. You could, if you don't mind it hitting the edge instead of the border you built, split it so you include the built-in block: if on edge, bounce. The if-statement would then only include the touching of the paddle (and maybe the danger bar). In this statement, you would select an angle between -90 and 90 degrees.
For 5, there must've gone something wrong when you wanted to design this, the when I receive [setting btn clicked v] block is just not connected. :)

is there a way to flush the page cache? (window.init and audio autoplay won't work)

If I have an interactive widget that has something like
window.init = function() {alert('foo');};
or
<audio src="foo.mp3" autoplay="" loop=""></audio>
then when I close the interactive widget and bring it back up again, the init() doesn't run again and the audio won't automatically play.
In the case of audio, the sounds stops playing when you close the interactive widget. When you reopen the interactive widget, the sound does not start playing automatically.
However, if I page left or right a few pages (until I see the "loading..." indicator), then the interactive widget cache gets flushed. I can then go back to the page with the interactive widget and the init() will run and audio will play again.
(Note that for <audio> to have a sound play automatically and loop, the autoplay and loop properties just have to exist. The value of those properties doesn't matter so I can just have quote quote)
Is this a known problem with ibooks?
Is there any way to force that cache flush?
You could try setting a function on widget.didEnterWidgetMode (more documentation here) that resets the progress when the widget gets opened again.
edit: So if you look at this Apple thread on widget creation for iBooks Author, they mention adding a Javascript snippet for AppleClasses/AppleWidget.js. The code for that file is here (at least, according to someone on the internet :)), and in that file there's the same widget.didEnterWidgetMode function.

Can I create a video controller/ overlay in LiveCode

I have been using LiveCode for a couple of weeks now and have a question.
I would like to create a custom video controller with play, stop, rewind etc with LiveCode that shows and hides at the bottom of the screen if you touch the video currently playing in the video player on a mobile device.
I have created the menu page with a selection of 4 videos to choose from and selecting any video goes to the next card and plays the video. On completing the video it goes to the previous card allowing the next selection. The video controls on the Quicktime player with LiveCode are rather crude and I would like to create a better looking interface. Is this possible with LiveCode?
Yes it is possible.
Look at the following commands and functions in the dictionary:
start command
stop command
playStopped message
currentTime property
currentTimeChanged property
playLoudness property
In addition, make sure to look at what's in each entries "see also" list.

Resources