Jump to content
Search Community

jtvalles last won the day on June 5 2012

jtvalles had the most liked content!

jtvalles

Members
  • Posts

    17
  • Joined

  • Last visited

  • Days Won

    1

jtvalles last won the day on June 5 2012

jtvalles had the most liked content!

jtvalles's Achievements

3

Reputation

  1. Hey guys. This is my first foray into TimelineMax. I'm trying to build an app that will take the same timeline and repopulate with another clip before it plays again. So far, the only way I've been able to make it work throws errors. Any advice? var elements:Array = new Array(mc0,mc1,mc2) var counter:Number = 0; var tl:TimelineMax = new TimelineMax({paused:true, repeat:0});; var mc = elements[counter]; function stopIt():void { tl.pause(); } stage.addEventListener(MouseEvent.CLICK, resume) function resume(e):void { tl.resume(); tl.to(mc, 1, {x:100, onComplete:stopIt}); tl.to(mc, 1, {x:300, onComplete:stopIt}); tl.to(mc, 1, {y:250, onComplete:stopIt}); counter = counter+1; mc = elements[counter] }
  2. I have created an application that passes a url that may be a swf, image or flv. The content will be loaded into the same container. I'm able to load the respective formats, but it creates a new Loader each time. Is there a way to create one Loader for each format and update the container with its respective formats while removing the previously loaded content? For example: I load a jpg into "mc_container" then remove that jpg and load a swf into "mc_container" What I tried doesn't work: public function DisplayVisual() { LoaderMax.activate([ImageLoader, SWFLoader, VideoLoader]); } function loadVisual(visualUrl:String):void { var visualLoader:LoaderCore = LoaderMax.parse(visualUrl, {name:"parsedLoader", container:mc_container}); visualLoader.load(); }
  3. When I run my application from a cd/dvd, the progress bar doesn't work. Do I need to do something differently when running from a disk? loader = new SWFLoader(url, {name:"main", estimatedBytes:3000, container:this, autoPlay:false, onProgress:imageProgressHandler, onComplete:completeHandler}); loader.load(); function imageProgressHandler(event:LoaderEvent):void { TweenLite.to(mc_progress, .1, {alpha:1}); mc_progress.progressBar_mc.bar_mc.scaleX = event.target.progress; }
  4. Thanks, Jack. I implemented your code plus cleared some containers and it seemed to fix it. I'm pretty sure it wasn't the VideoLoader.
  5. Thanks Jack. Here is the code that loads and updates the SWF. Where do I call the dispose() or unload() method to assure gc happens? Also, could this be written as a SWFLoader without a queue? It actually only loads one SWF until the next SWF url is called. I was not able to get it to work with SWFLoader alone. var container:MovieClip = new MovieClip(); var queue:LoaderMax = new LoaderMax({name:"mainQueue", onChildProgress:imageProgressHandler, onComplete:completeHandler}); var mainSWF:ContentDisplay; function loadSWF(url:String):void { queue.append( new SWFLoader(url, {name:"main", estimatedBytes:3000, container:this, autoPlay:false}) ); queue.load(); } function updateSWF(url:String):void { LoaderMax.getLoader("main").url = url; queue.load(); } function imageProgressHandler(event:LoaderEvent):void { TweenLite.to(mc_progress, .1, {alpha:1}); mc_progress.progressBar_mc.bar_mc.scaleX = event.target.progress; } function completeHandler(event:LoaderEvent):void { aSlider.addEventListener(SliderEvent.CHANGE, scrubber); stage.addEventListener(Event.ENTER_FRAME, trackFrame); mainSWF = LoaderMax.getContent("main"); addChildAt(mainSWF, 0); container = LoaderMax.getLoader("main").rawContent; }
  6. I have an application that uses LoaderMax to load a swf (swf1) with audio. Basically each swf is a chapter in a multi-chapter presentation. When I advance to a chapter (swf2) then return to the previous chapter (swf1) the audio becomes distorted and begins to pop. Is it possible that the previous swf has not been trashed completely?
  7. Thanks Carl. Works like a charm. I love Greensock.
  8. I am trying to create a timeline that is populated with content from an xml source. My questions are: How do I fade out the previous mc for the next mc? How do I restart the whole she-bang after the mcs have been populated? How do I reset the timeline when the xml file is updated? function loadTaglines():void { for ( var i:uint = 0; i < xml.length(); i++ ){ var tagline = new mc; tagline.txt_tagline.text = xml.tagline[i] tagline.x = 816; tagline.y = 47; tagline.scaleX = 4; tagline.scaleY = 4; tagline.alpha = 0; addChild(tagline).name = tagline + i; timeline.append( new TweenLite (tagline, .5, {scaleX:1, scaleY:1, alpha:1) ); } }
  9. I have some code that scrolls a movieClip. The problem is I cannot get the onComplete to fire and remove the listener. It will fire when the clip reaches its bounds but not any time in between. Does my code prevent the tween from completing? import com.greensock.*; import flash.display.MovieClip; var mc:Sprite = new Sprite(); mc.graphics.beginGradientFill(GradientType.LINEAR, [0x666666,0xfff000],[0.9,0.1],[0,255], new Matrix(0,-1,1,0,height,0)); mc.graphics.drawRect(225, 50, 100, 300) addChild(mc); var destination:Point=new Point(); var dragging:Boolean=false; var speed:Number=20; var offset:Point=new Point(); var topLimit:Number = 0 - ( mc.height - (stage.height-50) ); var bottomLimit:Number = 120; mc.addEventListener(MouseEvent.MOUSE_DOWN,startdrag, false, 0, true); stage.addEventListener(MouseEvent.MOUSE_UP,stopdrag, false, 0, true); function startdrag(e:MouseEvent):void{ offset.y=mc.mouseY*mc.scaleY; dragging=true; mc.addEventListener(Event.ENTER_FRAME,followmouse, false, 0, true); } function stopdrag(e:MouseEvent):void{ dragging=false; } function followmouse(e:Event):void{ if(dragging){ destination.y=mouseY; } TweenLite.to(mc, 2, {y:mc.y-=(mc.y-(destination.y-offset.y))/speed, onComplete:removeEFListener}); if(mc.y > bottomLimit){ mc.removeEventListener(Event.ENTER_FRAME,followmouse); TweenLite.to(mc, .6, {y:bottomLimit}); trace('removedBottom'); } if(mc.y<topLimit){ TweenLite.to(mc, .6, {y:topLimit}); mc.removeEventListener(Event.ENTER_FRAME,followmouse); trace('removedTop'); } } function removeEFListener():void{ mc.removeEventListener(Event.ENTER_FRAME,followmouse); trace('removedEL'); } Note: This code is repurposed. I lost the source for the original code and gladly give credit where its due - so if its yours, thanks and good job.
  10. Works perfectly. Thanks again, Carl.
  11. Here's an easy one: How do I update the url that a conditional statement determines? What I have so far does not work: var video:VideoLoader = new VideoLoader('', {name:"weatherVideo", container:mc_video, width:756, height:672, scaleMode:"proportionalInside", bgColor:0x000000, autoPlay:false, volume:0, estimatedBytes:75000}); if( condition == "Cloudy.png" ){ getVideos( 'video' ); } function getVideos( url:String ):void { video.getLoader( 'weatherVideo' ).url = url; video.load(); video.playVideo(); }
  12. Thanks, Carl. The code works well. Here's how I coded my project: var mainImage:ImageLoader = new ImageLoader("", {container:Object(root).mc_newsStage.mc_newsPhoto, width:465, height:580, scaleMode: 'proportionalOutside', alpha: 0, crop:"true", estimatedBytes:60000, onComplete:imageCompleteHandler}); //Buttons are nested in the mc: Object(root).mc_news_heds.addEventListener(MouseEvent.MOUSE_DOWN, newsMenuHandler); function newsMenuHandler(event:MouseEvent):void { if (event.target.name == "mc_newsItem1"){ LoaderMax.getLoader("mainPhoto").url = "image1" } if (event.target.name == "mc_newsItem2"){ LoaderMax.getLoader("mainPhoto").url = image2; } The only snag is that the onComplete doesn't fire after the first click, so my alpha tween is not applied.
  13. Here's another one. I am designing an application where I load different images into the same Movie Clip. The code works fine, but I don't know how to unload without errors (a child is added the Movie Clip for every click). For that matter, I don't know if this is the best solution. Any advice? Object(root).mc_news_heds.addEventListener(MouseEvent.MOUSE_DOWN, newsMenuHandler); function newsMenuHandler(event:MouseEvent):void { if (event.target.name == "mc_newsItem1"){ var mainImage:ImageLoader = new ImageLoader("http://ts-ses-2/lv/images/" + newsInfo.News[0].img_preview[0], {container:Object(root).mc_newsStage.mc_newsPhoto, width:465, height:580, scaleMode: 'proportionalOutside', alpha: 0, crop:"true", estimatedBytes:60000, onComplete:imageCompleteHandler}); mainImage.load(); } if (event.target.name == "mc_newsItem2"){ var mainImage:ImageLoader = new ImageLoader("http://ts-ses-2/lv/images/" + newsInfo.News[1].img_preview[0], {container:Object(root).mc_newsStage.mc_newsPhoto, width:465, height:580, scaleMode: 'proportionalOutside', alpha: 0, crop:"true", estimatedBytes:60000, onComplete:imageCompleteHandler}); mainImage.load(); } }
×
×
  • Create New...