Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1075919 Posts in 44152 Topics- by 36120 Members - Latest Member: Royalhandstudios

December 29, 2014, 03:33:37 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)Compiling a project into swf file - embedding sound (flashdevelop)
Pages: [1]
Print
Author Topic: Compiling a project into swf file - embedding sound (flashdevelop)  (Read 903 times)
davidp
Level 6
*



View Profile WWW
« on: March 14, 2010, 01:21:57 PM »

So i have this game i'm working on currently and it uses sounds and stuff, but i have this "problem" which i can't solve by myself... how can i compile the project in flashdevelop to have all files, including sound mp3 in one swf? now i have to put sound files in same directory i specified in code and then on server seperately from swf file.

the code im using to play files:

Code:
public var song:SoundChannel;

...

mgunSND = new Sound();
var request:URLRequest = new URLRequest("DualMachineGun.mp3");
mgunSND.load(request);
song = mgunSND.play();

i'm guessing it has something to do with external loading, right? (i've done this reading official adobe's document on actionscript3). i guess i should use embed function somehow, right?
Logged

Kunal
Level 1
*


is feeling Bit.Core.Trippy


View Profile WWW
« Reply #1 on: March 14, 2010, 01:39:59 PM »

First use this
Code:
[Embed(source = '../snd/drum.mp3')]
private var musicClass:Class;

And then in your function (wherever you want to play the sound)

Code:
.
.
.
drum = new musicClass();
drum.play();

Hope that helps
Logged

davidp
Level 6
*



View Profile WWW
« Reply #2 on: March 14, 2010, 01:48:00 PM »

oh, the same way i use multiple sprites (images) on various objects!

great, thanks a lot, i should have tried that (this) method first, before asking stupid questions.

help greatly appreciated!
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic