Jump to content
Search Community

jguthrie

Members
  • Posts

    34
  • Joined

  • Last visited

Everything posted by jguthrie

  1. Really cool stuff. I need to brush up on my trigonometry... soh cah toa...
  2. Yes I can try to get some sample files to you. (I will email them) No reason in particular (but that may be my problem) just that I saw that code on a post somewhere and used it... Would you recommend I do this? _videoLoader.addEventListener(VideoLoader.VIDEO_BUFFER_EMPTY, videoBufferEmpty); _videoLoader.addEventListener(VideoLoader.VIDEO_BUFFER_FULL, videoBufferFull); protected function videoBufferEmpty(event:LoaderEvent):void { trace('videoBufferEmpty'); } protected function videoBufferFull(event:LoaderEvent):void { trace('videoBufferFull'); }
  3. Would there be anything that would cause the buffer to empty (and subsequently fire the "NetStream.Buffer.Empty" event) when the video finishes playing? I can play the video 2 or 3 times but eventually the buffer will empty, at which point the buffering screen shows. (Because I want to show this when the vid needs to buffer) //for loading video protected function loadVideo():void { _sVideoHolder.alpha = 0; _videoLoader = new VideoLoader(_videoUrl, {name:"theVideo", container:_sVideoHolder, width:960, height:540, autoPlay:false, volume:1, bufferMode:true, bufferTime: 20, smoothing:true, requireWithRoot: this.root, onError: videoErrorHandler, onFail: videoFailHandler, onProgress:videoProgressHandler, onComplete:videoCompleteHandler, onHTTPStatus:videoHTTPStatus} ); _videoLoader.addEventListener(VideoLoader.VIDEO_CUE_POINT, videoCuePointHandler); _videoLoader.addEventListener(NetStatusEvent.NET_STATUS, videoNetStatusHandler); _videoLoader.load(); } //for responding to events protected function videoNetStatusHandler (event:LoaderEvent):void { MonsterDebugger.trace(this, 'ChristmasCampaignVideo.videoNetStatusHandler event: ' + event); MonsterDebugger.trace(this, 'ChristmasCampaignVideo.videoNetStatusHandler: ' + event.data.code); switch (event.data.code) { case "NetStream.Play.Start" : break; case "NetStream.Buffer.Empty" : trace('videoNetStatusHandler, VIDEO_BUFFER_EMPTY _currentAnimation: ' + _currentAnimation); _bufferButtonTimeline.play(); _sBufferScreen.visible = true; MonsterDebugger.trace(this, 'videoNetStatusHandler, VIDEO_BUFFER_EMPTY'); break; case "NetStream.Play.Stop" : break; case "NetStream.Buffer.Full" : _bufferButtonTimeline.stop(); _sBufferScreen.visible = false; trace('videoNetStatusHandler, VIDEO_BUFFER_FULL'); MonsterDebugger.trace(this, 'videoNetStatusHandler, VIDEO_BUFFER_FULL'); break; case "NetStream.Buffer.Flush" : break; case "NetStream.Seek.InvalidTime" : break; }
  4. Ya that's what I meant. As in the best way to preload the vid & main.swf in the preloader.swf but have the video play from within the main.swf. Could also target a movieclip in the main.swf by using the container param in vidloader. thanks!
  5. Cross Post! Now I'm curious as to how to solve the other part of his question. How to carry the tween through where the mouse clicked...(extend the line from the origination point through the x/y) I cant quite pull the math out of this: http://www.flashandmath.com/intermediat ... index.html
  6. import flash.display.MovieClip; import com.greensock.*; import com.greensock.easing.*; //declares variables var mousePositionX:Number = 0; var mousePositionY:Number = 0; //adds the event listener stage.addEventListener(MouseEvent.CLICK, onClickHandler, false, 0, true); //assigns variables and moves the object function onClickHandler(event:MouseEvent):void { mousePositionX = event.target.mouseX; mousePositionY = event.target.mouseY; var mc:MovieClip = createBullet(); TweenMax.to(mc, .5, {x:mousePositionX, y:mousePositionY}); } function createBullet():MovieClip { var bullet:Bullet = new Bullet(); // define bullet start point and speed //bullet.speed = 3; bullet.x = 275; //based on a stage width of 550, having it start in middle bullet.y = 400; addChild(bullet); return bullet; } I swapped the capitalization of Bullet compared to your code but this should work. As far as having it carry through the point where you click, that may need to involve some trig and I am too far out of school to remember how to do that... ?
  7. I actually dont mind it in that I 'know' when the main.swf has finished loading and when loading the video has started. Except I am finding out in an odd way. Since preloader.swf is using loadermax to only load in main.swf, I 'discover' when main.swf has loaded when a netstatus event of the video fires "NetStream.Play.Start" ... It may be handy to have the preloader load the main.swf and the video but the video needs to play 'within' main.swf and I wasnt sure how to hand off the video loader to main.swf... Any ideas for that?
  8. jguthrie

    Rotation

    you will want to set the ease to: ease:Linear.easeNone as this will make sure that it rotates smoothly...
  9. How would you use MP3Loader for sounds that are in your library anyway? (Not publishing to iphone/android etc...)
  10. The reason I see the progress bar go up twice is: PreloaderSwf (using LoaderMax) loads in MainSwf which in turn loads a video (using LoaderMax). I had requireWithRoot set to true for the video. So what I was seeing was the loadermax class in the preloader swf, loading the Main swf, and then the video.
  11. Yes. Is it possible to have it set for 20 seconds initially and then only need 5 sec of video to buffer past that? And I should just be showing/hiding the buffering icon in the bufferfull/bufferempty events?
  12. Sorry I should have wrote: But the video would resume playing before the buffer became full correct? I have the initial buffering amount set at 20 secs so would that mean it would wait to buffer another 20 secs before playing? I just want to know when to show/hide my 'buffering animation'. Thanks!
  13. It seems that when my preloader loads the main swf, it loads it twice. The textfield that is used to report the progress starts at a random percentage, then goes up to 99, then resets to 0 and goes back up... Any ideas on why this would occur? I was wondering if the initial call that LoaderMax makes to determine the size would cause this... package { import com.greensock.TimelineLite; import com.greensock.TweenLite; import com.greensock.easing.*; import com.greensock.events.LoaderEvent; import com.greensock.loading.SWFLoader; import flash.display.DisplayObjectContainer; import flash.display.Loader; import flash.display.MovieClip; import flash.display.SimpleButton; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.Event; import flash.events.MouseEvent; import flash.events.ProgressEvent; import flash.events.SecurityErrorEvent; import flash.events.StatusEvent; import flash.media.Sound; import flash.net.URLRequest; import flash.system.Security; import flash.text.TextField; import flash.utils.getTimer; import flash.external.ExternalInterface; public class ChristmasPreLoader extends MovieClip { //public var _queue:LoaderMax; private var _swfLoader:SWFLoader; //public var _sSponsorButton:SimpleButton; public var _sSponsorText:TextField; public var _sLoading_txt:TextField; public var _sPattern_mc:MovieClip; public var _sStitches:MovieClip; public var _sDrop_mc:MovieClip; public var _sBrownBucket:MovieClip; public var _sMaskBucket:MovieClip; private var _preLoaderTL:TimelineLite = new TimelineLite(); private var _bucketTL:TimelineLite = new TimelineLite(); public function ChristmasPreLoader():void { addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true); //init(); } private function init(e:Event):void { stage.showDefaultContextMenu = false; stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; //, estimatedBytes:900200 _swfLoader = new SWFLoader( "ChristmasCampaignVideo.swf", {container:this, alpha:0, onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler}); _preLoaderTL.append(TweenLite.to(_sDrop_mc, 1, {y: 370, ease:Expo.easeIn})); _preLoaderTL.append(TweenLite.to(_sDrop_mc, .01, {y: -70, onComplete:dropWater })); _bucketTL.append(TweenLite.to(_sPattern_mc, 1, {rotation: 15})); _bucketTL.append(TweenLite.to(_sPattern_mc, 1, {rotation: -15})); _bucketTL.append(TweenLite.to(_sPattern_mc, .5, {rotation: 0, onComplete:rotateBucket})); _swfLoader.load(); //_sSponsorButton.addEventListener(MouseEvent.CLICK, sponsorClick, false, 0, true); removeEventListener(Event.ADDED_TO_STAGE, init); } private function rotateBucket():void { _bucketTL.restart(); } private function dropWater():void { _preLoaderTL.restart(); } protected function errorHandler(event:Event):void { trace("ChristmasPreLoader SWFLoader.errorHandler"); } private function progressHandler(e:LoaderEvent):void { var perc:Number = e.target.progress; //trace("progress: " + e.target.progress); _sLoading_txt.text = 'Loading ' + Math.ceil(perc*100).toString() + '%'; _sPattern_mc.y = 466 - (80 * perc); } private function completeHandler(event:LoaderEvent):void { _preLoaderTL.stop(); _sLoading_txt.text = "Loaded!"; //TweenLite.to(_sSponsorButton, 1,{alpha:0}); TweenLite.to(_sSponsorText, 1,{alpha:0}); TweenLite.to(_sPattern_mc, 1,{alpha:0}); TweenLite.to(_sStitches, 1,{alpha:0}); TweenLite.to(_sDrop_mc, 1,{alpha:0}); TweenLite.to(_sLoading_txt, 1,{alpha:0}); TweenLite.to(_sBrownBucket, 1,{alpha:0, onComplete: cleanUp}); } /* protected function sponsorClick(event:MouseEvent):void { try { ExternalInterface.call("OpenSponWindow","_preloader"); } catch (e:Error) { trace('ChristmasPreLoader.sponsorClick error ' + e); } } */ private function cleanUp():void { //Cleanup //removeChild(_sSponsorButton); //_sSponsorButton = null; removeChild(_sSponsorText); _sSponsorText = null; removeChild(_sPattern_mc); _sPattern_mc = null; removeChild(_sStitches); _sStitches = null; removeChild(_sDrop_mc); _sDrop_mc = null; removeChild(_sLoading_txt); _sLoading_txt = null; removeChild(_sMaskBucket); _sMaskBucket = null; removeChild(_sBrownBucket); _sBrownBucket = null; //Fade in main swf TweenLite.to(_swfLoader.content, 1, {alpha:1, onComplete: callOnComplete}); } private function callOnComplete():void { //_swfLoader.rawContent.animatePlayButtonIn(null); try { ExternalInterface.call("removeSponsorButton"); } catch (e:Error) { trace('ChristmasPreLoader.sponsorClick error ' + e); } } private function onLocalConnectionStatus(event:StatusEvent):void { switch (event.level) { case "status": trace("SiteLoadingTimeTracking - LocalConnection.send() succeeded"); break; case "error": trace("SiteLoadingTimeTracking - LocalConnection.send() failed"); break; } } } }
  14. Yes it does. But the video would resume playing before the VideoLoader becames empty correct? As far as testing this goes, would it be best to use Charles to simulate a slow connection speed?
  15. What events do I need to monitor to show/hide a buffer icon if I am playing a progressively loading video (flv) and the playhead gets to the loaded part? Thanks!
  16. I resolved this but figured I would post my hypothesis in case it helps someone.
  17. Yes it should be the latest as I have downloaded the swc from you (in the my account section) just a few days ago. The buffer trace says its full when i start to play. (vid loads instantly as i am running locally)... I think it had something to do with calling the CasaMovieClip.destroy() method. The code below is a bit old. What I did was move the playVideo() to be the last thing in the playPauseHandler() and I have not had the problem since... Here's my code: private var _videoLoader:VideoLoader; private function init ():void { loadVideo(); _sVideoHolder.alpha = 0; _sPlayButton.addEventListener (MouseEvent.CLICK, playPauseHandler); _sPlayButton.buttonMode = true; } protected function loadVideo():void { _videoLoader = new VideoLoader("../video/myvid.f4v", {name:"theVideo", container:_sVideoHolder, width:960, height:540, autoPlay:false, volume:1, bufferTime: 10, smoothing:true, requireWithRoot:this.root, onError: videoErrorHandler, onFail: videoFailHandler, onProgress:videoProgressHandler, onComplete:videoCompleteHandler, onHTTPStatus:videoHTTPStatus} ); _videoLoader.addEventListener(VideoLoader.VIDEO_CUE_POINT, videoCuePointHandler); _videoLoader.addEventListener(NetStatusEvent.NET_STATUS, videoNetStatusHandler); _videoLoader.load(); } protected function playPauseHandler (event:MouseEvent):void { //trace('playPauseHandler'); if(_firstClick) { onFirstClick(); _videoLoader.playVideo(); } else { _videoLoader.videoPaused = !_videoLoader.videoPaused; } animatePlayButtonOut(); clearAnimations(); } protected function onFirstClick():void { //trace('onFirstClick'); _sVideoHolder.alpha = 1; _firstClick = false; removeChild(_sSponsorButton); removeChild(_sSplashScreen); } protected function clearAnimations():void { try { CasaMovieClip(_sAnimationHolder.getChildByName(_currentAnimation)).destroy(); //_sAnimationHolder.removeChild(_sAnimationHolder.getChildByName(_currentAnimation)); trace('clearAnimations: removed child'); } catch(e:Error) { trace('clearAnimations: no firstChildExists'); } }
  18. This seems to happen on and off. As in I will publish it, press play and it works fine. Other times I will publish it, press play and it wont play. I am using Flash CS 5.5, 11.5.1, publishing for Flash Player 10 and 10.1. I am listening for netstatus events but am not sure how to troubleshoot things. Any advice?
  19. I can see (using VideoLoaderVars) that there is an onHTTPStatus() function but not sure how to listen for the netstatus.
  20. The answer is to use TimeLineLite(Max) viewtopic.php?f=1&t=4774
  21. Ah ok. I was looking in the docs and there is this line: myTimeline.insertMultiple([new TweenLite(mc, 1, {y:"100"}), new TweenLite(mc2, 1, {x:120}), new TweenLite(mc3, 1, {alpha:0.5})], 0, TweenAlign.START, 0.2); http://www.greensock.com/as/docs/tween/ But i see now that each TweenLite is just tweening one movieclip... Probably cleaner to do it with the method I did above (well easier to read anyway) and it achieves what I want so I suppose it doesnt really matter Thanks!
  22. Thanks for those files. For some reason it isnt letting me use the array method to add to this tween. This works but would like to be able to do it with just one appendMultiple call... private var dancersTimeline:TimelineLite = new TimelineLite({paused:true}); dancersTimeline.insertMultiple(TweenMax.allTo(_peopleBig_arr, .2, { repeat: -1, yoyo:true, y:"-3" } )); dancersTimeline.insertMultiple(TweenMax.allTo(_peopleMed_arr, .2, { repeat: -1, yoyo:true, y:"-4" } )); dancersTimeline.insertMultiple(TweenMax.allTo(_peopleSma_arr, .2, { repeat: -1, yoyo:true, y:"-5" } )); dancersTimeline.insertMultiple(TweenMax.allTo(_peopleXsm_arr, .2, { repeat: -1, yoyo:true, y:"-5" } ));
×
×
  • Create New...