Jump to content
GreenSock

alanpuccinelli

Members
  • Posts

    10
  • Joined

  • Last visited

Reputation

0 Newbie
  1. Scratch this. Not sure why I assumed that the scaleMode has to be set prior to load but this is apparently not the case. By doing the aspect check after the load is complete I can attain the result I need. Here's a code snippet for anyone trying to do the same thing: public function ssLoadComplete(evt:Event):void{ var cntnt:Array = LoaderMax.getContent(evt.target.name); for (var i:int = 0; i < cntnt.length; i++) { if (cntnt[i] is ContentDisplay) { if (cntnt[i].width > cntnt[i].height){ cntnt[i].scaleMode = "proportionalOutside"; cntnt[i].crop = true; }else{ cntnt[i].scaleMode = "proportionalInside"; } var content:ContentDisplay = cntnt[i]; cntnt[i].fitWidth = 1024; cntnt[i].fitHeight = 576; } } XML just looks like this: <?xml version="1.0" encoding="utf-8"?>
  2. I'm trying to get my slideshow to automatically set the scaleMode for an imageloaders content based on the aspect ratio of the image but it's proving difficult. For example if the image is a portrait I'd like it to scale proportionalInside and if it's landscape I'd like it to be proportionalOutside. Trouble is, I don't think the loader is aware of the image's dimensions until after the content has been loaded at which point the scaleMode needs to have already been set. Is this correct? If that's the case is it even possible to do what I'm trying to do?
  3. Yes that makes perfect sense thank you! I'd been trying to apply those properties to the loader and not the ContentDisplay. Also you taught me something new about identifying a class, believe it or not I never new about the "is" operator before. Duh. Way simpler that using "getQualifiedClassName" which is what I've been doing up until now. You learn something new every day. Thanks so much.
  4. Upon further examination it looks like the parse() method could do what I want if I parse the xml nodes to an array first, but if my array is mixed assets that will create different loaders how do I pass the appropriate childVars to each of the loaders. So in this example: LoaderMax.activate([imageLoader, SWFLoader, XMLLoader, MP3Loader]); var urls:Array = ["img/photo1.jpg","../../xml/data.xml","swf/main.swf","http://www.greensock.com/audio/music.mp3"]; //now parse all of the urls, creating a LoaderMax that contains the correct type of loaders (an ImageLoader, XMLLoader, SWFLoader, and MP3Loader respectively) var loader:LoaderMax = LoaderMax.parse(urls, {name:"mainQueue", onComplete:completeHandler}) as LoaderMax; //begin loading loader.load(); How do I set the appropriate children vars for each of the different loader types?
  5. So I'm loading a series of loaders using XML and I'm curious... Can I modify the loader vars after I parse the XML (create the loader objects) but before I call the load() method? for example: var ldr1 = LoaderMax.getLoader("ss1"); //do something here to add the onChildComplete method to ldr1 --- like getLoaderVars? and then edit it's properties? ldr1.load(); I realize I can just add it to the XML but I'd like to try to keep my XML minimal if possible and it seems highly repetitive to set all those common vars for each of the imageloaders. Is my only other option to just use plain xml with the filenames and then programmatically iterate through the nodes and build the loaders for each? I'm making a slideshow and pretty much everything has the same width, height, crop, and scaleMode properties but the XML file is way bigger than it needs to be if I have to repeatedly set the vars for each loader. There's got to be a better way.
  6. YES!!! You sir, are the man! Never before have I seen such a responsive community. Your fix works brilliantly. Thank you so much. If only Adobe put half as much effort into QAing their own product as you do. Kudos.
  7. Is there a filesize attachment limit? The zip I'm trying to post is 20mb and it doesn't seem to want to attach. Anyway here's a link to the file on my site: http://www.puccinellidigital.com/VideoLoad.zip
  8. Sure, here's my file, and yes I'm using the latest version of the classes just downloaded them today. I've been trying to figure this out all afternoon and I'm going crazy with it. I've tried a few different FLV's but to be fair I did pull them all down from youtube. Not sure if there's something funky about the way they were encoded or not. A few things for you to notice: If the video starts off playing and then you skip using the buttons everything works fine. If you try to jump to a specific time once the load completes however... not so good. I did notice that the time keeps ticking by in my trace output as if the video were still playing but the container goes blank. Using the skip button while it's in this weird "playing but not playing state" will update a still image in the container but will not play once it's frozen. Some other things I've noticed too (you can see this too but uncommenting the traces in the updatePlayProgress function) The netStream.currentFPS drops to 0 and the bufferLength starts to increase. What other events or tricks can I implement to better troubleshoot? I feel like I'm missing some key info about what's going on with the netstream. If anything it seems like the video container needs to be re-attached to the stream or something. Thanks for taking a look.
  9. Not sure if it makes a difference or not but I'm playing the vids off of my local drive so they should be essentially available instantly.
  10. First of all, thank you so much for all the time and effort you've put into this class! I'm trying to replicate the experience of changing channels on a television with my video player and I'm running into an odd quirk. First of all, it seems if I ever attempt to go to a time in my videos when the video isn't playing at that moment the container appears to loose sync with the loaded asset. I say "loose sync" because the PLAY_PROGRESS still indicates that the stream is moving forward but the container doesn't update and there is no sound. I've tried waiting to send the gotoVideoTime call until complete, init, and buffer full and all seem to have the same effect. The only way I can seem to get it work is to build in a delay timer so that the gotoVideoTime call doesn't happen until about 200ms after the video starts playing. Here's a code sample of what I'm talking about: import com.greensock.loading.*; import com.greensock.loading.display.*; import com.greensock.*; import com.greensock.events.LoaderEvent; //create a VideoLoader var video:VideoLoader = new VideoLoader("videos/csi.flv", {name:"CSI", bufferMode:false, container:vidbox, width:400, height:300, scaleMode:"proportionalInside", bgColor:0x000000, autoPlay:false, volume:0.75, requireWithRoot:this.root, estimatedBytes:21093459, onComplete:completeHandler}); video.addEventListener(VideoLoader.PLAY_PROGRESS, updatePlayProgress); //start loading video.load(); function completeHandler(event:LoaderEvent):void { trace("load complete"); video.gotoVideoTime(10,true); } function updatePlayProgress(event:LoaderEvent=null):void { var time:Number = video.videoTime; var minutes:String = force2Digits(int(time / 60)); var seconds:String = force2Digits(int(time % 60)); trace(minutes+":"+seconds); } function force2Digits(value:Number):String { return (value < 10) ? "0" + String(value) : String(value); } if you change the 10 to a 0 in the gotoVideoTime call you can see that it will play just fine. What am I missing here?
×