Jump to content
Search Community

Nickbee

Members
  • Posts

    68
  • Joined

  • Last visited

Posts posted by Nickbee

  1. I’m working on an externally configurable video player and based on LoaderMax’s VideoLoader.

     

    I’m currently working on the full screen feature of my player and noticed I can not set the width and height of an existing VideoLoader. I can scale a sprite that the video loader is sitting in but that does not take advantage of all the scaleMode options of VideoLoader.

     

    Is there another way to accomplish this?

    Here’s what I’d like to do:

     

    		private function onChangeToFullScreen():void
    	{
    //_videoPlayer is a VideoLoader
    		_videoPlayer.width = stage.stageWidth;
    		_videoPlayer.height = stage.stageHeight;
    	}
    

     

    THANKS!!!!!

  2. I saw a post on this issue and saw that the class was updated but I'm running into it also. Just to be sure I downloaded the latest version (VERSION: 1.781 of the core).

     

    Here's how I init the loader:

     

    private function loadFlv():void
    	{
    
    		_flvLoader = new VideoLoader(_flvPath, {name:"flvLoader", bgColor:0xFFFFFF, autoPlay:false, bufferMode:true, width:_flvWidth, height:_flvHeight, volume:1, onProgress:progressHandler, onComplete:flvBufferComplete});
    		_flvLoader.load();
    	}

     

    on Buffer Complete

     

    private function flvBufferComplete(evt:LoaderEvent):void
    	{
    _videoPlayer = LoaderMax.getLoader("flvLoader");
    		_videoPlayer.addEventListener(VideoLoader.VIDEO_COMPLETE, onVideoComplete);
    		//switch bufferMode to false so the loading progress will display correctly
    		_videoPlayer.bufferMode = false;
    
           	             //a bunch of other stuff
    
    				//seekerLoadProgress******************************************************
    				_seekerLoadProgress = new BarRect();
    				_seekerLoadProgress.x = _leftContentWidth;
    				_seekerLoadProgress.y = _flvHeight;
    				TweenLite.to(_seekerLoadProgress, 0, {tint:0x999999});
    				addChild(_seekerLoadProgress);
    				_isProgressReady = true;
    				//***********************************************************************
    
    
    	}

     

    and my progress function

     

    		private function progressHandler(evt:LoaderEvent):void
    	{
    		if(_isProgressReady)
    		{
    			if (_videoPlayer.status == LoaderStatus.COMPLETED) 
    			{
    				_seekerLoadProgress.width = _seekerWidth;
    			}
    			else
    			{
    				var pcent:Number = Math.ceil(evt.target.progress);
    				_seekerLoadProgress.width = _seekerWidth * pcent;
    			}
    		}
    	}

     

    Through on-Screen traces I can tell that the progressHandler is not firing after setting bufferMode = false. Am I doing something wrong?

     

    Thanks!

  3. I'm loading a video like so:

     

    		private function loadFlv():void
    	{
    		_flvLoader = new VideoLoader(_flvPath, {name:"flvLoader", bgColor:0xFFFFFF, autoPlay:false, bufferMode:true, width:_flvWidth, height:_flvHeight, volume:1, onComplete:flvBufferComplete});
    		_flvLoader.load();
    	}

     

    I would like to add an listener for when the metadata is received so I can grab the length of the video. I did not see anything in the greensock docs for this.

     

    Thanks!

  4. Let's say I have a maxConections of 2 on my main loader. Then because of a click I prioritize a specific image loader. Will all my bandwidth go to that prioritized loader? Or will I be sharing my bandwidth with one other asset?

     

    THANKS!!!!!

  5. OK, now that I've tested this at home I see there's a flaw to my logic.

     

    Even though a video might download in less than 6 seconds there is that initial period where the seconds left might be very high (until things get moving after the 1st bit of downloading).

     

    So what if i changed

    if(evt.target.progress != 0)

     

    to something like

    if(evt.target.progress > .10)

     

    then my script to switch to the slow speed profile wont start working until 10% of the file is downloading and things are moving.

     

    BTW, I am using estimatedBytes in these loaders.

     

    Thanks for any feedback!

  6. I'm working on a rotating video header. The idea is that videos will be the priority unless they take too long to download. If so that "profile" will be switched to a low speed profile that loads images instead.

     

    I have the logic working, but I want to be sure I'm checking the speed the best way possible.

     

    If a video is not loaded a loaderBar is displayed. At the same time the progress handler is checking the time left to download. If that time goes above a certain number (_maxVideoLoadTime) it kicks things over to a lowSpeed profile....

     

    private function videoLoadingBarProgressHandler(evt:LoaderEvent):void
    	{
    		var pcent:Number = Math.ceil((evt.target.progress)*100);
    		_preLoader.progress_mc.scaleX = pcent/100;
    		_preLoader.text_txt.text = pcent + "%";
    
    		//calculate time left
    		if(evt.target.progress != 0)
    		{
    			var SecondsLeft:uint = Math.ceil(((1 / evt.target.progress) - 1) * evt.target.loadTime);
    			var string:String = new String(SecondsLeft);
    			timeLeft.text = "secLeft: " + string;
    
    			if (SecondsLeft > _maxVideoLoadTime)
    			{
    				trace("*********** SWITCH TO LOW SPEED ****************");
    				_highSpeedLoader.pause();
    				initLowSpeedLoader();
    			}
    		}
    	}

     

    Suggestions would be great if this is not the best way to accomplish this.

     

    THANKS!

  7. Using windows and CS4...

     

    I did change the speed and I am hitting CTRL-ENTER to kick in the profil-er... I can tell from my trace statements that the images are simulating downloads, but when it gets to my FLVs it's as if each one was 1K and they all load instantly. The flash piece is working fine both locally and on a server.

     

    Strange huh?

  8. I tried clearing Explorer's cache but got the same results. I'm setting up a LoaderMax loader then loading 4 images, and then 4 videos. On the complete of each load I'm firing traces. When I test the images load in a realistic time, but then all 4 videos trace loaded instantly.

     

    Looks like I'll have to try one of those tools you mentioned.

     

    THANKS!!!!!

  9. I'm working on a video header that will cycle through 4 12 sec videos. The idea is if the connection speed is too slow to show alternate content (JPGs). Based on previous code I think I have it figured out. My issue will be testing... I think the normal bandwidth profiler in flash ignores FLVs and just shows them as loaded ASAP. Is there another tool out there for this that accurately works when loading external FLVs?

     

    Thanks!

  10. When in doubt use a conditional :)...

     

    One quick correction just in case someone is following this...

     

    if (loader.status == LoaderStatus.COMPLETE) {

     

    should be

     

    if (loader.status == LoaderStatus.COMPLETED) {

     

    This code now works EXACTLY as I imagined. Next I will add a loader status if the image needs to load.

     

    THANKS!!!!!!!!!!!!!!!!!

  11. I should have been more clear on what I'm going to accomplish in the application (game)...

     

    This is a slice an image up and slide the pieces back together game as seen in this prototype...

    http://www.nickbee.com/away3d16

     

    It will be important for the image to be be loaded before going over to my game class for slicing and dicing using the image's bitmapData.

     

    I'm planning to have 10-15 images for the final game. The thumbs load at hit the stage ASAP then all the main images preload while you play the 1st random image. If someone clicks a thumbnail immediately there is a chance the main image won't be preloaded as of yet. So the idea is to have that image prioritized and to detect when that particular image is complete so it can be sent over to the game class.

     

    So back to the code for my prioritize function. It now looks like this:

     

    		private function prioritizeLoader(indexToLoad:uint):void
    	{
    		myLoaderMax.getLoader(_mainLoaderNames[indexToLoad]).prioritize();
    		myLoaderMax.getLoader(_mainLoaderNames[indexToLoad]).addEventListener(LoaderEvent.COMPLETE, completeHandler);
    	}

     

    The completeHandler is not firing, however this is publishing fine.

     

    And being that I'm an AS3 novice I'm sure I'm making this more complicated than it needs to be :)

     

    Thanks again for all your help!!!!

  12. I know there must be an easy way of doing this.

     

    I’m pre-loading my main images like so…

    		private function loadMainImages():void
    	{
    		for(var i:int=0 ; i<_numThumbs ; ++i)
    		{
    			myLoaderMax.append(new ImageLoader(_myXML.images.mainURL[i], {name:"main" + i}));
    			_mainLoaderNames.push("main" + i);
    		}			
    	}

     

    On my thumbnail click I'm calling a prioritize function like so...

     

    		private function onThumbClick(evt:MouseEvent):void
    	{
    		//find which index of _buttons Array was clicked
    		for (var i:uint=0 ; i<_numThumbs ; i++)
    		{
    			if (_buttons[i].name == evt.target.parent.name)
    			{
    				break;
    			}
    		}
    		prioritizeLoader(i);
    	}

     

    The idea is to have the prioritizeLoader method prioritize the main image that is needed then use it as an argument in the newGame method.

     

    I came up with this:

     

    		private function prioritizeLoader(indexToLoad:uint):void
    	{
    		LoaderMax.getLoader(_mainLoaderNames[indexToLoad]).prioritize();
    
    		_game.newGame(LoaderMax.getLoader(_mainLoaderNames[indexToLoad]).rawContent, 1);
    
    	}

     

    Which obviously only works if the main image in question is loaded and ready to go. I'd like to add an "onComplete" to prioritized loader but not sure how to.

     

    Thanks!!!!

  13. that pointed me in the right direction...

     

    The constructor of my SliceBitmap class now looks like this...

     

    public function SliceBitmap(imageData:BitmapData, numRows:uint, numCols:uint)
    	{
    		//set vars to arguments
    		_imageData = imageData;
    		_numRows = numRows;
    		_numCols = numCols;
    		init();
    	}

     

    in my main class I have my loadermax stuff like this:

     

    		private function LoadImages():void
    	{
    	//<<---------------------- LOADER MAX ---------------------->>
    	var myLoaderMax:LoaderMax = new LoaderMax({name:"myLoader", maxConnections:2});
    
    	myLoaderMax.append(new ImageLoader("images/dart.jpg", {name:"dart"}));
    	myLoaderMax.append(new ImageLoader("images/strawberry.jpg", {name:"strawberry"}}));
    	myLoaderMax.append(new ImageLoader("images/bottle.jpg", {name:"bottle"}}));
    
    	//start loading
    	myLoaderMax.load();
    	}

     

    so lets say I want to pass my SliceBitmap class the bitmap data from "dart" how would I do this?

     

    I am keeping things simple for this example, I'll eventually add complete listeners and priority stuff.

     

    thanks!!!!

  14. I currently use a class to load and slice jpg images. I use arguments to pass the class a URL and the amount of slices horizontally and vertically. The class then loads the image and uses bitmapData to slice things up. So now that I'm using LoaderMax to preload stuff I would like to pass my class the info from a loaderMax object. What would be the best way to do this knowing that I eventually need to use bitmapData in my slice class?

     

    Thanks and happy Thanksgiving!

  15. And the hits just keep on coming!!!!

     

    loadForCompatibility="true" worked great in the simple example I sent you... But when we set that in my flex framework here's what happened....

     

    This is the line of code that the application fails on (I have custom classes and an interface): ISection(mainLoader.content).setAnimate(true);

     

    This is the error I'm getting: Main Thread (Suspended: TypeError: Error #1034: Type Coercion failed: cannot convert Splash@5d940f9 to com.splash.utils.ISection.)

    index/swfComplete

    index/__mainLoader_complete

    flash.events::EventDispatcher/dispatchEventFunction [no source]

    flash.events::EventDispatcher/dispatchEvent [no source]

    mx.core::UIComponent/dispatchEvent

    mx.controls::SWFLoader/http://www.adobe.com/2006/flex/mx/internal::contentLoaderInfo_completeEventHandler

     

    This happens after I set the motionblur property to true in the child SWF (which is not a Flex based SWF) and setting loadForCompatibility to true on Flex’s SWFLoader. When I take loadForCompatibility out of the code, the SWF loads fine (no errors), but the motionblur doesn’t work. The objects just appear one by one as if we were turning each object’s visibility on.

×
×
  • Create New...