Jump to content
GreenSock

speedfontain

Members
  • Posts

    4
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

speedfontain's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi Team, I am having trouble with memory leakage with the below code, after a few days the flash player runs out of memory and shows a white screen with a (!) in the middle. I have a total of 25 videos, one video is loaded at random every 30 minutes and then unloaded. 1. Can I reuse the same loader ?, or should I create a new instance new time. var currentVideoMD1:VideoLoader; function startHarm():void { sourceHM = mdm.Application.path + "extensions/harm_" + numberofharmVideosS + ".flv"; currentVideoMD1 = new VideoLoader(sourceHM,{name:"harmvideo1",container:harmTarget.Target_harm_In,x:60,y:626,width:960,height:530,scaleMode:"stretch",bgColor:0x000000,autoPlay:true}); currentVideoMD1.load(); TweenLite.to(currentVideoMD1, 1, {volume:harmminVolume}); currentVideoMD1.addEventListener(VideoLoader.VIDEO_COMPLETE,harmComplete); } function harmComplete(e:Event):void { currentVideoMD1.removeEventListener(VideoLoader.VIDEO_COMPLETE,harmComplete); currentVideoMD1.unload(); }
  2. That worked a treat, many thanks. Next question Within a timer, how can i move the content back to its top position after a period of time ? Cheers
  3. I have just wrapped the sample like this, and targerted the MC called licenceHolder function makeScroll(){ var mc1:Sprite = licenceHolder; var bounds:Rectangle = new Rectangle(0,230,510,1482); var blitMask:BlitMask = new BlitMask(mc1,bounds.x,bounds.y,bounds.width,bounds.height,false); var t1:uint,t2:uint,y1:Number,y2:Number,yOverlap:Number,yOffset:Number; blitMask.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); function mouseDownHandler(event:MouseEvent):void { TweenLite.killTweensOf(mc1); y1 = y2 = mc1.y; yOffset = this.mouseY - mc1.y; yOverlap = Math.max(0,mc1.height - bounds.height); t1 = t2 = getTimer(); mc1.stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); mc1.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } function mouseMoveHandler(event:MouseEvent):void { var y:Number = this.mouseY - yOffset; //if mc1's position exceeds the bounds, make it drag only half as far with each mouse movement (like iPhone/iPad behavior) if (y > bounds.top) { mc1.y = (y + bounds.top) * 0.5; } else if (y < bounds.top - yOverlap) { mc1.y = (y + bounds.top - yOverlap) * 0.5; } else { mc1.y = y; } blitMask.update(); var t:uint = getTimer(); //if the frame rate is too high, we won't be able to track the velocity as well, so only update the values 20 times per second if (t - t2 > 50) { y2 = y1; t2 = t1; y1 = mc1.y; t1 = t; } event.updateAfterEvent(); } function mouseUpHandler(event:MouseEvent):void { mc1.stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); mc1.stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); var time:Number = (getTimer() - t2) / 1000; var yVelocity:Number = (mc1.y - y2) / time; ThrowPropsPlugin.to(mc1, {throwProps:{y:{velocity:yVelocity, max:bounds.top, min:bounds.top - yOverlap, resistance:300}}, onUpdate:blitMask.update, ease:Strong.easeOut}, 10, 0.3, 1); } }
  4. Hi Team, Using the ThrowProps example, I need to place this into a function and call it when the MC has finsished loading its content. However when i call the ThrowProps function it does not work, gets stuck and will not scroll. How can i place this in a function to call when needed ? Cheers
×