Jump to content
GreenSock

Amnesicat

Members
  • Posts

    25
  • Joined

  • Last visited

Posts posted by Amnesicat

  1. Hello there,

    I would really like some guidance on the best approach for loading multiple SWFs via an array of buttons ie. each button loads a different SWF url. Should I use a Loadermax parse?, if so, how exactly should I go about it?

    Any example code would be greatly appreciated.

    Thanks,
    Alan

  2. Well actually Carl's solution seemed to work the best, as tweenTo interupts the toggle which then requires two clicks before it activates again. Anyhow, I wasn't really complaining about it, I was just curious to see if it was possible. But I decided to totally reconstruct the code so that an onReverseComplete wasn't required, which in turn solved another issue I was struggling with.

     

    Thank you all again for your contributions. I always receive quick helpful advice from these forums, for which I am truly grateful.

     

    Cheers.

    • Like 1
  3. This is just a simplified sample, it makes sense in context of the larger project it's from.

     

    Thanks, I tried tl.tweenTo(0) but it still seems to activate the onReverseComplete, which is what I don't want to happen.

  4. Hi,

    I have a timeline with an onReverseComplete and a listener that toggles the tween and another listener that just reverses it. Is it possible to reverse the tween without activating the onReverseComplete?

    Thanks.

    var tl:TimelineMax;
    
    tl = new TimelineMax({paused:true, reversed:true, onReverseComplete:doSomething});
    tl.to(mc1, 0.5, {x:"50"});
    tl.to(mc1, 0.5, {y:"50"});
    
    mc1.addEventListener(MouseEvent.MOUSE_DOWN, mcTween);
    mc2.addEventListener(MouseEvent.MOUSE_DOWN, mcReverse);
    
    function mcTween(e:MouseEvent):void
    {
        tl.reversed(!tl.reversed());
        tl.resume();
    }
    
    function mcReverse(e:MouseEvent):void
    {
        tl.reverse();//don't want this to activate onReverseComplete
    }
    
    function doSomething():void
    {
        trace("something");
    }
  5. Yeah I initially thought it may have been a Flash "bug", but then it seems to work just fine when using the native classes. Even Tweener works great, so how does that add up?!. When using Greensock it's almost like the tween is holding onto the loader for some reason, hence the memory build up.

    Anyway, thanks for your help. I guess I'll just have to find some other way around it, even if it means placing a "dummy" tween on the parent. Seems like a real waste of code though.

  6. Thanks, but were you using a mac? Perhaps it's a windows issue?, because I've tried it on 3 different windows computers and they all do the same thing (don't have access to mac) .

     

    Here's what I've discovered so far (using latest greensock version):

    • It only seems to happen on standalone and Air desktop players ("publish preview" in Flash Pro and web plugins work fine).
    • Happens in all standalone player versions I've tested from 10 to 12.
    • Happens when a tween is attached to a video, image or swf content or using dispose with flush content ie: vidContainer.dispose(true);
    • Using native AS3 tweens don't do it.
    • Here's another strange one, if a tween is also on the parent swf it doesn't do it.

    This is just really baffling. If I didn't have to use the standalone players or Air for Desktop I wouldn't mind, but unfortunately my projects require it.

  7. Thanks Carl, but I don't know what's going on with my version. I get the same "publish preview" results as you (doesn't pass 30), but inside the standalone player it just continues to rise over 100. I've attached profiler results below that show over 100 captured loader instances too, whereas without the tween it doesn't go above 2 instances.

     

    Could I ask a favour?, could you please redownload my test swf I posted earlier and run it in the standalone player (but don't compile it with your Flash Pro at all), and let me know the results?. I just want to rule out possible compiler options or something!?!! Also, would you then be able to compile a version with your Flash Pro and send me the swfs and I'll test on my end?

     

    I'd greatly appreciate your assistance with this, thank you.

     

    Profiler_Results.png

    Standalone_Player_Results.png

  8. Hi again,

     

    I'm still trying to figure out what's going on, as I'm getting inconsistent results with further testing. To eliminate a few possibilities could you please tell me how you viewed the test example I provided; did you do a "publish preview" inside Flash Pro or did you use a Standalone Flash Player?

     

    Thanks for your time.

  9. Hello,

     

    I'm having a bit of trouble with some memory leaks that seem to happen when disposing a Videoloader that has a tween on it's content.

     

    I've attached a very simple FLA example below that loads a swf containing a Videoloader which loads a single video. Pressing unload calls a dispose function inside the swf which should dispose of the video and tween. Repeatively pressing unload/load quickly increases memory usage, and according to the Flash Builder profiler there are increasing numbers of Videoloader instances being retained with no release.

     

    Although the strange thing is that if there is no tween on the video it works fine, no increase of memory or Videoloader instances at all.

     

    So, am I missing something? Why is this happening and how can I rectify it?. Any advice would be greatly appreciated.

     

    FLA Example: http://snk.to/f-cdh8238p

     

    Thanks a lot,

    Alan

  10. Ok, so rule of thumb is killChildTweensOf(this) should kill all tweens but any Timeline instances need to be disposed of individually? I guess I was just hoping that it would be a sort of killAll(this) type of alternative.

     

    Thanks for the clarification, Jack.
     

  11. Hi Carl,

     

    As you suggested, I have created a simple example (see attachment) where the killChildTweensOf(this) doesn't seem to be destroying the tweens, resulting in increased memory that doesn't get fully released. But if you uncomment and use the killAll() method in each gallery child-swf instead, it works fine.

     

    Thanks for helping me with this Carl, I really appreciate it.

    killChildTweensOf_Test.zip

    • Like 1
  12. Hi Carl,

     

    Yes, "this" refers to this video player instance which is a child swf of a main constructor swf. Sorry if there was some confusion there. I see you use TweenMax.killChildTweensOf(this) in your code illustrated here: http://forums.greensock.com/topic/7382-killall-only-in-a-loaded-mc/?hl=killchildtweensof#entry27762. I also tried this method but there is no difference. Is it because I'm using local variables like mcArray & mcArray2, will changing them to a global variable help? Sorry, I'm a bit lost as to what would be the best approach to get the same effect as TweenMax.killAll() without destroying the main swf tweens.

     

    Cheers.

  13. Hi,
     
    I have some video player code below which is loaded in via a main constructor and then unloaded with a dispose method (see end of code below) that uses a TweenMax.killTweensOf(this) to purge all tweens for GC. The trouble is this doesn't seem to be working as memory continuously rises without dropping at all. Using TweenMax.killAll() instead works great, but I have tweens within the main constructor that I don't want deleted.
     
    So, is there a way to use TweenMax.killAll() and place an exception on the main constructor tweens so that they don't get destroyed? Or is it that I am not using the TweenMax.killTweensOf() method correctly?
     
    Any advice would be greatly appreciated.

     

    Thanks.
     

    package
    {
    	import flash.display.*;
    	import flash.events.*;
    	import flash.geom.Rectangle;
    	
    	import com.greensock.*;
    	import com.greensock.easing.*;
    	import com.greensock.events.LoaderEvent;
    	import com.greensock.loading.LoaderMax;
    	import com.greensock.loading.XMLLoader;
    	import com.greensock.loading.VideoLoader;
    	
    	public class VideoPlayerMain extends MovieClip
    	{
    		private var _videos:Array;
    		private var _currentVideo:VideoLoader;
    		private var xmlLoader:XMLLoader;
    		private var queue:LoaderMax;
    		private var _silentMode:Boolean;
    		private var _preScrubPaused:Boolean;
    		private var currentNav:MovieClip;
    		private var navItem:MovieClip;
    		private var tl:TimelineMax;
    		
    		public function VideoPlayerMain()
    		{
    			if (stage)
    			{
    				init();
    			}
    			else
    			{
    				this.addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
    			}
    		}
    		
    		private function init(e:Event = null):void
    		{
    			this.removeEventListener(Event.ADDED_TO_STAGE, init);
    			
    			var mcArray:Array = [navBarBtn.vid3Btn, navBarBtn.vid2Btn, navBarBtn.vid1Btn];
    			var mcArray2:Array = [navBarBtn.vid4Btn, navBarBtn.vid5Btn, navBarBtn.vid6Btn];
    			
    			tl = new TimelineMax();
    			tl.add(TweenMax.allFrom(mcArray2, 2, {y:-800, ease:Bounce.easeOut}, 0.1));
    			tl.add(TweenMax.from(videoMC, 2, {y:-240, ease:Bounce.easeOut, onComplete:addButtonListeners}), 1.2);
    			tl.add(TweenMax.allFrom(mcArray, 2, {y:-800, ease:Bounce.easeOut}, 0.1), 0.8);
    			
    			initUI();
    			
    			LoaderMax.activate([XMLLoader, VideoLoader]);
    			
    			xmlLoader = new XMLLoader("assets/Page3/xml/videoList.xml", {name:"videoList", onComplete:xmlHandler});
    			xmlLoader.load();
    			
    			var curParent:DisplayObjectContainer = this.parent;
    			while (curParent)
    			{
    				if (curParent.hasOwnProperty("loader") && curParent.hasOwnProperty("rawContent"))
    				{
    					Object(curParent).loader.addEventListener("unload", dispose, false, 0, true);
    				}
    				curParent = curParent.parent;
    			}
    		}
    		
    		private function xmlHandler(event:LoaderEvent):void
    		{
    			queue = LoaderMax.getLoader("videoListLoader");
    			_videos = queue.getChildren();
    			queue.load();
    			
    			showVideo(_videos[0]);
    			_currentVideo.pauseVideo();
    			TweenMax.to(videoMC.playPauseBigButton_mc, 0.3, {autoAlpha:0.6});
    			videoMC.controlUI_mc.playPauseButton_mc.gotoAndStop("paused");
    		}
    		
    		private function initUI():void
    		{
    			videoMC.controlUI_mc.progressBar_mc.mouseEnabled = false;
    			videoMC.controlUI_mc.blendMode = "layer";
    			videoMC.controlUI_mc.progressBar_mc.width = videoMC.controlUI_mc.loadingBar_mc.width = 0;
    			videoMC.controlUI_mc.scrubber_mc.x = videoMC.controlUI_mc.progressBar_mc.x;
    			
    			TweenMax.allTo([videoMC.playPauseBigButton_mc], 0, {autoAlpha:0});
    		}
    		
    		private function addButtonListeners():void
    		{
    			navBarBtn.vid1Btn.addEventListener(MouseEvent.CLICK, vid1Play, false, 0, true);
    			navBarBtn.vid2Btn.addEventListener(MouseEvent.CLICK, vid2Play, false, 0, true);
    			navBarBtn.vid3Btn.addEventListener(MouseEvent.CLICK, vid3Play, false, 0, true);
    			navBarBtn.vid4Btn.addEventListener(MouseEvent.CLICK, vid4Play, false, 0, true);
    			navBarBtn.vid5Btn.addEventListener(MouseEvent.CLICK, vid5Play, false, 0, true);
    			navBarBtn.vid6Btn.addEventListener(MouseEvent.CLICK, vid6Play, false, 0, true);
    			
    			navBarBtn.addEventListener(MouseEvent.MOUSE_DOWN, btnHiliteOn, false, 0, true);
    			navBarBtn.addEventListener(MouseEvent.MOUSE_UP, btnHiliteOff, false, 0, true);
    			navBarBtn.addEventListener(MouseEvent.MOUSE_OUT, btnHiliteOff, false, 0, true);
    		}
    		
    		private function activateUI():void
    		{
    			addListeners([videoMC.controlUI_mc.playPauseButton_mc, videoMC.playPauseBigButton_mc, videoMC.videoContainer_mc], MouseEvent.CLICK, togglePlayPause);
    			videoMC.controlUI_mc.scrubber_mc.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownScrubber, false, 0, true);
    			videoMC.controlUI_mc.loadingBar_mc.addEventListener(MouseEvent.MOUSE_DOWN, scrubToMouse, false, 0, true);
    			
    			navBarBtn.vid1Btn.mouseChildren = false;
    			navBarBtn.vid2Btn.mouseChildren = false;
    			navBarBtn.vid3Btn.mouseChildren = false;
    			navBarBtn.vid4Btn.mouseChildren = false;
    			navBarBtn.vid5Btn.mouseChildren = false;
    			navBarBtn.vid6Btn.mouseChildren = false;
    			navBarBtn.vid1Btn.startBtnHi.mouseEnabled = false;
    			navBarBtn.vid1Btn.btnHi.mouseEnabled = false;
    			navBarBtn.vid2Btn.btnHi.mouseEnabled = false;
    			navBarBtn.vid3Btn.btnHi.mouseEnabled = false;
    			navBarBtn.vid4Btn.btnHi.mouseEnabled = false;
    			navBarBtn.vid5Btn.btnHi.mouseEnabled = false;
    			navBarBtn.vid6Btn.btnHi.mouseEnabled = false;
    			
    			TweenMax.to(navBarBtn.vid1Btn.startBtnHi, 0, {autoAlpha:1});
    			
    			var controls:Array = [videoMC.controlUI_mc.playPauseButton_mc, videoMC.playPauseBigButton_mc, videoMC.controlUI_mc.scrubber_mc];
    			var i:int = controls.length;
    			while (i--)
    			{
    				controls[i].buttonMode = true;
    				controls[i].mouseChildren = false;
    			}
    		}
    		
    		private function showVideo(video:VideoLoader):void
    		{
    			if (video == _currentVideo)
    			{
    				return;
    			}
    			
    			if (_currentVideo == null)
    			{
    				activateUI();
    			}
    			else
    			{
    				_currentVideo.removeEventListener(LoaderEvent.PROGRESS, updateDownloadProgress);
    				_currentVideo.removeEventListener(VideoLoader.VIDEO_COMPLETE, restartVideo);
    				_currentVideo.removeEventListener(VideoLoader.PLAY_PROGRESS, updatePlayProgress);
    				_currentVideo.removeEventListener(LoaderEvent.INIT, refreshTotalTime);
    				
    				if (_currentVideo.videoPaused)
    				{
    					togglePlayPause();
    				}
    				
    				TweenMax.to(_currentVideo.content, 0.8, {autoAlpha:0});
    				TweenMax.to(_currentVideo, 0.8, {volume:0, onComplete:rewindAndPause, onCompleteParams:[_currentVideo]});
    			}
    			
    			_currentVideo = video;
    			_currentVideo.addEventListener(LoaderEvent.PROGRESS, updateDownloadProgress, false, 0, true);
    			_currentVideo.addEventListener(VideoLoader.VIDEO_COMPLETE, restartVideo, false, 0, true);
    			_currentVideo.addEventListener(VideoLoader.PLAY_PROGRESS, updatePlayProgress, false, 0, true);
    			
    			if (_currentVideo.progress < 1 && _currentVideo.bufferProgress < 1)
    			{
    				_currentVideo.prioritize(true);
    			}
    			
    			_currentVideo.gotoVideoTime(0, true);
    			_currentVideo.volume = 0;
    			
    			if (!_silentMode)
    			{
    				TweenMax.to(_currentVideo, 0.8, {volume:1});
    			}
    			
    			videoMC.videoContainer_mc.addChild(_currentVideo.content);
    			
    			TweenMax.to(_currentVideo.content, 0.8, {autoAlpha:1});
    			
    			refreshTotalTime();
    			
    			if (_currentVideo.metaData == null)
    			{
    				_currentVideo.addEventListener(LoaderEvent.INIT, refreshTotalTime, false, 0, true);
    			}
    			
    			updateDownloadProgress();
    			updatePlayProgress();
    		}
    		
    		private function rewindAndPause(video:VideoLoader):void
    		{
    			video.pauseVideo();
    			video.gotoVideoTime(0);
    		}
    		
    		private function refreshTotalTime(event:LoaderEvent = null):void
    		{
    			var minutes:String = force2Digits(int(_currentVideo.duration / 60));
    			var seconds:String = force2Digits(int(_currentVideo.duration % 60));
    			videoMC.controlUI_mc.totalTime_tf.text = minutes + ":" + seconds;
    		}
    		
    		private function vid1Play(event:Event):void
    		{
    			showVideo(_videos[0]);
    			_currentVideo.gotoVideoTime(0);
    			_currentVideo.pauseVideo();
    			TweenMax.to(videoMC.playPauseBigButton_mc, 0.3, {autoAlpha:0.6});
    			videoMC.controlUI_mc.playPauseButton_mc.gotoAndStop("paused");
    			navItem = navBarBtn.vid1Btn;
    			navClick();
    		}
    		
    		private function vid2Play(event:Event):void
    		{
    			showVideo(_videos[1]);
    			_currentVideo.gotoVideoTime(0);
    			_currentVideo.pauseVideo();
    			TweenMax.to(videoMC.playPauseBigButton_mc, 0.3, {autoAlpha:0.6});
    			videoMC.controlUI_mc.playPauseButton_mc.gotoAndStop("paused");
    			navItem = navBarBtn.vid2Btn;
    			navClick();
    		}
    		
    		private function vid3Play(event:Event):void
    		{
    			showVideo(_videos[2]);
    			_currentVideo.gotoVideoTime(0);
    			_currentVideo.pauseVideo();
    			TweenMax.to(videoMC.playPauseBigButton_mc, 0.3, {autoAlpha:0.6});
    			videoMC.controlUI_mc.playPauseButton_mc.gotoAndStop("paused");
    			navItem = navBarBtn.vid3Btn;
    			navClick();
    		}
    		
    		private function vid4Play(event:Event):void
    		{
    			showVideo(_videos[3]);
    			_currentVideo.gotoVideoTime(0);
    			_currentVideo.pauseVideo();
    			TweenMax.to(videoMC.playPauseBigButton_mc, 0.3, {autoAlpha:0.6});
    			videoMC.controlUI_mc.playPauseButton_mc.gotoAndStop("paused");
    			navItem = navBarBtn.vid4Btn;
    			navClick();
    		}
    		
    		private function vid5Play(event:Event):void
    		{
    			showVideo(_videos[4]);
    			_currentVideo.gotoVideoTime(0);
    			_currentVideo.pauseVideo();
    			TweenMax.to(videoMC.playPauseBigButton_mc, 0.3, {autoAlpha:0.6});
    			videoMC.controlUI_mc.playPauseButton_mc.gotoAndStop("paused");
    			navItem = navBarBtn.vid5Btn;
    			navClick();
    		}
    		
    		private function vid6Play(event:Event):void
    		{
    			showVideo(_videos[5]);
    			_currentVideo.gotoVideoTime(0);
    			_currentVideo.pauseVideo();
    			TweenMax.to(videoMC.playPauseBigButton_mc, 0.3, {autoAlpha:0.6});
    			videoMC.controlUI_mc.playPauseButton_mc.gotoAndStop("paused");
    			navItem = navBarBtn.vid6Btn;
    			navClick();
    		}
    		
    		private function navClick():void
    		{
    			if (currentNav != null)
    			{
    				TweenMax.to(currentNav.btnHi, 0, {autoAlpha:0});
    				TweenMax.to(currentNav.btnBg, 0, {autoAlpha:1});
    			}
    			
    			TweenMax.to(navItem.btnHi, 0, {autoAlpha:1});
    			TweenMax.to(navItem.btnBg, 0, {autoAlpha:0});
    			currentNav = navItem;
    			
    			if (navBarBtn.vid1Btn.startBtnHi != null)
    			{
    				navBarBtn.vid1Btn.removeChild(navBarBtn.vid1Btn.startBtnHi);
    				navBarBtn.vid1Btn.startBtnHi = null;
    				TweenMax.to(navBarBtn.vid1Btn.btnBg, 0, {autoAlpha:1});
    			}
    		}
    		
    		private function btnHiliteOn(e:MouseEvent):void
    		{
    			TweenMax.to(e.target.hiliteMC, 0, {autoAlpha:1});
    		}
    		
    		private function btnHiliteOff(e:MouseEvent):void
    		{
    			TweenMax.to(e.target.hiliteMC, 0, {autoAlpha:0});
    		}
    		
    		private function restartVideo(event:Event):void
    		{
    			_currentVideo.gotoVideoTime(0);
    			_currentVideo.pauseVideo();
    			TweenMax.to(videoMC.playPauseBigButton_mc, 0.3, {autoAlpha:0.6});
    			videoMC.controlUI_mc.playPauseButton_mc.gotoAndStop("paused");
    		}
    		
    		private function updateDownloadProgress(event:LoaderEvent = null):void
    		{
    			videoMC.controlUI_mc.loadingBar_mc.scaleX = _currentVideo.progress;
    		}
    		
    		private function updatePlayProgress(event:LoaderEvent = null):void
    		{
    			var time:Number = _currentVideo.videoTime;
    			var minutes:String = force2Digits(int(time / 60));
    			var seconds:String = force2Digits(int(time % 60));
    			videoMC.controlUI_mc.currentTime_tf.text = minutes + ":" + seconds;
    			videoMC.controlUI_mc.progressBar_mc.scaleX = _currentVideo.playProgress;
    			videoMC.controlUI_mc.scrubber_mc.x = videoMC.controlUI_mc.progressBar_mc.x + videoMC.controlUI_mc.progressBar_mc.width;
    		}
    		
    		private function togglePlayPause(event:MouseEvent = null):void
    		{
    			_currentVideo.videoPaused = !_currentVideo.videoPaused;
    			
    			if (_currentVideo.videoPaused)
    			{
    				TweenMax.to(videoMC.playPauseBigButton_mc, 0.3, {autoAlpha:0.6});
    				videoMC.controlUI_mc.playPauseButton_mc.gotoAndStop("paused");
    				TweenMax.to(videoMC.videoContainer_mc, 0.3, {blurFilter:{blurX:4, blurY:4}, colorMatrixFilter:{brightness:0.5}});
    			}
    			else
    			{
    				TweenMax.to(videoMC.playPauseBigButton_mc, 0.3, {autoAlpha:0});
    				videoMC.controlUI_mc.playPauseButton_mc.gotoAndStop("playing");
    				TweenMax.to(videoMC.videoContainer_mc, 0.3, {blurFilter:{blurX:0, blurY:0, remove:true}, colorMatrixFilter:{brightness:1, remove:true}});
    			}
    		}
    		
    		private function mouseDownScrubber(event:MouseEvent):void
    		{
    			_preScrubPaused = _currentVideo.videoPaused;
    			_currentVideo.videoPaused = true;
    			videoMC.controlUI_mc.scrubber_mc.startDrag(false, new Rectangle(videoMC.controlUI_mc.loadingBar_mc.x, videoMC.controlUI_mc.loadingBar_mc.y, videoMC.controlUI_mc.loadingBar_mc.width, 0));
    			stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpScrubber, false, 0, true);
    			stage.addEventListener(MouseEvent.MOUSE_MOVE, progressStopper, false, 0, true);
    			stage.addEventListener(MouseEvent.MOUSE_MOVE, scrubToMouse, false, 0, true);
    		}
    		
    		private function scrubToMouse(event:MouseEvent):void
    		{
    			videoMC.controlUI_mc.progressBar_mc.width = videoMC.controlUI_mc.mouseX - videoMC.controlUI_mc.progressBar_mc.x;
    			_currentVideo.playProgress = videoMC.controlUI_mc.progressBar_mc.scaleX;
    		}
    		
    		private function mouseUpScrubber(event:MouseEvent):void
    		{
    			stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpScrubber);
    			stage.removeEventListener(MouseEvent.MOUSE_MOVE, progressStopper);
    			stage.removeEventListener(MouseEvent.MOUSE_MOVE, scrubToMouse);
    			videoMC.controlUI_mc.scrubber_mc.stopDrag();
    			_currentVideo.videoPaused = _preScrubPaused;
    		}
    		
    		private function progressStopper(event:MouseEvent):void
    		{
    			if (videoMC.controlUI_mc.scrubber_mc.x > 147)
    			{
    				stage.removeEventListener(MouseEvent.MOUSE_MOVE, scrubToMouse);
    				videoMC.controlUI_mc.scrubber_mc.stopDrag();
    			}
    		}
    		
    		private function addListeners(objects:Array, type:String, func:Function):void
    		{
    			var i:int = objects.length;
    			while (i--)
    			{
    				objects[i].addEventListener(type, func, false, 0, true);
    			}
    		}
    		
    		private function force2Digits(value:Number):String
    		{
    			return (value < 10) ? "0" + String(value) : String(value);
    		}
    		
    		private function dispose(event:Event):void
    		{
    			queue.dispose();
    			xmlLoader.dispose(true);
    			TweenMax.killTweensOf(this);
    			
    			videoMC.controlUI_mc.scrubber_mc.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownScrubber);
    			videoMC.controlUI_mc.loadingBar_mc.removeEventListener(MouseEvent.MOUSE_DOWN, scrubToMouse);
    			navBarBtn.vid1Btn.removeEventListener(MouseEvent.MOUSE_DOWN, vid1Play);
    			navBarBtn.vid2Btn.removeEventListener(MouseEvent.MOUSE_DOWN, vid2Play);
    			navBarBtn.vid3Btn.removeEventListener(MouseEvent.MOUSE_DOWN, vid3Play);
    			navBarBtn.vid4Btn.removeEventListener(MouseEvent.MOUSE_DOWN, vid4Play);
    			navBarBtn.vid5Btn.removeEventListener(MouseEvent.MOUSE_DOWN, vid5Play);
    			navBarBtn.vid6Btn.removeEventListener(MouseEvent.MOUSE_DOWN, vid6Play);
    			navBarBtn.removeEventListener(MouseEvent.MOUSE_DOWN, btnHiliteOn);
    			navBarBtn.removeEventListener(MouseEvent.MOUSE_UP, btnHiliteOff);
    			navBarBtn.removeEventListener(MouseEvent.MOUSE_OUT, btnHiliteOff);
    			_currentVideo.removeEventListener(LoaderEvent.PROGRESS, updateDownloadProgress);
    			_currentVideo.removeEventListener(VideoLoader.VIDEO_COMPLETE, restartVideo);
    			_currentVideo.removeEventListener(VideoLoader.PLAY_PROGRESS, updatePlayProgress);
    			_currentVideo.removeEventListener(LoaderEvent.INIT, refreshTotalTime);
    		}
    	}
    }
    
    • Like 1
  14. Hi all,

     

    I created a standalone desktop Air app of Carl's bezier visualiser from this post: http://forums.greensock.com/topic/4284-where-can-i-preview-bezier-curves-solved/?hl=bezier. Jazzed it up a bit by adding a control panel with additional options such as a stage height/width adjuster that configures from a minimum of 800x600 to a maximum of 2560x1600. Also added duration, curviness, timeResolution and autoRotate options. All of these are updated in the code panel, so once you've finished tweaking just right click the code, select all, copy and paste into your project. One day I might also include an add/remove point feature.

     

    This started out as a code learning project for me, but I found this tool extremely handy for quickly working out all those bezier curves. So, I hope someone else finds it useful as well.

     

    Download the BezierVisualizer Air app here: http://snk.to/f-ctk9wmmh


     

    • Like 3
  15. Hi Carl,

     

    The bezier demo you created above is really quite a handy visualization tool. Do you happen to have a v12 fla copy? Or is it possible to get a hold of the fla for the v12 plugin explorer so I can expand the dimensions to suit my needs?, as the type, curviness and timeResolution values would be extremely useful as well.

     

    I'd appreciate any help. Keep up the great work.

     

    Thanks,
    Alan
     

  16. Thanks Carl,


    I just wanted to make sure I was using TimelineMax properly and eliminate the possibility that my code was the issue. Another thing I noticed is that the stutter only happens on the first tween, if I continually click the same image after that it doesn't do it. And again if I tween just one image it also doesn't do it, only happens with multiple images in an array.


    I did a test using a simple x/y tween and they don't seem to have any stutter at all. But I think I've narrowed it down to the scale tween. Now here's the strange thing, if I scale the image up to 100% from anything below 50.1% it stutters. Any percentage scaled above that works just fine.


    Perhaps this is an anomaly with ipads and under powered computers? (mine's pretty mediocore).

  17. Hi,

    I've created a simple image enlarger using TimelineMax by inserting images via a for loop and utilising the reversed method to re-position the images when they're clicked on again (see code).

    When using this technique I've noticed a hiccup at the very beginning when you click to enlarge the image. It is almost like a stutter of some sort that hinders the smoothness of the image scaling transition. I can only just notice it on the desktop Flash player but it seems to be really noticeable on the Ipad when using Air. Strange thing though is that it doesn't happen when tweening one image, it's smooth as butter with no stutter at all.

    The images are 580 x 670 pixels, but considering it doesn't happen when tweening one image I don't think bitmap size is the issue. So, perhaps it is something to do with the way I've inserted the images with the for loop. Am I not using it in the right manner? I'd appreciate any advice on the best way to utilise TimelineMax with this technique.
     
    By the way I'm using GSAP v12 at an FPS of 60.
     

    PS - These tools are absolutely amazing. They make life so much easier. Thanks so much for developing them :-P


    Thanks a lot.

     

    import flash.events.MouseEvent;
    import flash.events.Event;
    import com.greensock.*;
    import com.greensock.easing.*;
    import com.greensock.plugins.*;
    
    TweenPlugin.activate([TransformMatrixPlugin, ScalePlugin]);
    
    var picArray:Array;
    var len:int;
    var mcTween:TimelineMax;
    
    picArray = [pic01,pic02,pic03,pic04,pic05,pic06,pic07,pic08];
    len = picArray.length;
    
    for (var i:int = 0; i < len; i++)
    {
    	var stageX = stage.stageWidth / 2;
    	var stageY = 350;
    	picArray[i].addEventListener(MouseEvent.CLICK, clickHandler, false, 0, true);
    	picArray[i].mcTween = new TimelineMax({paused:true,reversed:true});
    	picArray[i].mcTween.add(TweenMax.to(picArray[i],0.5,{transformMatrix:{x:stageX, y:stageY, rotation:0, scale:1}}));
    }
    
    function clickHandler(e:MouseEvent):void
    {
    	e.target.mcTween.reversed(!e.target.mcTween.reversed());
    	e.target.mcTween.resume();
    }
    

     

  18. Hi everybody,

     

    I would like to tween multiple movieclips (I’m only using 3 for this example) separately using only one line of tween code, but also make the targeted movieclip reverse its tween when it’s clicked on again. I’m not entirely sure how to do this as I’m not really proficient at AS3. I know I could use an eventlistener and tween for each movieclip but I would rather have something more efficient with less code clutter.

     

    Here’s what I’ve come up with so far. This code tweens each movieclip one way but doesn’t want to reverse when clicked on again.

     

    import com.greensock.*;
    import com.greensock.easing.*;
    import flash.events.MouseEvent;
    
    var mcArray:Array = [mc1, mc2, mc3];
    
    for (var i:int = 0; i < mcArray.length; i++)
    {
    mcArray[i].addEventListener(MouseEvent.CLICK, clickHandler, false, 0, true);
    }
    
    function clickHandler(e:MouseEvent):void
    {
    var mcTween:TweenMax = TweenMax.to(e.target, 1, {y:"200", ease:Quad.easeInOut, paused:true, reversed:true});
    mcTween.reversed = ! mcTween.reversed;
    mcTween.resume();
    }
    

    Any suggestions or guidance would be greatly appreciated.

    Thanks,

    Alan

×