Jump to content
Search Community

barredow

Members
  • Posts

    16
  • Joined

  • Last visited

barredow's Achievements

0

Reputation

  1. I have a flash site designed with several frames with unique sounds. I also have a very simple animating button that when clicked turns off the sounds on that frame and takes you back to the homepage. it's current code for that one navigation mc is mcName.addEventListener(MouseEvent.CLICK, goHome); function goHome(event:MouseEvent):void { gotoAndPlay("home"); soundFish1.soundPaused = !soundFish1.soundPaused; tlFish.gotoAndStop(0) } *note= soundfish1 refers to a repeating sound and tlFish refers to a timeline with sound Now I want to create a more advanced animated navigation that goes to more than just one frame. The problem is that I can't seem to be able to target the TimelineMax sounds from within the nested movieclip navigation. Can anyone help? I've included a simple version of what I'm talking about. The buttons work but I need the sounds from frame 2 to stop when you click back to the homepage. Note= I will have other sounds playing on the homepage but didn't include in the file.
  2. Carl, It's not letting me send an attachment through greensock. It said "the board attachment quota has been reached." But let me know if this yousendit link works. Appreciate it. https://www.yousendit.com/download/T2dk ... QnVLRmNUQw
  3. Thanks again for your help. Sorry, I think I meant to say syncing a TimelineMax animation with a progress bar and external swf load. I updated what I had and can get the animation to play but I don't think it is properly syncing with the swf load and the progress bar only goes half way before the swf loads. Would you mind looking at what I have? Here's the code. I also attached the file minus the audio and external swf file if that helps. - Alex import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; import com.greensock.loading.display.ContentDisplay; var soundFarm1:MP3Loader = new MP3Loader("audio/PreloaderOfficerCrop.mp3", { autoPlay:true, repeat:20, volume:.05, estimatedBytes:16000}); soundFarm1.load(); //make images into array so all of them can be set to zero opacity var clipsFarm:Array = [A,B, C ]; //make them all invisible to begin with TweenMax.allTo(clipsFarm, 0, {autoAlpha:0}); //start a timeline Max called tlFarm that will be synced with progress var tlFarm:TimelineMax = new TimelineMax({paused:true}) tlFarm.append(TweenLite.to(A, .1, {autoAlpha:1})); tlFarm.append(TweenLite.to(A, 6, {autoAlpha:1})); tlFarm.append(TweenLite.to(A, .1, {autoAlpha:0})); tlFarm.append(TweenLite.to(B, .1, {autoAlpha:1}), -3); tlFarm.append(TweenLite.to(B, 6, {autoAlpha:0})); tlFarm.append(TweenLite.to(B, .1, {autoAlpha:0})); tlFarm.append(TweenLite.to(C, .1, {autoAlpha:1})); tlFarm.append(TweenLite.to(C, 6, {autoAlpha:1})); tlFarm.append(TweenLite.to(C, .1, {autoAlpha:0})); tlFarm.append(TweenLite.to(A, 1, {autoAlpha:1})); //start progress bar off at zero progressBar_mc.bar_mc.scaleX = 0; //create a new SWFLoader that will load your main swf var mySWF:SWFLoader = new SWFLoader("main.swf", {container:this, autoPlay:false,alpha:0, onProgress:progressHandler,onComplete:completeHandler}); //scale progress bar and timelineMax according to swf loading progress function progressHandler(event:LoaderEvent):void { progressBar_mc.bar_mc.scaleX = mySWF.progress; tlFarm.currentProgress = mySWF.progress; } function playSoundFarm1():void{ soundFarm1.gotoSoundTime(0, true); } //load swf mySWF.load(); //once swf is completely loaded stop sound and play swf function completeHandler(event:LoaderEvent):void { trace(event.target.content); var loadedSwf:ContentDisplay = event.target.content; // TweenLite.to(soundFarm1, 1, {volume:0}); soundFarm1.soundPaused = !soundFarm1.soundPaused; TweenLite.to(loadedSwf, .5, {alpha:1}); }
  4. Thanks for your help. I did try loading the swf with LoaderMax and still got the sound starting early so I tried a workaround of adding an extra frame to my swf and that seems to have fixed it. Now I have everything in LoaderMax and I want to use use it for the preloader but I haven't found a way to sync the external swf loading progress with a tweenmax animation. So far I haven't found any examples. Do you have any advice? Here's my updated code: import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; import com.greensock.loading.display.ContentDisplay; var soundFarm1:MP3Loader = new MP3Loader("audio/PreloaderOfficerCrop.mp3", { autoPlay:true, repeat:20, volume:.05, estimatedBytes:16000}); soundFarm1.load(); //make sure none of the bar_mc is showing progressBar_mc.bar_mc.scaleX = 0; //create a new SwfLoader var mySWF:SWFLoader = new SWFLoader("main.swf", {container:this, autoPlay:false,alpha:0, onProgress:progressHandler,onComplete:completeHandler}); function progressHandler(event:LoaderEvent):void { progressBar_mc.bar_mc.scaleX = mySWF.progress; } function completeHandler(event:LoaderEvent):void { trace(event.target.content); //get a reference to the content of the loader that fired the complete event var loadedSwf:ContentDisplay = event.target.content; TweenLite.to(soundFarm1, 1, {volume:0}); soundFarm1.soundPaused = !soundFarm1.soundPaused; TweenLite.to(loadedSwf, .5, {alpha:1}); } function playSoundFarm1():void{ soundFarm1.gotoSoundTime(0, true); } mySWF.load();
  5. I'd like to create a preloader animation in tweenlite that has sound and rotates several images before loading a very large swf file that also has sound. Unfortunately, the code I have right now is loading the sound from the main.swf and playing it during the preloader (before the main.swf plays). Is there a better way to do this so that the sound from the main.swf isn't playing before it has fully been loaded ? Here's my code: import com.greensock.*; import com.greensock.easing.*; import com.greensock.plugins.*; import com.greensock.OverwriteManager; import com.greensock.events.LoaderEvent; import com.greensock.loading.* import flash.events.Event import flash.media.Sound; import flash.media.SoundChannel; import flash.events.MouseEvent; OverwriteManager.init(2) var clipsFarm:Array = [A,B, C ]; //make them all invisible to begin with TweenMax.allTo(clipsFarm, 0, {autoAlpha:0}); //load two sounds var soundFarm1:MP3Loader = new MP3Loader("audio/GrasshopperFX.mp3", { autoPlay:false, volume:.05, estimatedBytes:16000}); var soundFarm2:MP3Loader = new MP3Loader("audio/PourFromCan.mp3", {autoPlay:false}); var queueFarm:LoaderMax = new LoaderMax({onComplete:FarmLoad}); queueFarm.append(soundFarm1); queueFarm.append(soundFarm2); queueFarm.load(); var tlFarm:TimelineMax = new TimelineMax({paused:true}) //background loop tlFarm.addCallback(playSoundFarm1, .01); tlFarm.append(TweenLite.to(A, 6, {autoAlpha:1})); tlFarm.append(TweenLite.to(A, 1, {autoAlpha:0})); tlFarm.addCallback(playSoundFarm2, 7.5); tlFarm.append(TweenLite.to(B, 7, {autoAlpha:1}), -3); tlFarm.append(TweenLite.to(B, 1, {autoAlpha:0})); tlFarm.append(TweenLite.to(C, 2, {autoAlpha:1})); tlFarm.append(TweenLite.to(C, 2, {autoAlpha:1}), -2); ///////////////////////////////// ////////////////////////////// function FarmLoad(e:LoaderEvent):void { trace("soundsComplete"); tlFarm.play(); // sound3.soundPaused = !sound3.soundPaused; } function playSoundFarm1():void{ soundFarm1.gotoSoundTime(0, true); } function playSoundFarm2():void{ soundFarm2.gotoSoundTime(0, true); } /////////////////////////////// var contentLoader:Loader; loadContent("main.swf"); function loadContent(url:String):void { contentLoader = new Loader(); contentLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loading); contentLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, contentLoaded); contentLoader.load(new URLRequest(url)); } function contentLoaded(evt:Event):void { //Optionally change to a clip holder and set progressbar visibility. addChild(contentLoader); } function loading(evt:ProgressEvent):void { var loaded:Number = evt.bytesLoaded / evt.bytesTotal; setBarProgress(loaded); } function setBarProgress(value:Number) { progressbar.bar.scaleX = value; }
  6. Thanks for your help Carl. To further explain the problem I created several scenes each on there own frame with their own timeline. Some of these scenes had a repeating audio in a loop and others had audio in the timeline that was still playing if the user went to another frame and new timeline in the swf. What I found to work was to pause the background sound and also the timeline it was in. For some reason just stopping the timeline didn't stop the repeating sound. Below is an a button that I made that takes you out of the current frame to a home page. soundFish1 was the name of the repeating sound and tlFish was the name of the timeline Max animation. There might be a better way to do this but I got it to work by: goHomeButton.addEventListener(MouseEvent.CLICK, goHomeTest); function goHomeTest(event:MouseEvent):void { gotoAndPlay(1); soundFish1.soundPaused = !soundFish1.soundPaused; tlFish.gotoAndStop(0) }
  7. Carl, That worked pefectly. Much better. I definitely agree with you on setting everything up on one frame but I could never figure out quite how to do it with multiple sounds, loader frames and animations. Here's what I currently have: 2 frames with UI Loaders loading in external images and content from an external xml file, 6 more frames with unique green sock animations that have sounds throughout and some utilize different background loops. My only problem right now is if I test the movie and go to one of the frames and leave before the animation completes the sounds in that animation will continue on another frame. So I will get sound from the wrong frame if I leave too quickly. What would you suggest? I'm guessing I need to put the animations on each frame into separate movieclips then put them on one frame and control with code? I just don't know how to do that. Hope that makes sense. I'll be glad to create another example if it doesn't. Again thanks for your help.
  8. Sorry for the confusion. I redid the file so it hopefully is easier to see what I'm trying to accomplish. I'm trying to make a file with 2 frames. Each frame has a unique background audio loop and also a button that on rollover plays a sound effect and reveals a solid colored shape. Each background audio loop should only play on its frame. I changed the name function name like you suggested so the queue2 would not be calling the same function queue was in frame 1. That worked. So now I can switch back between the frames and the loops start and stop fine as long as I only click on the button to move to either frame 1 or frame 2. However, if I click anywhere else on the frame the sound stops. I'd like for it to just stop when I left the frame. Is there a better way to create somewhat of an event listener so that the loops will only stop if you exit their frame? I've attached the new file . Appreciate your help.
  9. Ok I did that. And it works fine on one frame. But I'm having a problem when I try to create another background sound in another frame on the timeline using the same method. I keep getting: ArgumentError: Error #2068: Invalid sound. at flash.media::Sound/play() at com.greensock.loading::MP3Loader/_playSound() at com.greensock.loading::MP3Loader/set soundPaused() at BackgroundButtonsLoopsDiffFramesFINAL_fla::MainTimeline/toggles2() soundsComplete I've included a zipped up file. Would you mind taking a look at it?
  10. I created a basic invisible button that plays a movie clip when it's rolled over. However, for some reason when I test the movie it only works on every other rollover. Can anyone help me figure out why? Here's the buttons code (it plays a random movie): xperson1_btn.addEventListener(MouseEvent.ROLL_OVER, playRandomMovieClip1); function playRandomMovieClip1(event:MouseEvent):void { if (randomNumber==1) { fishermanClip1.gotoAndPlay(2); blondeClip1.gotoAndStop(1); } else { fishermanClip2.gotoAndPlay(2); blondeClip2.gotoAndStop(1); } } Here's my movieclip code for the 2nd frame, the first frame just has a stop action in it: stop(); import com.greensock.*; import com.greensock.easing.*; import com.greensock.plugins.*; import com.greensock.OverwriteManager; import com.greensock.events.LoaderEvent; import com.greensock.loading.* import flash.events.Event import flash.media.Sound; import flash.media.SoundChannel; OverwriteManager.init(1) var clips:Array = [ hereFishy_mc ]; TweenMax.allTo(clips, 0, {autoAlpha:1}); var sound1:MP3Loader = new MP3Loader("audio/HereFishyRough.mp3", {autoPlay:false}); var queue:LoaderMax = new LoaderMax({onComplete:init}); queue.append(sound1); queue.load(); var tl:TimelineMax = new TimelineMax({paused:true}) tl.addCallback(playSound1, tl.duration); tl.append(TweenLite.to(hereFishy_mc, 1.5, {autoAlpha:1})); tl.append(TweenLite.to(hereFishy_mc, 1.5, {autoAlpha:0})); function init(e:LoaderEvent):void { trace("soundsComplete"); tl.play(); } function playSound1():void{ sound1.gotoSoundTime(0, true); }
  11. I have a basic looping stock like ticker that has movieclips that loop and have links. Right now there is a huge gap in between the loops. Also for simplicity there are only 2 movie clips but I'll be adding several more. Two questions: A) Can someone help me reduce the gap and is there a better way to do this? import com.greensock.*; import com.greensock.easing.*; import com.greensock.plugins.*; MainAnimation(); function MainAnimation():void { TweenMax.fromTo(red1, 5, {x:500}, {x:-600, ease:Linear.easeNone}); TweenMax.fromTo(red2, 10, {x:1100}, {x:-1200, ease:Linear.easeNone, onComplete:repeatAnimation}); } function repeatAnimation():void { MainAnimation(); }
  12. Carl, Here's the source file: http://goo.gl/6SghW I attached an image of the errors as well. Thanks again for your help.
  13. Thanks for your help Carl. I tweaked the code based on your suggestions but I'm still having problems. Is there a class that I'm not importing correctly? Would you mind looking at it again? I keep getting 1046 errors and 3590 errors. import com.greensock.*; import com.greensock.easing.*; import com.greensock.plugins.*; import com.greensock.OverwriteManager; import com.greensock.events.LoaderEvent; import com.greensock.loading.* import flash.media.Sound; import flash.media.SoundChannel; OverwriteManager.init(2) var clips:Array = [yellow, red, green, rectangle ]; TweenMax.allTo(clips, 0, {autoAlpha:0}); green.mask = rectangle //load two sounds var sound1:MP3Loader = new MP3Loader("sound.mp3", {autoPlay:false}); var sound2:MP3Loader = new MP3Loader("sound2.mp3", {autoPlay:false}); var queue:LoaderMax = new LoaderMax({onComplete:init}); queue.append(sound1); queue.append(sound2); queue.load(); //set up the timelinemax var tl:TimelineMax = new TimelineMax({paused:true}) //play sound1 after green circle appears tl.append(TweenLite.to(green, 3, {autoAlpha:1})); tl.addCallback(playSound1, tl.duration); //yellow circle appears no sound tl.append(TweenLite.to(yellow, 3, {autoAlpha:1})); //play sound2 after red appears tl.append(TweenLite.to(red, 3, {autoAlpha:1})); tl.addCallback(playSound2, tl.duration); //wait for the sound to load function init(e:LoaderEvent):void { trace("soundsComplete"); tl.play(); } function playSound():void{ sound1.gotoSoundTime(0, true); } function playSound2():void{ sound2.gotoSoundTime(0, true); }
×
×
  • Create New...