Results 1 to 2 of 2
-
March 30th, 2012, 01:01 AM #13Registered User
postsQuick help please deadline in a few hours
Hi,
I've been up all night trying to finish a piece of work, but there's just one thing which I'm stuck on.
Basically, I have a set of 3 galleries on 3 separate frames which are controlled using the flash slider component.
When each photo is selected, a piece of audio also plays.
That all works fine.
However, the problem is removing the gallery after it has been displayed on the page.
What I've got at the moment is a code which makes the gallery not visible on the page when it shouldn't be there.
This is fine, but when you go back to click on the gallery, it goes back to its original state, which basically messes up the whole thing as everytime a new picture loads you see the other picture in the background.
First frame actions:
gallery1 page actionsCode:import flash.events.MouseEvent;import flash.media.SoundMixer; stop(); gallery_mc.visible = false; slider.visible = false; gallery_mc2.visible = false; slider2.visible = false; gallery_mc3.visible = false; slider3.visible = false; //navigation buttons btn_home.addEventListener(MouseEvent.CLICK, nav1Button); btn_about.addEventListener(MouseEvent.CLICK, nav2Button); btn_contact.addEventListener(MouseEvent.CLICK, nav3Button); btn_sounds.addEventListener(MouseEvent.CLICK, artefact1Button); btn_journey.addEventListener(MouseEvent.CLICK, artefact2Button); btn_journey2.addEventListener(MouseEvent.CLICK, artefact3Button); //navigation button functions function nav1Button(evt:MouseEvent):void { gotoAndStop("home"); slider.value = 0; SoundMixer.stopAll(); } function nav2Button(evt:MouseEvent):void { gotoAndStop("about"); SoundMixer.stopAll(); } function nav3Button(evt:MouseEvent):void { gotoAndStop("contact"); SoundMixer.stopAll(); } function artefact1Button(evt:MouseEvent):void { gotoAndStop("soundsOfPort"); SoundMixer.stopAll(); } function artefact2Button(evt:MouseEvent):void { gotoAndStop("journey"); SoundMixer.stopAll(); } function artefact3Button(evt:MouseEvent):void { gotoAndStop("journey2"); SoundMixer.stopAll(); }
Code:import flash.events.Event;import flash.media.Sound; import flash.media.SoundChannel; gallery_mc.visible = true; slider.visible = true; gallery_mc2.visible = false; slider2.visible = false; gallery_mc3.visible = false; slider3.visible = false; //array for sounds var sound_array:Array = ["sounds/bus-stop.mp3", "sounds/church.mp3", "sounds/sea.mp3", "sounds/dog.mp3"]; //array for images var img_array:Array = ["images/bus_stop.jpg", "images/church.jpg", "images/dog1.jpg", "images/dog3.jpg"]; slider.minimum = 0; slider.maximum = sound_array.length - 1; slider.snapInterval = 1; slider.tickInterval = 1; //sound channel variable var sound:Sound; var s_channel:SoundChannel; //image loader variable var imageLoader:Loader = new Loader(); //creating an event when the slider value is changed slider.addEventListener(Event.CHANGE, slider_onChange); //function for slider value changing function slider_onChange(event:Event):void { sound = new Sound(); sound.load(new URLRequest(sound_array[slider.value])); var image:URLRequest = new URLRequest(img_array[slider.value]); imageLoader.load(image); gallery_mc.addChild (imageLoader); imageLoader.x = 161.5; imageLoader.y = 141.45; if(s_channel != null) s_channel.stop(); s_channel = sound.play(); trace (slider.value); }
Can anyone please help point me in the right direction?
I can provide source files if necessary.
Thanks!
-
March 30th, 2012, 11:30 AM #2
Can you provide the source files and explain the problem in a bit detail. I will check it in my free time and get back to you.
Thanks
Sateesh.J

Reply With Quote

Bookmarks