Jump to content

Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

jguthrie's Achievements


Newbie (1/14)



  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


    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; } } } }