Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

Search the Community

Showing results for tags 'blitmaskthrowsprops'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GreenSock Forums
    • GSAP
    • Banner Animation
    • Jobs & Freelance
  • Flash / ActionScript Archive
    • GSAP (Flash)
    • Loading (Flash)
    • TransformManager (Flash)

Product Groups

  • Club GreenSock
  • TransformManager

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. How do I get my mc to be active after I animate my blitmask? I am missing just one line of code somewhere i believe. My Content:MC I am bringing in works and has active buttons. They only stopped working when I added the Blitmask for faster scrolling. But how do I get it back after the update? Thanks package com { import flash.display.MovieClip; import flash.events.*; import flash.utils.getTimer; import flash.geom.Rectangle; import flash.display.Shape; // Greensock Annimation import com.greensock.*; import com.greensock.easing.*; import com.greensock.plugins.*; import com.greensock.plugins.TransformAroundCenterPlugin; TweenPlugin.activate([TransformAroundCenterPlugin]); TweenPlugin.activate([TransformAroundPointPlugin]); import com.greensock.plugins.CacheAsBitmapPlugin; TweenPlugin.activate([CacheAsBitmapPlugin]); TweenPlugin.activate([ThrowPropsPlugin]); public class scrollContent extends MovieClip { public var mc: MovieClip; public var bounds: Rectangle; public var MainStage: MovieClip; public var blitMask: BlitMask; public var t1: uint, t2: uint, y1: Number, y2: Number, yOverlap: Number, yOffset: Number; public function scrollContent(Content: MovieClip) { // constructor code addEventListener(Event.ADDED_TO_STAGE, init); mc = Content; } public function init(e: Event) { MainStage = this.parent as MovieClip; trace("scroll Stage: " + MainStage); bounds = new Rectangle(0, MainStage.MenuBar.height, Main_Activate._screenX, Main_Activate._screenY - MainStage.MenuBar.height); addChild(mc); blitMask = new BlitMask(mc, bounds.x, bounds.y, bounds.width, bounds.height, false); blitMask.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } public function mouseDownHandler(event: MouseEvent): void { TweenLite.killTweensOf(mc); y1 = y2 = mc.y; yOffset = this.mouseY - mc.y; yOverlap = Math.max(0, mc.height - bounds.height); t1 = t2 = getTimer(); mc.stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); mc.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } public function mouseMoveHandler(event: MouseEvent): void { var y: Number = this.mouseY - yOffset; //if mc's position exceeds the bounds, make it drag only half as far with each mouse movement (like iPhone/iPad behavior) if (y > bounds.top) { mc.y = (y + bounds.top) * 0.5; } else if (y < bounds.top - yOverlap) { mc.y = (y + bounds.top - yOverlap) * 0.5; } else { mc.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 = mc.y; t1 = t; } event.updateAfterEvent(); } public function mouseUpHandler(event: MouseEvent): void { mc.stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); mc.stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); var time: Number = (getTimer() - t2) / 1000; var yVelocity: Number = (mc.y - y2) / time; ThrowPropsPlugin.to(mc, { throwProps: { y: { velocity: yVelocity, max: bounds.top, min: bounds.top - yOverlap, resistance: 300 } }, onUpdate: blitMask.update, ease: Strong.easeOut }, 10, 0.3, 1); } } }
×