Jump to content
Search Community

TheYellowGuy

Members
  • Posts

    3
  • Joined

  • Last visited

TheYellowGuy's Achievements

1

Reputation

  1. Wow, thanks. This works like charm, really great support for you guys. Thank you again
  2. hey, thanks for fast response Actually I want to load an external SWF into a MovieClip on stage and add fade-in, fade-out effect every time user click other button to load another external SWF. Here are the steps: 1. User click button to load external SWF 2. After external SWF loaded & added to 'container' MovieClip, run Fade-In effect. 3. User click other button to load other external SWF 4. Fade-Out 'container' MovieClip. 5. Remove all children inside 'container' MovieClip. 6. Load new external SWF and redo to step 2. That's why I can't use delayedCall(), because it is depend on user interaction & asset load time. Here I attach the files, just in case Thanks greensock. swf_loader.fla.zip 01,02,03,04.zip
  3. Hey, I know this tweening engine is the best. But, until yesterday i found something weird, the onComplete event does not fire. here is my code: import flash.events.MouseEvent; import flash.display.Loader; import flash.events.Event; import flash.net.URLRequest; import flash.display.MovieClip; import flash.display.StageScaleMode; import flash.display.StageAlign; import com.greensock.TweenMax; stop(); stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; var basePath:String = "projects/"; var projectName:String = "Mandiri/"; var theSWF:String = ""; banners.banner1.addEventListener(MouseEvent.CLICK, onClick); banners.banner2.addEventListener(MouseEvent.CLICK, onClick); banners.banner3.addEventListener(MouseEvent.CLICK, onClick); banners.banner4.addEventListener(MouseEvent.CLICK, onClick); function onClick(me:MouseEvent):void{ //trace(sub_container.numChildren); if(sub_container.numChildren > 0){ TweenMax.to(sub_container.getChildAt(0), 1, {alpha:0, onComplete:clearChildren, onCompleteParams:["Yayy"]}); } switch(me.currentTarget.name){ case "banner1": theSWF = "01.swf"; break; case "banner2": theSWF = "02.swf"; break; case "banner3": theSWF = "03.swf"; break; case "banner4": theSWF = "04.swf"; break; } var swfLoader:Loader = new Loader(); swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadSubComplete); swfLoader.load(new URLRequest(basePath + projectName + theSWF)); } function clearChildren(param):void{ trace(param); TweenMax.killTweensOf(sub_container); sub_container.removeAllChildren(); trace(sub_container.numChildren); } function onLoadSubComplete(ev:Event):void{ var theLoaded:MovieClip = MovieClip(ev.target.content); theLoaded.x = -theLoaded.width/2; theLoaded.y = -theLoaded.height/2; sub_container.addChild(theLoaded); TweenMax.to(theLoaded, 1, {alpha:1}); } stage.addEventListener (Event.RESIZE, resizeListener); function resizeListener(ev:Event):void{ sub_container.x = stage.stageWidth/2; sub_container.y = stage.stageHeight/2; banners.x = stage.stageWidth/2 - banners.width/2; } DisplayObject.prototype.removeAllChildren = function(){ for(var j = this.numChildren-1; j >= 0; j--){ this.removeChildAt(j); } } If you see that onComplete:clearChildren, onCompleteParams:["Yayy"] inside onClick function, it does not fire. But when I try onStart event, it fired perfectly normal. Please help, thanks before. And sorry, for my bad english.
×
×
  • Create New...