Hi,
I've been struggling to get sounds to work with attachSound when the sounds are stored in a swf loaded into another swf. I came across a post on a forum which supposedly explains how to to do it, however i tryed what it suggested and it doesn't work. ( link)
I then tryed to use the MovieClipLoader class so that once the swf was loaded the sound would be played. What is strange though is that when the swf has loaded i can return a valid reference to the sound object, but cannot play it. This is all local, so it should play. I'm very confused.
Here is my code:
sound.swf - beep_sound.wav file is in the library with linkage identifier beep_sound -
_global.my_beep_sound = new Sound();
-
my_beep_sound.attachSound("beep_sound");
-
trace("Sound file loaded"+my_beep_sound);
-
player.swf -
-
// create an empty movie clip
-
this.createEmptyMovieClip("my_mc", this.getNextHighestDepth());
-
-
// Create Movie clip loader for sound
-
var my_mcl:MovieClipLoader = new MovieClipLoader();
-
var mclListener:Object = new Object();
-
-
// Setup events for preloader
-
mclListener.onLoadStart = function(target_mc:MovieClip):Void {
-
};
-
mclListener.onLoadProgress = function(target_mc:MovieClip, numBytesLoaded:Number, numBytesTotal:Number):Void {
-
};
-
mclListener.onLoadComplete = function(target_mc:MovieClip):Void {
-
};
-
mclListener.onLoadInit = function(target_mc:MovieClip):Void {
-
trace("init");
-
trace(my_beep_sound);
-
my_beep_sound.start(0,999);
-
};
-
my_mcl.addListener(mclListener);
-
-
// Load sound
-
my_mcl.loadClip("sound.swf",my_mc);
-
The trace output is: -
Sound file loaded: [object Object]
-
init
-
[object Object]
-
Thanks,
Chromis
8 2838 Markus 6,050
Recognized Expert Expert
When you create your new sound object, try doing:
Hi Marcus,
Can't tell you how pleased I am you've sorted that out for me, thanks! Was really stuck on that one. So does that change the timeline for the sound to the the containing mc? What is it otherwise?
Thanks again,
Chromis
Markus 6,050
Recognized Expert Expert
No that doesn't work. Here's a discussion on the problem that seems to explain it pretty well (and offers a solution too).
I did have a look at that whilst i was researching the issue, it's not really the way i wanted to go about it though as on the actual project that has the issue I've got a moviecliploader which loads the main swf. Your solution above worked a treat though. What's strange is I would assume the sound constructor to take the movieclip it's in as a target as default. Instead it seems to be the current root right?
Markus 6,050
Recognized Expert Expert
Oops, I hadn't seen your reply before I made my second post. Sorry about that.
Yes, I would've thought the object would default to the movie clip / button it's in - of course, your's isn't in a movie clip or button.
Time to do some research :D
Also, don't double post your question :P
Glad I could help,
Markus.
Sorry about the double post, although technically it's not the same question, more of a development from the previous one ;)
Thanks again for you help.
Markus 6,050
Recognized Expert Expert @chromis
Sure, but while it's an extension of this question, it still largely relates to this thread. So, no need to create a new thread, although I won't hold it against you.
See ya around,
Markus.
Haha fair play, I'll remember that in the future.
Chromis
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: minchu |
last post by:
Hello,
I want an image and sound(any format) to load and play simultaneously
in my HTML or the sound should play only after the image is loaded. Is
this possible?. Pls let me know how.
Regards,
Minchu
|
by: The Road To Utopia |
last post by:
Here's one for the trolls...a common jibe from them is setting up
audio/video hardware under linux.
Ok, true story: at work today, someone asked me if I could tell him why
his XP Home would play the video from a DVD but not the audio. He had
been searching for an answer for days on support.microsoft.com but found
none. I suggested Google and Gateway. Gateway had nothing, but sure
enough, search for *XP DVD no sound* on Google and...
|
by: Marco Krechting |
last post by:
Hi All,
I have a database with the timer function set to warn the user that
arecord is due to expire. Is there a Win API that I can use so a loud
warning will go off. Not this simpel beep in access but a really,
like Virus Alert kind of warning?
Regards
Marco
|
by: Robert Gravereaux |
last post by:
I'm putting together a C# .Net forms project on win2k. The application
requires some sort of horn sound. I've never implemented any audio in .Net,
so I'm not sure how best to accomplish this.
It's an application that works with a wireless barcode scanner, in a
warehouse environment. The user could be potentially 20 or 30 ft. from the
PC. If the user scans something improperly, the app should sound a 'horn' to
notify the user. I'm trying...
|
by: illmagination |
last post by:
Hi,
I recently received a task to have a .wav file play only once when home
page is 1st loaded and only play again when the user re-visits the page
by opening a new browser.
I am using asp.net 2.0 framework. Could someone please guide me?
Thank you.
| |
by: laredotornado |
last post by:
Hi,
Is there a cross-browser way to play short (< 25K) sound files without
spawning new windows or embedding any visual controls on the page? I
would like to click a button and hear my short sound.
Thanks for your help, - Dave
ps - Searching Google turned up stuff for Netsacpe and IE 3, but I was
hoping more for IE 7 and Firefox.
|
by: Jake Barnes |
last post by:
I did a search on the newsgroup comp.lang.javascript. I was searching
for "how to play a sound with Javascript". I'm somewhat suprised that
the majority of entries are from the 1990s, and there are almost no
posts from the last 3 years:
http://groups.google.com/group/comp.lang.javascript/search?group=comp.lang.javascript&q=how+to+play+a+sound+with+Javascript&qt_g=Search+this+group
Even after sorting by date, there don't appear any...
|
by: raylopez99 |
last post by:
I have the latest version of Visual Studio 2008 Professional, which
allows you to create resource files (this is the .resx file, no?),
unlike the Express version, which does not.
I am trying to cut and paste code that MSDN recommends for playing a
simple wav file from inside an embedded file, like presumeably the
'resources' file .resx is. I want to embed the .wav file in a
'resource file' since I don't want the user storing the file on...
|
by: anfetienne |
last post by:
i have this code below that i made....it loads vars from txt file splits it then puts it into an array....once in an array it the brings the pics in from the array to create thumbnails and a larger image. my problem is i have captions to go with it and when i try to load the captions nothing happens or can be seen to be happening.
i dont know where i am going wrong as i have no output or compiled errors
var locVar = new Array();...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |