Jump to content
Search Community

obi_wan

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by obi_wan

  1. I figured it out I simply had to remove the default easing and set it to ease:Linear.easeNone rotationExample = TweenMax.to($('.circle'), 15, { css: { rotation:360 }, // remove default easing for seamless loop ease:Linear.easeNone repeat: -1, paused: false });
  2. Hey folks I was wandering how to achieve a constant rotation. Currently I have a tween that rotates but when it reaches the duration and degrees it stops for a very short period before the repeat-1 kicks in. Any idea on how to get a constant rotation without any stops in the animation? rotationExample = TweenMax.to($('.circle'), 15, { css: { rotation:360 }, repeat: -1, paused: false });
  3. It's ok I finally was able to solve my problem. Basically I created a sprite that overlayed all the items and disabled mouse enabled, when the user selected an item I enabled the sprite preventing the items from being selected. when the sound play progress was complete I dispatched an event disabling the sprite and everything seems to work great now with out any unwanted clicks, overlapping audio and animations.
  4. I am stumped, I think I got myself in a little pickle here LOL. This is how I am setting up the individual items: private function initEaselItems():void { var easelItemURL :String; var totalEaselItems :Number = _xmlsource.easelAssets.alphabet.length(); for(var i:int=0; i { easelItemURL = _xmlsource.easelAssets.alphabet.@imageURL[i]; _easelItemClip = new MovieClip(); _easelItemClip.name = "easelItemClip"+[i]; _easelItemClip.index = [i]; _easelItemClip.x = _xmlsource.easelAssets.alphabet.@xPos[i]; _easelItemClip.y = _xmlsource.easelAssets.alphabet.@yPos[i]; _easelItemClip.alpha = 0; _easelItem = new ImageLoader(easelItemURL,{estimatedBytes:2400,container:_easelItemClip}); _easel.alphabetContainer.addChild(_easelItemClip); _easelItem.load(); _easelItemClip.buttonMode = true; _easelItemClip.addEventListener(MouseEvent.CLICK,easelItemHandler,false,0,true); TweenLite.to(_easelItemClip, .5, {alpha:1, scaleX:.6, scaleY:.6, delay:(i*.03)}); _levelTwoArray.push(_easelItemClip.name); _levelItemsArray.push(_easelItemClip.name); } initDrawerContent(); } And this is where I am just confused and lost in the condition and loop: private function easelItemHandler(event:MouseEvent):void { var totalEaselItems :Number = _xmlsource.easelAssets.alphabet.length(); var selectedItem :String = event.currentTarget.name; for (var i:int = 0; i { if (selectedItem == _levelTwoArray[i] && _soundManager.gameSound.playProgress == 1) { _soundManager.playAudio(_soundManager.alphabetAudioArray[i],_soundManager.mp3Loader); TweenLite.to(event.currentTarget, .25, {transformAroundCenter:{scaleX:1, scaleY:1}}); TweenMax.to(event.currentTarget,.25, {glowFilter:{color:0xffffff, alpha:1, blurX:80, blurY:80, strength:0.8, quality:1}}); _easel.displayDrawer.titleContainer.name_txt.text = _xmlsource.drawerAssets.drawerItem.@title[i]; TweenLite.to(_easel.displayDrawer.imageContainer.getChildByName("drawerItemClip"+i), .5, {alpha:1}); if(_levelItemsArray.length != 0) { _arrayManager.removeItemFromArray(_levelItemsArray,selectedItem); } } // if(selectedItem == _levelTwoArray[i] && _soundManager.gameSound.playProgress != 1) // { // trace("selected item dont scale down or fade out"); // } else { TweenLite.to(_easel.alphabetContainer.getChildByName("easelItemClip"+ i), .25, {transformAroundCenter:{scaleX:.6, scaleY:.6}}); TweenMax.to(_easel.alphabetContainer.getChildByName("easelItemClip"+ i),.25, {glowFilter:{remove:true}}); TweenLite.to(_easel.displayDrawer.imageContainer.getChildByName("drawerItemClip"+i), .5, {alpha:0}); } } }
  5. I have a bunch of items that I loop through, when the user selects the item, it does a couple of things. 1. Plays a sound 2. Animates the selected item (scales and adds glow) 3. Scales any other other item not equal to selected item or That works ok but I wanted to bullet proof this by adding another condition which basically checks that if the selected item is clicked and the sound has not loaded don't do anything. Currently when you select an item it scales up and plays the sound and if you select another item while the sound is playing it scales down every item until you select a new item when it is done loading. If anyone can please take a look at the code I have attached and give me some pointers that would be greatly appreciated. private function easelItemHandler(event:MouseEvent):void { var totalEaselItems :Number = _xmlsource.easelAssets.alphabet.length(); var selectedItem :String = event.currentTarget.name; for (var i:int = 0; i { if (selectedItem == _levelTwoArray[i] && _soundManager.gameSound.playProgress == 1) { _soundManager.playAudio(_soundManager.alphabetAudioArray[i],_soundManager.mp3Loader); TweenLite.to(event.currentTarget, .25, {transformAroundCenter:{scaleX:1, scaleY:1}}); TweenMax.to(event.currentTarget,.25, {glowFilter:{color:0xffffff, alpha:1, blurX:80, blurY:80, strength:0.8, quality:1}}); _easel.displayDrawer.titleContainer.name_txt.text = _xmlsource.drawerAssets.drawerItem.@title[i]; TweenLite.to(_easel.displayDrawer.imageContainer.getChildByName("drawerItemClip"+i), .5, {alpha:1}); if(_levelItemsArray.length != 0) { _arrayManager.removeItemFromArray(_levelItemsArray,selectedItem); } } if(selectedItem == _levelTwoArray[i] && _soundManager.gameSound.playProgress != 1) { trace("selected item dont scale down or fade out"); } else { TweenLite.to(_easel.alphabetContainer.getChildByName("easelItemClip"+ i), .25, {transformAroundCenter:{scaleX:.6, scaleY:.6}}); TweenMax.to(_easel.alphabetContainer.getChildByName("easelItemClip"+ i),.25, {glowFilter:{remove:true}}); TweenLite.to(_easel.displayDrawer.imageContainer.getChildByName("drawerItemClip"+i), .5, {alpha:0}); } } }
  6. Hi Carl thanks for all your help. Below is what I used that finally worked based on your feed back. I don't neccessarily think I did it the best way, seems slightly repetitive on my part due to lack of as3 chops but it works and when my schedule frees up a bit I can spend a little more time making this better. Again thanks for your help. public function playAudio(audioURL:String, whatToLoad:Object):void { whatToLoad = gameSound; if(LoaderMax.getLoader(audioURL)== null) { gameSound = new MP3Loader(audioURL, {name:"game_sound", autoPlay:true}); gameSound.load(); trace(audioURL) } else { if (gameSound.playProgress == 1) { gameSound = new MP3Loader(audioURL, {name:"game_sound", autoPlay:true}); gameSound.load(); } } }
  7. I appreciate the help but when I try implementing your example I still get the audio playing over each other. Here is what I used based on your help. This is the event listener that fires the method in my sound manager _item1.addEventListener(MouseEvent.CLICK,itemHandler,false,0,false); private function itemHandler(event:MouseEvent):void { _soundManager.playAudio(_soundManager.item1AudioURL,_soundManager.mp3Loader); } This is the code inside of my sound manager class that I updated to reflect your changes public var mp3Loader :MP3Loader; public var gameSound :Object; public var item1AudioURL :String; item1AudioURL = _xmlsource.levelItem1.@url; public function playAudio(audioURL:String, whatToLoad:Object):void { whatToLoad = gameSound; _audioPlaying = true; gameSound = new MP3Loader(audioURL, {name:"game_sound", autoPlay:true}); if (gameSound.status != LoaderStatus.COMPLETED) { gameSound.load(); } else { if (gameSound.playProgress == 1) { gameSound.gotoSoundTime(0, true); } else { trace("\n **** Sorry the sound is currently playing, ****"); trace("\n **** Please wait " + (gameSound.duration - gameSound.soundTime) + " seconds"); } } }
  8. Hey greensock folks, I have a rather simple problem that I just cant seem to get right. I have several buttons that play different sounds. When you click on the buttons they all play the appropriate sound. But when you click on the buttons really fast you can hear the sounds overlapping each other briefly. Basically if the sound is not playing, play the sound else nothing. Below please view the code I have attached. Any help would be greatly appreciated. /** * @param audioURL * @param whatToLoad */ public function playAudio(audioURL:String, whatToLoad:Object):void { if(!_audioPlaying) { _audioPlaying = true; whatToLoad = new MP3Loader(audioURL, {name:"sound_fx", autoPlay:false, onComplete:startAudio}); whatToLoad.load(); } } private function startAudio(event:LoaderEvent):void { event.currentTarget.gotoSoundTime(0,true); _audioTimer = new Timer(550); _audioTimer.addEventListener(TimerEvent.TIMER, onTimer, false,0,false); _audioTimer.start(); }
  9. getChildByName worked great. Thank you for taking the time to help.
  10. Hello everyone I am having a tough time and any help would be greatly appreciated. I have several movieclips that I load with loader max, when the user clicks on the movieclip it scales the movieclip selected which is the event.currentTarget from 60% to 100%. The problem I am having is that if it is not the currentTarget it should scale down to 60%. I have the logic correct but am having a really rough time targeting all other movieclips that are not the current target. Please review the code attached. I am open to any better solutions and any help again would be very appreciated. Thank you for your time. private function initEaselItems():void { var easelItemURL :String; var totalEaselItems :Number = _xmlsource.easelAssets.alphabet.length(); for(var i:int=0; i { easelItemURL = _xmlsource.easelAssets.alphabet.@imageURL[i]; _easelItemClip = new MovieClip(); _easelItemClip.name = "easelItemClip"+[i]; _easelItemClip.index = [i]; _easelItemClip.x = _xmlsource.easelAssets.alphabet.@xPos[i]; _easelItemClip.y = _xmlsource.easelAssets.alphabet.@yPos[i]; _easelItemClip.alpha = 0; _easelItem = new ImageLoader(easelItemURL, { estimatedBytes:2400, container:_easelItemClip, }); _easel.alphabetContainer.addChild(_easelItemClip); _easelItem.load(); _easelItemClip.addEventListener(MouseEvent.CLICK,easelItemHandler,false,0,true); TweenLite.to(_easelItemClip, .5, {alpha:1, scaleX:.6, scaleY:.6, delay:(i*.15)}); _levelTwoArray.push(_easelItemClip.name); } } private function easelItemHandler(event:MouseEvent):void { var totalEaselItems :Number = _xmlsource.easelAssets.alphabet.length(); var item :String = event.currentTarget.name; trace(_levelTwoArray[i]); for (var i:int = 0; i<=totalEaselItems; i++) { if (item == _levelTwoArray[i]) { trace("scale selected item up:"); TweenLite.to(event.currentTarget, .5, {transformAroundCenter:{scaleX:1, scaleY:1}}); } else { trace("scale on all other items down"); // the code below throws an error I cant target the rest of the movie clips //TweenLite.to(_easel.alphabetContainer["easelItemClip"+ i], .5, {transformAroundCenter:{scaleX:1, scaleY:1}}); } } }
  11. Hey everyone I have this tilt animation that just cant get right. Essentially what I am trying to achieve is the following: When the animation is started it sort of slightly swings from left to right with sort of a realistic swing. I have it sort of working but I cant get the tilt left and tilt complete methods to happen together with out it overwritting each other. So as temporary solution I am using the onComplete. But if anyone could help me out here I would really appreciate it. tiltRight(); private function tiltRight():void { TweenLite.to(_settings, 1.5, {transformAroundPoint:{point:new Point(500,-18), rotation:-6 }, y:-18, alpha:1, ease:Bounce.easeOut, onComplete:tiltLeft }); } private function tiltLeft():void { TweenLite.from(_settings, .5, {transformAroundPoint:{point:new Point(500,-18), rotation:-6 }, onComplete:tiltComplete }); } private function tiltComplete():void { TweenLite.to(_settings, 1.5, {transformAroundPoint:{point:new Point(500,-18), rotation:0 }, ease:Bounce.easeOut }); }
×
×
  • Create New...