Hello Everyone,
What i have:
I made a doc class and a sound class. the sound class purpose is that if ever add sound i can just recycle easily the code to use and via the doc class just load it intot he correct frame.
Issue:
I made the sound class and it loads correctly for the first frame… But i want to add ANOTHER audio file, how would i alter my code setup so i can load the new audio file but instead on frame 1 always… i want to be able to load the audio file in frame 3 or 5 or 25…
How do i do that with the code i have setup??
So imagine i have two audio files to load to the FLA. 1- sorrow on frame 1 which does successfully, 2- blahblah i want to load in frame 7…
below is my sound and doc class…
Thank you for your time and help.
this is the doc class
package
{
import flash.display.MovieClip;
import Buttons;
import flash.events.MouseEvent;
public class Dominara extends MovieClip
{
public var XXXXX= new XXXXX();
public var s:Soundbox = new Soundbox();
public function Dominara()
{
var btnClass:Buttons = new Buttons(XXXXXXXXXXXXX);
btnClass.addEventListener(ButtonsEvent.CLICK, buttonsClick);
v.playMyFlv(XXXXXXX);
v.width = 1280;
v.height = 1054;
s.playMain(); //you are calling your sound function from sound class
addChild(XXX);
setChildIndex(XXXXX);
addFrameScript(XXXXXXX);
}
private function buttonsClick(evt:ButtonsEvent):void {
gotoAndStop(evt.frame); //this will go to that frame and stop
v.killVideo(); //this removes the video once pressed
s.killAudio(); //this removes the audio once pressed*/
}
private function play7Video():void {
v.playMyFlv(“XXXXXXX”); //you call here the playmyflv function to take action from your video class
v.width = 1280;
v.height = 453;
v.y = 290;
setChildIndex(v, getChildIndex(EEEEE_mc)-1);
v.alpha = .6;
Dafinalselector_btn.addEventListener(MouseEvent.CL ICK, finalizeClick);
backframeselecter_btn.addEventListener(MouseEvent. CLICK, backreward);
forwardframeselecter_btn.addEventListener(MouseEve nt.CLICK, forwardreward);
}
private function finalizeClick(evt:Event):void{
Dafinalselector_btn.removeEventListener(MouseEvent .CLICK, finalizeClick);
backframeselecter_btn.removeEventListener(MouseEve nt.CLICK, backreward);
forwardframeselecter_btn.removeEventListener(Mouse Event.CLICK, forwardreward);
v.killVideo();
gotoAndStop(daguilder_mc.currentLabel);
}
private function backreward(event:Event):void
{
EEEEEE_mc.prevFrame();
}
private function forwardreward(event:Event):void
{
EEEEEEEE_mc.nextFrame();
}
}
}
this is the sound class
package
{
import flash.media.Sound;
import flash.media.SoundLoaderContext;
import flash.net.URLRequest;
import flash.events.Event;
import flash.media.SoundChannel
public class Soundbox extends Sound
{
private var playsound:Sound = new Sound();
private var loadmusic:URLRequest = new URLRequest(“sorrow.mp3”);
private var context:SoundLoaderContext = new SoundLoaderContext(8000, true);
private var sc:SoundChannel;
private var stillLoading:Boolean;
public function Soundbox()
{
trace(“working”);
}
public function playMain()
{
playsound.load(loadmusic, context);
stillLoading = true;
sc = playsound.play(0,20); //this will repeat the soundtrack x amount of times
playsound.addEventListener(Event.COMPLETE,soundLoa dCompleteF);
}
function soundLoadCompleteF(e:Event){ //this is the class which will disable the sound later when called by the buttons
stillLoading = false;
}
public function killAudio()
{
if(stillLoading){
playsound.close();
}
sc.stop();
}
}
}