Actionscript 3 :: Embed Versus Dynamically Loading Sounds?
Jun 4, 2011
It's got 5 tabs, and will give the user the options to play about 10 sounds per tab.I have initially been loading the sounds on runtime, so whenever the user clicked a button to play that sound, I would do something like:
var sound:Sound = new Sound(new URLRequest("assets/hello.mp3"));
sound.play();
I'm not sure, but I don't think this is very good, since I would be loading that sound over and over again if the user pressed the button too many times.
I then thought about embedding the sound in each of the views (I have one view per tab), so would embed the sounds whenever the view was loaded. I think this is a better options, but still am a bit unsure about how the embed works exactly.
[Embed('assets/hello.mp3')] private var hello_mp3:Class;
I suppose it simply embeds the mp3 files when the swf is compiled (making it bigger), but they would not be loaded anymore once the app starts, or once that view is initialized again.
View 4 Replies
Similar Posts:
Mar 8, 2011
I'm trying to load YouTube playlist feed data and I'm having some trouble with the ATOM version, which is the YT default. I'm having no problems with the RSS version, but the RSS takes a few minutes longer to update when making changes to a playlist. I can load both and toXMLString(); both feeds but I'm getting an error when I try and parse the ATOM feed.So if the ATOM feed looks like this:
HTML Code:
<feed ... >
<entry>...</entry>
</feed>
Shouldn't I be able to get the following trace to work after the completed load where playlistXML is my new XML for the feed:
Code:
trace(playlistXML.entry[0].title);
I'm getting a "TypeError: Error #1010: A term is undefined and has no properties." when I try and output that title data.And the RSS is like this:
HTML Code:
<rss ... >
<channel>
<item>...</item>
[code]....
View 2 Replies
Sep 16, 2011
I have a series of PNG files I need to use in a Flash project.Usually I bulk load my PNGs via an xml or json page.I'm just wondering, what is the difference between loading PNG files this way and adding a PNG to the stage via the Library (say, if you imported a PNG file to the library and then added it to the stage via Actionscript OR if you just dragged it on the stage)
View 2 Replies
Dec 11, 2010
I'm using a OOP model I read about called 'model-view-controller' - so I've got three main classes at work and then a few more additional classes I felt were necessary. I'm building a kind of game.I'm at the stage now where most of the programming is done. The game essentially works. Now all I gotta do is add the visual stuff - the animation and graphics. I asked myself if to draw up all the graphics as separate external swf files which would be loaded into the game via my View class; or would a better method be just doing all the graphics and animation directly inside the fla file, storing all MovieClips and Buttons, etc. as symbols in the library (exported for ActionScript 3.0).
I'm curious to know if this is an issue of mere personal preference, or if there are pros and cons for each method of work - external swf files loading into Flash vs. storing the graphics as symbols in the fla. file library.
View 3 Replies
Nov 1, 2006
how do i dynamically add sounds from the library? i have tryed
Code:
_root.attachMovie("sown", "sown",999)
//and
var my_sound:Sound = new Sound();
my_sound.loadSound("sown", false); //externaly the file is also named "sown" (no extension)
View 2 Replies
Jan 26, 2009
I think this might be a tough one: Is it possible to stretch the playback of an MP3 file using Actionscript? Time stretch is when you slow a sound down but don't change its pitch. Basically, it works by chopping up the sound into milliseconds and splicing duplicates of the bits in, thereby stretching the sound.
View 1 Replies
Aug 8, 2009
I need a flv with two sound. I want to load load two different sound for one flv file. For example I want to load my flv file in frame 1 with sound 1 then I want to load my flv file in frame 2 with sound 2. How can I do it?
View 7 Replies
May 7, 2002
I have a main movie loading a SoundMC which loads 12 swf's that contain mp3's with preloaders in each swf.
example LoadMovie("swfName","_level10")My issue is that when the swf loads it will load in the top left corner of my movie. So I put it inside of a movieclip and tried to attachMovie("clipname")setProperty._x = x; setProperty._y = x; but no Love. Should I put this in the Main timeline or in the SoundMC timeline or not use it at all?
View 6 Replies
Feb 4, 2009
this piece of code:
PHP Code:
var mySoundReq:URLRequest= new URLRequest("samplesound.mp3");
var mySound:Sound = new Sound();
mySound.load(mySoundReq);
How does the urlrequest know where that .mp3 file is located, and how do i tell as3 where it is? and another thing: when i put this on the web, how do i locate the file then?
View 6 Replies
Jan 16, 2009
There are 8 letters in the menu. Each letter provides a linkwhen clicked and a sound when rolled over. The letters will NOTAPPEAR on stage until their corresponding sound is completedloaded. I did this to avoid distortion during playback. The soundbit are pretty small as well. Anyway, the sounds are still distorted during playback and Idon't know why. They are all MP3. HELP PLEASE!! Here's the scriptfor one of the eight letters (movieclips) only to limit size you'llhave to look through:
public function Index() {
var D:MovieClip = new dMC();
D.x = 100;
[code]........
View 4 Replies
Jun 30, 2011
I am using this code to load an external mp3 file -
Code:
var snd:Sound=new Sound();
var context:SoundLoaderContext=new SoundLoaderContext();
[code]......
View 1 Replies
Nov 21, 2010
I made an app. I figured out how to load all my images into in.I have about 1000 images and 1000 sounds that I am using in it. About 70MB of data How will this affect a users computer? Is it even possible the load up this much content?I ask because I am getting stack overload error on my bulkloader!Scares me to think that months of work will go down the drain because I can't load this much data!
View 2 Replies
Jan 9, 2010
I made some sort of MP3 player based on an XML file, and I want to load the next track when pressed on a button. Well that part works, the problem is, when I play the next song, this is what happens:
- The next song plays
- The bar that is normally buffering is already full
- When I skip to a part of the song, it skips to the first song!
How can I "clear" a sound variable and load another one?
View 3 Replies
Sep 11, 2007
I want to write a function that will load all of my external sounds stored in an array which are just strings of their filenames ie:
var soundList:Array = new Array();
soundList = ["sound1.wav", "sound2.wav", etc];
And create a new array with sound Objects that will have the sounds loaded in them (for later execution). After loading all of the sounds in the soundList array, the function should return or just set a _root value to 'true' ie:
[Code]...
View 1 Replies
Aug 4, 2010
I am developing a web site with .net and there is a page named loadanymovie.aspx
I want to call the swf movie file name dynamically by code (by querystring, such as : www.mysite.com/loadanymovie.aspx?moviename=1)
i used following code for this :
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Len(Request.QueryString("st")) > 0 Then
[Code].....
this code works and doesnt produce any error. But i cannot see the movie at internet explorer. (i can see it at chrome browser)
View 5 Replies
Dec 14, 2011
My requirement is not to dynamically embed fonts in Flex, but to dynamically embed variable in Flex.[code]...
View 3 Replies
Dec 27, 2011
My problem is this: I have 16 x different sizes of flash files. (banners) That's 1 set. Now I have to make another 20 different sets with 20 different logo's in them.(320 banners total) So the long and harse way to do this is open all 320 banners and then replacing the logo in them one by one.
My solution was to make 1 set and load a logo dynamically using the AS2 loadMovie function. But if I do that I have to have a logo image file in the same directory. My client doesn't accept this. He only wants flash files.
So, how do I embed a image dynamically on publish. So that if i'm finished with publishing banners I can just throw the image away because it's in the flash file loaded already.
dynamically images loading in AS2 but not dynamically embedding a image in AS2.
View 1 Replies
Mar 19, 2012
Is there any possibility to set the source attribute value dynamically at run time?
for e.g in the code Embed(source="assets/images/image.pdf",mimeType="application/octet-stream");
I need to set source="set pdf file name using a variable or reading from config xml"
View 1 Replies
May 21, 2008
Just want to make sure this is correct before I tell the ol' boss.
In order for me to dynamically embed a font (through XML) that font must be installed on the server correct?
View 5 Replies
Mar 7, 2010
i'm attempting to instantiate a bunch of sounds by creating a string array containing each sound's filepath (or name).
var soundByName:Object = {};
var channelByName:Object = {};
var soundName:String;
[code]....
View 1 Replies
May 18, 2009
Essentially, I've got a MC container that's created dynamically based off an XML file (basically for every <title></title> I've got, it makes a new "card"). Now within the context of each <title></title> grouping I've got <imgs></imgs> in which I specify the path to images that are related.All of that works perfectly, save for the external jpg files actually appearing on the stage. The MC I add them to does, but the external image doesn't.My problem is- I can't add the external images until they're completely loaded (or so it appears). The thumbnail BG I use is blank. So I know for a fact that the thumbnail BG isn't occluding the loaded thumbnails.
View 2 Replies
Oct 30, 2009
how to declare the path dynamically in Embed source
Code:
Ex:
[Embed(source ='../lib/Fonts/Arial.TTF', fontName = 'Sathiy Normal')]
but i need Like this
URL='../lib/Fonts/Arial.TTF'
[Embed(source =URL, fontName = 'Sathiy Normal')]
if i give like this Error is coming..How to set the path dynamically to Embed source
View 2 Replies
Sep 22, 2011
I was wondering is it possible to load or embed dynamically new fonts?
In my current project the option would be needed. Situation is, I don't know what is the font and what would be the address of the font. So is there a way to bring new type faces in dynamically?
Here's my opinion which obviously isn't quite correct:
ActionScript Code:
var fontPath:String = "C:/WINDOWS/Fonts/BirchStd.otf";
var fontFace:String = "arial";
function setFontFace():void{
[Code].....
I get errors: 'fontPath' does not have a recognized extension, and a mimeType was not provided and Unable to transcode fontAddress.
Putting there for mimetype: mimeType="application/x-font-truetype" I get rid of the first one, but second error still exist
View 9 Replies
Oct 9, 2009
I've created dynamic textfield and textformat, I also embedded the fonts but, special characters(like č,ģ,ļ,ķ,ņ) won't show up, how to embed them? In library I have my specific font with linkage name myFont. Here's the code :
[Code]....
From Flash UI I would go to dynamic text properties -> embed fonts and then manually enter desired special characters. But how to do it with code? Seriously I searched a lot and can't find the answer, surely there must be a way how to do it properly with actionscript.
View 1 Replies
Dec 6, 2011
This code here works if the src is filled with my videolink
<object width="620" height="348">
<param name="allowfullscreen" value="true"/>
<param name="allowscriptaccess" value="always"/>
<embed src="myvideolink...." type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="620" height="348"/>
</object>
Now my next step is to fill it via javascript
$('a.videolink, a.videobutton, a.articlevideobutton').click(function(event){
event.preventDefault();
$('.video object embed').attr('src', $(this).attr('href'));
});
But this isn't working... empty flash is displayed. But the generated source code seems ok. The href of the link is in the src attribute of the ebmed tag. Source code is correct again but still not playing my video
$('a.videolink, a.videobutton, a.articlevideobutton').click(function(event){
event.preventDefault();
$('.video').append('<object width="620" height="348"><param name="allowfullscreen" value="true"/>
<param name="allowscriptaccess" value="always"/>
<embed src="'+$(this).attr('href')+'" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="620" height="348"/></object>');
});
View 1 Replies
Jul 12, 2009
All is in the title, I've embedded a font and i'm using a document class to create my input field but can't type an "�" or other symbols in it.
View 1 Replies
Apr 16, 2010
I followed the mp3player tutorial (part 3) from [URL] and got it working fine. Only problem is that the setVolume I'm trying to use with my music is affecting all my other sounds - button sounds and background sound. I'm aware of the createEmptyMovieClip/attachSound approach and got it working on my other sounds. But Lee's tutorial-mp3player is using a slight different technique, and so my normal approach doesn't quite work.
[Code]....
View 7 Replies
Feb 7, 2011
I want to synchronize sounds perfectly to do a kind of Audio Mixer, using different sounds. [URL] does it perfectly, I've been researching and researching and I just don't know how to do it! How does [URL] synchonize audio so perfectly? you can even change sounds and the new ones will come on time! How do I do that? Is it just Action Script? or something else?
View 1 Replies
Mar 17, 2012
How to dynamically add wmode="opaque" to already displaying embed elements? Without reloading the elements, the embedded content should not lose its state.
Just setting the wmode attribute with javascript doesn't work.
Removing the element and then adding it again makes wmode take effect, but the flash element loses its state, among other problems. E.g if it's a video player its position/playback status resets. So that solution is no good.
Any other way of displaying content over the embedded element is acceptable as well.
(I'm doing this trough a content script in a Chrome extension if that is of any help.)
This is not a duplicated of How to dynamically add wmode=transparent to Youtube embed code? as there the parameter is added to a frame and not directly to the element it self.
View 2 Replies
Nov 29, 2009
I have a film with 4 scenes in it: Here's a link to the film and as you can see the film does not play the music the second time because of the StopAllSounds function which is probably the wrong code to use. The first scene is just a button with 1 frame, a stop action and a music clip. The second scene is the film. The third scene is the credits fourth scene is a Play again button. I have a Stop all Sounds action on the fourth scene because if I do not use it and I press the Play Again button, the music from the first song keeps playing but also the music from the film starts up again so it starts to play twice. What I want to know is, how do I get the music to stop at the end of the film but start up again once I hit Play Again?
I am using Flash CS3 if that helps and using Actionscript2.
View 2 Replies