Jump to content
Search Community

Dcoo

Members
  • Posts

    86
  • Joined

  • Last visited

Everything posted by Dcoo

  1. This is a continuation of an older question I had, based on easy infinite scroll part 2 on snorkl.tv Im trying add my own files with an xml loader and play them back at a high rate giving the pictures an animated look. but so far it will only scroll one picture then resets, any Ideas on what I'm doing wrong would be Would be greatly appreciated import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; import com.greensock.loading.display.*; import com.greensock.plugins.*; import com.greensock.easing.*; import com.greensock.TweenMax; import com.greensock.data.TweenMaxVars; import flash.display.Sprite; import flash.display.MovieClip; import flash.display.Loader; import flash.display.MovieClip; import flash.events.MouseEvent; import flash.net.URLRequest; import flash.events.*; import flash.display.LoaderInfo; import flash.net.URLLoader; import flash.net.URLRequest; LoaderMax.activate([ImageLoader]); //LoaderMax that will be based upon loaders in the xml var galleryLoader:LoaderMax; var queue:XMLLoader = new XMLLoader("http://www.dwcstuff.com/mynameis2_myfile.xml",{name:"xmlDoc", maxConnections:2, estimatedBytes:5000, onComplete:xmlCompleteHandler1 }); queue.load(); function xmlCompleteHandler1(event:LoaderEvent):void { buildLoaderMax1(); } function buildLoaderMax1() { galleryLoader = LoaderMax.getLoader("gallery"); galleryLoader.addEventListener(LoaderEvent.COMPLETE, onGalleryLoaded ); galleryLoader.maxConnections = 24; galleryLoader.addEventListener(LoaderEvent.CHILD_COMPLETE, imageCompleteHandler); galleryLoader.load(); } function imageCompleteHandler(event:LoaderEvent):void { var loadedImage:ContentDisplay = event.target.content as ContentDisplay; loadedImage.alpha = 0; { TweenLite.to(loadedImage, .25, {alpha:1}); }; galleryArr.push(loadedImage); } const PADDING_X:int = 0; const PADDING_Y:int = 0; var galleryArr:Array = []; var parent_mc:Sprite = new Sprite(); addChild(parent_mc); parent_mc.y = 112; parent_mc.x = 300; function onGalleryLoaded(e:Event):void { var imageX:int = 0; var imageY:int = 0; for each (var image:Sprite in galleryArr) { var my_mc:MovieClip = new MovieClip(); my_mc.addChild(image); var myWidth:Number = galleryArr.length * 400; parent_mc.addChild(my_mc); my_mc.width = 400; my_mc.height = 400; my_mc.x -= parent_mc.width; my_mc.y = imageY; imageX -= my_mc.width + PADDING_X; if ( (imageX+my_mc.width) > stage.stageWidth ) { imageX = parent_mc.width; imageY = 0; } } } trace(lastItemX); var startX:Number = parent_mc.x; var distanceToScroll:Number = mask_mc.width; var lastItemX:Number = parent_mc.width; function scrollIt() { TweenMax.to(parent_mc, .5, {x:String(distanceToScroll), onComplete:reset}); } function reset() { //move all clips over to the right for each (var my_mc in parent_mc) { my_mc.x += distanceToScroll; if (my_mc.x >= lastItemX) { //this clip is way too far over... send it back my_mc.x -= lastItemX; } } //shift the parent so it looks like nothing moved parent_mc.x = startX; //scroll it again after 1 second TweenLite.delayedCall(1, scrollIt); } btn.addEventListener(MouseEvent.CLICK, toggleMask); function toggleMask(e:Event = null):void { parent_mc.mask = (parent_mc.mask) ? null : mask_mc; } toggleMask(); TweenLite.delayedCall(0, scrollIt); test-fromdwcstuff.fla.zip
  2. Thanks Jack, So I'm trying to see if I could tween the Alpha of bookl so I could possiblytoggle it off and on. function bookon():void is called from inside shoeHorn.swf var parentMovie:MovieClip = this.parent.root as MovieClip; parentMovie.bookon(); I gave the code a try TweenLite.to(LoaderMax.getContent("book1"), 1, {x:0,y:0,autoAlpha:1}); doesn't seem to do the trick, bummer
  3. Trying to tween a swf loader var queue:LoaderMax = new LoaderMax({name:"mainQueue",onProgress:progressHandler,oncomplete:completeHandler,onError:errorHandler,maxConnections:5}); queue.append( new SWFLoader("shoeHorn.swf", {name:"start", estimatedBytes:1363148.8, container:this, autoPlay:true,visible:false,onComplete:completeHandler}) ); queue.append( new SWFLoader("yourvids.swf", {name:"yv", estimatedBytes:1080, container:this, autoPlay:false,visible:false}) ); queue.append( new SWFLoader("book_Luanch.swf", {name:"bookl", estimatedBytes:10670, container:this, autoPlay:false,visible:false,x:0,y:0,width:1000,height:600}) ); LoaderMax.prioritize("shoeHorn.swf"); queue.load(); function progressHandler(event:LoaderEvent):void { trace("progress: " + event.target.progress); } function errorHandler(event:LoaderEvent):void { trace("error occured with " + event.target + ": " + event.text); } function completeHandler(event:LoaderEvent):void { TweenLite.from(event.target.content, 0, {x:0,y:0,autoAlpha:1}) setChildIndex(Object(root).spauseBtn,numChildren - 1); TweenLite.to(splayBtn, 1, {autoAlpha:1 }); TweenLite.to(Object(root).fullScreenBtn, 2, {autoAlpha:1}) trace("it worked!"); } function bookon():void { TweenLite.to(bookl.content, 1, {autoAlpha:1}); }
  4. Cool! what I've been tying to do is modify Easy Infinite Scroll Part 2 and add images using LoaderMax xml loader and the idea is that you can add pics to the folder and reload and bingo, but no matter what I do I get a 0 when trace, parent_mc.length I made a variable var myWidth:Number = galleryArr.length * 400; (400 is the with of each mc) and can trace that but tying to and set parent_mc to = myWidth i still get a 0
  5. yes this works well! thank you! what Im trying to do it calculate the width of the parent mc after I pushed the my images into it. and I'm loading from dynamic folder so the number of images changes I used trace(galleryArr.length ); it gives me a number of images loaded and each image is 400px wide so now I will try and figure out how to do math in flash parent_mc.width = galleryArr.length * 400 ( i know thats not correct but thats the idea)
  6. I need the number of images loaded so I can calculate the length of the parent imageholder holder the will be pushed to. I have tried all kinds of ways of tracing. trace(event.target.content as XML ) race((event.target.content as XML).data.LoaderMax.ImageLoader.length()) trace((event.target.content as XML).data.LoaderMax.children().length()) his gave me a series of "null"s, but they do match the correct number of images loaded. how can I get a number ? and can I pass that number ? function imageCompleteHandler(event:LoaderEvent):void { var loadedImage:ContentDisplay = event.target.content as ContentDisplay; loadedImage.alpha = 0; trace(event.target.content as XML ) { TweenLite.to(loadedImage, 5, {alpha:1}); }; galleryArr.push(loadedImage); }
  7. Yes I can get it to load the first time. so not one examples shows how use the reload button, as that is the function I can't seem to get to work.
  8. Thank you Carl, Is there possible an example of that code being implemented out there some where ?
  9. "Once the xml gets updated and re-loaded" Its the re-laoding of the xml that am not sure how to do.
  10. my gallery is loaded from an xml doc that is dynamically generated , when a user takes webcam picture the xml doc gets updated, I would like to add this new pic to the gallery. what would be the best way to do this?
×
×
  • Create New...