Im using AS3
I have 3 scenes ...
One is a 'links' page that I use to navigate to websites, a video and a gallery.
The gallery is on a scene of its on, on the links page I have a button that takes you to it, and starts it.
The gallery Im using isnt one I made myself ...
I need to stop it - but cant figure how.
When I am done with watching the gallery I want to navigate back to the links page, I can get that to happen - but the gallery - with music is still going in the background.
This is all the gallery code:
Code:stop(); import flash.display.Loader; import flash.net.URLRequest; import flash.events.Event; import flash.events.MouseEvent; import fl.transitions.Tween; import fl.transitions.easing.*; import flash.filters.GlowFilter; import flash.filters.DropShadowFilter; import flash.utils.Timer; import flash.events.TimerEvent; //// var myArray:Array = ["Fun at Cullburra Beach", "Safe & Protected at Tilbury Cove", "Holiday Time in the Shoalhaven", "Running Along Seven Mile Beach", "Beautiful Abraham's Bosom, Currarong" , "Family Time at Plantation Beach, Vincentia " , "Off Leash Fun at Moona Moona, Husskinson"]; var myGlow:GlowFilter = new GlowFilter(0xffffff,1,10,10,255); var myShadow:DropShadowFilter = new DropShadowFilter(6); var totalImages=7; var imageNumber=1; var myTimer:Timer = new Timer(4000);// 4 sec var myLoader:Loader = new Loader(); //// var myRequest:URLRequest = new URLRequest("Images/"+imageNumber+".png"); myLoader.load(myRequest); addChildAt(myLoader,1); //// myLoader.contentLoaderInfo.addEventListener(Event.INIT, getImageInfo); function getImageInfo(event:Event){ var imgX=(stage.stageWidth- myLoader.width)/2; var imgY=(stage.stageHeight- myLoader.height)/2; myLoader.x=imgX; myLoader.y = imgY; myLoader.filters = [myGlow, myShadow]; var myTween:Tween = new Tween(myLoader, "alpha", None.easeNone, 0,1,2,true); } //// myTimer.addEventListener(TimerEvent.TIMER, autoadvance); function autoadvance(event:TimerEvent){ if(imageNumber<totalImages){imageNumber++} else (imageNumber=1); reload(); } myTimer.start(); //// rightButton.addEventListener(MouseEvent.CLICK, nextImage); function nextImage(event:MouseEvent){ if(imageNumber<totalImages){imageNumber++} else (imageNumber=1); reload(); } //// leftButton.addEventListener(MouseEvent.CLICK, previousImage); function previousImage(event:MouseEvent){ if(imageNumber>1){imageNumber--} else (imageNumber=totalImages); reload(); } //// function reload(){ removeChild(myLoader); myRequest= new URLRequest("Images/"+imageNumber+".png"); myLoader.load(myRequest); addChildAt(myLoader,1); myLabel.pictureLabel.text = myArray[imageNumber-1]; var tweenLabel:Tween = new Tween(myLabel, "rotation", Bounce.easeOut, 360, 390,1,true) } //// var my_sound:Sound = new Sound(); my_sound.load(new URLRequest("honky_tonk.mp3")); var my_channel:SoundChannel = new SoundChannel(); my_channel = my_sound.play(0,9999); //// //stopping the timer. stage.addEventListener(MouseEvent.MOUSE_MOVE, stop_the_Timer); function stop_the_Timer(event:MouseEvent){ myTimer.stop(); } ////resume timer stage.addEventListener(Event.MOUSE_LEAVE, resumeTimer); function resumeTimer(event:Event){ myTimer.start(); } ////////////




Reply With Quote