Jump to content

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

Throwsprops scrolling Blitmask from MC - Buttons not active

Recommended Posts

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;
import com.greensock.plugins.CacheAsBitmapPlugin;

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);


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 {
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;
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;

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);


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.