ActionScript 2.0 :: Load Mp3's So The Sound.position Property Resets?
Oct 17, 2006
Basically I have an XML file that contains the paths of a few mp3 files. I have a Play button that plays them and a Next button that plays the next song on the list. These buttons work fine. I actually even am able to obtain and manipulate the songs position using the mySong.position property in order to display the songs position in the form of minutes and seconds.My problem is that when you click Next to go to the next song, the mySong.position property does not reset back to zero, like it should. So if you are 12 seconds into a song and you click NEXT, the next song starts to play fine, but the display keeps counting up from 12 seconds. I realized the .position property is read-only, so I cannot change it. If this is the case, then how does it ever reset, what causes it to reset?
I am loading the songs via the loadSound() method. Which means my only code on the Next button (other than to update some other displays) is:Code:mySound.loadSound("file.mp3", true);I do not need to use mySound.stop() to stop the previous sound, or even mySound.start() to start the new sound playing, it starts automatically. I tried using those commands and got the exact same results, the position property still did not reset.Am i missing something? I sure hope its painfully obvious and I just overlooked something simple cuz im getting a headache
View 9 Replies
Similar Posts:
Jul 16, 2009
I animate a DisplayObject with a Motion XML (exported from Flash). The first time I apply a motion to it, everything works fine. The second time I apply a motion, the position / scale is reset to what it was before I first applied a motion. How can I keep the transform of the DisplayObject after a motion is played when I want to play a new motion ? I want the DisplayObject to start from where it was at the end of the first motion.Here's the code I use:
private function animate(motionXML:XML, target:DisplayObject):void
if(!animator)animator = new Animator(motionXML, target);
// Add event listerners
[code].......
View 5 Replies
Nov 6, 2010
button to reset position (action-script 3) how do you make a button that when pressed it resets/changes the position of a object yes i am new to action script 3 but not to flash i want button to change the x y coordinates back to the original but dont know how?
View 1 Replies
Jun 19, 2006
I have currently a music player that uses Sound.position and Sound.duration to use as a playlist. However, the sound is streaming, so then Sound.duration is the number of loaded seconds/miliseconds. Is there a way for me to figure out the duration of a sound without fully loading it? Right now, it really messes up the playhead.
View 2 Replies
Apr 28, 2003
I am trying to get mp3 sound position and sound length to work. Heres the code below and I ahve attached the FLA.
Code:
// Create a new Sound object.
var music = new Sound();
// Create a text field to show sound length.
[Code]....
I have attached my FLA file. You will need to through a MP3 in the same dir as swf file names test.mp3..
View 1 Replies
Jan 2, 2011
I have an SWF that's 30MB. Sound files (music) make up 25MB, art and other things make up the remaining 5MB.
Would it be possible for me to load the 5MB of necessary art and other things first to allow the user to operate the app, then after that's all loaded and they are operating the app, load the remaining 25MB of sound files in the background?
UPDATE: Loading SWF (or other entities) externally is not an option.
View 1 Replies
Dec 16, 2005
I'm trying to load sound dynamically into a clip and then play it randomly. The AS I came up with works great if the sound is embedded and I use the .attachSound() method instead of loadSound(). Now, when I load it dynamically and use the code below, the sound plays very fast and at a higher pitch.
Code:
var crows = new Sound(this);
crows.loadSound("Raven.mp3", false);
crows.setVolume(100);
[Code].....
View 1 Replies
Jun 22, 2003
I am loading small sounds dynamically with the loadSound command. These small sounds are activated with a rollover. see script below. This works ok. however. i want the first sound to keep playing while the rollovers load sound. a bit like playing the piano. This works ok when i import all the sounds into the library and place them on their very own button. however the size of the flash movie increases to 140k. whereas when i load them dynamically the size of the movie is 20k. obviously i want to load dynamically.
But with dynamic loading each sound stops when another sound is rolled over, so that there is only ever one sound playing at once. I need to load the sound into a different level or something, so that the first sound can keep going while the smaller, shorter sounds play over the top. this is my script below. The first sound loads when the movie starts. This is the one i want to keep playing. Then there are the smaller ones with rollovers. does this make any sense? there's actually 13 little sounds.
[Code]...
View 3 Replies
Jan 12, 2009
i am trying to change the position while the yoyo is working but the tween object goes to the new position and then back to the old position and continuing to yoyo.
ActionScript Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
var swing:Tween = new Tween(swingObj, "_rotation", Regular.easeInOut, 60, -60, 2, true);
[code]....
View 2 Replies
Feb 3, 2009
I am trying to call a sound to play whenever the UP key is down. I want the sound to stop and reset to position zero when UP is released. Everything works except the sound will not reset to 0. Here is what isn't working:
if(Key.isDown(Key.UP)){
if(sound.position == 0){
sound.start(0,0);[code]....
When ran, the program plays the sound once, and will never play it again because I can't get the sound.position to reset to 0.
View 1 Replies
Oct 25, 2005
Just to start off, this isn't exactly an inquiry to a problem. It is moreso of a posting of a bug (or assumed bug) in the Flash player and how to get around it. Though if anyone else has a better method then share. Ok, well I very rarely ever work with the Sound() object in Flash, and I found myself working with it today. I was having a problem and I could not pinpoint it for the life of me.... my code appeared correct in every aspect.
After tracing many sections of my code to find out where it was going wrong I realized... that for some reason when you use Sound.stop(), the Sound.position doesn't get reset... it instead just increments from where it left off. This is quite annoying. And being that Sound.position is a read only property you can't reset it yourself. The only solution I have found for this is to delete or overwrite your Sound() object with a new Sound() object. Anyone know if this is indeed a bug, or if there was some reason Macromedia did it like this?
View 9 Replies
Aug 26, 2006
I am using previous/next buttons to navigate through various screens. Each screen has its own voice over track.If I hit the "Next" button in the middle of the track playing, then try to go back, the audio won't play - most likely because the position is still sitting at wherever it was when the sound was stopped.Is there a way I can reset the position? I am assigning the positiong to a variable (mySoundPosition), and have tried stting it to 0 (mySoundPosition=0), but that doesn't seem to help. I know that the position is read-only, so I was hoping that somehow clearing the value of the variable would work.Basically, I just need a way to start the sound over without having to envoke multiple start(); commands because that causes the sounds to essentially play twice, simultaneously, which doubles the volume.
View 13 Replies
Jul 24, 2011
Is there any code in as3 that sets the volume by x&y- coordinates of the mouse?So that my sound is in a MC, and how closer my mouse is at the MC, the louder the volume gets?
View 4 Replies
Jan 10, 2009
I have created a document 600x300 filled with buttons for a rollover effect. I want to be able to play sounds dependant on the x and y position of the mouse without having to use objects that interfere with the buttons.
View 2 Replies
Nov 26, 2009
is there a way in as3 to mute a video inside a movie clip if the mouse x position equals less than, say 200px?
View 1 Replies
Sep 11, 2011
I have the following working great:
stop_btn.setStyle("icon", square_mc);player_btn.setStyle("icon", next_mc);
import flash.events.Eventimport flash.events.MouseEvent;import flash.media.SoundTransform;
var alreadyDefined:Boolean;volumen.value = 1;
[Code].....
I have another slider component on the movie with instance name PROGRESO
I would like for PROGRESOnto indicate (update) the sounds progress as it plays and be able to scrub through the sound.
View 7 Replies
May 28, 2008
I have a pause button that pauses a sound playing in a sound channel. It works, but when I resume the sound, it isn't in the correct position, almost like it was rewinded a little.[code]
View 3 Replies
Mar 16, 2010
I`ve run in a bit of a problem. I`m trying to make a web player in AS2. It stores some data from player for later usage in a shared object. One of the things i`d like to store is my current playing position, so player can start of where it was playing after page reloads, but i can`t think of how it should be done..
[Code]...
View 0 Replies
Aug 4, 2010
I am following this tutorial (Url...) on how to build an audio mixer in Flash. I am trying to display the duration/position of one of the sound objects in the mixer (all sounds in the mixer have the same length). I have tried adding this code to the actions under frame label "ready".[code]I have two dynamic text fields named Text01 and Text02 on the main timeline. Yet, nothing populates.
View 2 Replies
Jul 29, 2009
I have a Flash based media player loading mp3s at 22.050 khz, and for some reason the length is being reported as a little over twice what it should be. Is there anything I can do, short of dividing the results by 2?
View 4 Replies
May 28, 2008
I have a pause button that pauses a sound playing in a soundchannel. It works, but when I resume the sound, it isn't in thecorrect position, almost like it was rewinded a little. I'm usingthe code straight from the
View 1 Replies
Jan 20, 2010
I load a song and when I get the length the song never reach this value.Here is issue document by another guy AS3 - SoundChannel.position never reaches Sound.length.And here is my code
import flash.display.Sprite;
import flash.net.URLRequest;
import flash.media.Sound;[code]....
View 2 Replies
Aug 18, 2010
does anybody maybe know how to track/trace the current position of a sound file while it is playing?So that it is updated every frame or second?I figured something with trace(sound.position) onEnterFrame, but didn't succeed in realizing this yet.
View 1 Replies
Jan 20, 2011
If you wanted to create a client-side Flash-based sound editor that lets you load more than 1 sound to an interface that allows you to manipulate the individual positions of the sounds, and mix/play them in real time, how would you accomplish this?
I'm looking to create a simple version that can mix 2 mp3s, allowing the user to adjust the positions of each. Sort of a dumbed down version of Aviary's Myna audio editor.
At the end of the mixing, I would also like our server to mix the 2 mp3 files with the proper positioning into 1 mp3 file...
View 1 Replies
Jun 10, 2009
I'm writing a base class for a clip that holds a scrollbar and some content. I written a function that runs every frame to check if the height of the content is smaller than the height of the available content area. If it is, the scrollbar hides. The problem I've run into is that when i trace the height, every other frame it comes back as 0. If I trace the same exact value when it's used in another function it comes back correct every time. If I trace it in my document class, it comes back correct. Any idea why it comes back zero in just this one spot?
enableScrollBar(); is the function in question
Code:
package includes {
import flash.display.MovieClip;
import flash.events.Event;
[code]....
View 2 Replies
Mar 13, 2007
I have attached the following to a button:
on (press) {
gotoAndPlay(1);
}
or
on (release) {
gotoAndPlay(1);
}
It is meant to take the user back to frame one where they can play a game again. The only problem is that it doesn't work. When you click the button it goes to the frame but quickly resets back to the frame where the button is located. I have put stop(); code where relevant. I am unsure on what to do. I just want the user to be able to go to different frames but the button keeps reseting to the frame where it is originally located.
View 5 Replies
Oct 13, 2011
I would like to know what bitrate is song, so I count it this way:
var bitrate = Math.floor( 8*_snd.bytesTotal/_snd.length);
but unfortunately I can not retrieve valid value for _snd.length before all the song is loaded. Is there any other way to achieve that value?
View 2 Replies
May 13, 2010
I have 22 rollover buttons that are a tint. On the rollover, I want the button (75px square) to disappear. On the rollout, I want it to display it's original state.I can't use visibility because it causes a flicker. When I use alpha it resets the opacity to 100% regardless of the number I set it to - e.g. rollover {button.alpha = 0;} / rollout {button.alpha = 50;} still results in a solid box.
View 5 Replies
Jul 20, 2011
I've been passed a flash file that uses the code below to move a set of images using left and right arrows. The user should be able to click through the series smoothly with no resets.
Essentially, the file looks like this: < (set 1) (set 2) (set 3) >
Each set contains the same 6 buttons. I added one button into the set, so now there's 7 buttons to a set. They overlapped, so I moved the left set over one button length and the right set over one button length.
After 6 clicks, instead of rolling smoothly through the buttons, it jumps back to the beginning. Did the addition of another button mess up the initial position or something?
Sadly, I'm more familiar with simple timeline and tween effects rather than this. Also, I'm using Actionscript 2.0 and CS4.
Code:
import mx.transitions.Tween;
Stage.scaleMode = 'NoScale';
var InitPos = 85;
[Code].....
View 0 Replies
Jul 12, 2010
I'm making a website. I'd love for a fish to jump up and eat a mayfly when the user rolls over the bottom of the screen. I know how to use the rollover script:
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.nextFrame();
[code].....
View 1 Replies