Jump to content

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

Native ios scroller with as3

Recommended Posts

Hi Everyone,


I’m writing due to a “Scroll function” I’m having difficulties in implementing for an APP.


I’ve developed an APP for ios and android in Flash professional cs6 with AIR 3.2 and everything works perfectly apart from the scroll function.

I’ve used the ThrowPropsPlugin and the movement works fine however it doesn’t allow me to select what I want to select in the container. Instead when I take off my finger it selects that element I’ve stopped on. In the ThrowPropsPlugin I’ve applied the mouse_down and mouse_up events to make the vertical movement, and inside the container I have MovieClips associated with events of touch_tap.

So when I take my finger off automatically the movieclip is activated. Does anyone have a solution to this problem? I feel like I’ve tried everything. Removed the event, added events, changed events, the pressure, resistence of the container, changed the properties of MouseChildren and nothing. If anyone has any advice on this problem I would be most grateful.

Link to comment
Share on other sites

Maybe try implementing some input blocking like this:


var allowPresses:Boolean = true;

function onMyScrollStart() {
 allowPresses = false;

function onMyScrollEnd() {
 allowPresses = true;
 // OR, if touchevents are being triggered after the mouseup
 TweenLite.delayedCall(0.01, function() { allowPresses = true; });
 // a tiny delayedCall gives the same effect as 'on next frame'

function onMyTouchEvent() {
 if (allowPresses) {
   // touch logic

  • Like 1
Link to comment
Share on other sites

Hi Jamie Jefferson


Thanks for your help. I tried it though, and it hasn’t worked. Do you know if there is anything else I can try? Below is the code as I have it right now:


var allowPresses:Boolean = true;


function mouseDownHandler(event:MouseEvent):void{

allowPresses = false;




container.startDrag(false, new Rectangle(bounds.x, -99999, 0, 99999999));

container.addEventListener(Event.ENTER_FRAME, enterFrameHandler);

container.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);


function enterFrameHandler(event:Event):void{






function mouseUpHandler(event:MouseEvent):void{

TweenLite.delayedCall(0.01, function() { allowPresses = true;


container.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);

container.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);


var time:Number=(getTimer()-t2)/1000;

var yVelocity:Number=(container.y-y2)/time;

var yOverlap:Number=Math.max(0,container.height-bounds.height);




noticia.addEventListener(TouchEvent.TOUCH_TAP, onNoticia);


function onNoticia(event:TouchEvent):void{

if (allowPresses) {

// the code to do what he have to do








Link to comment
Share on other sites

Sorry I haven't really dealt with touch events in flash before, but unless you have allowPresses within different scopes for your mouseUpHandler and onNoticia functions, I would expect allowPresses to be false in both of these functions:

function mouseUpHandler(event:MouseEvent):void{
 trace("mouseUpHandler: " + allowPresses); // false
 // your code here
function onNoticia(event:TouchEvent):void{
 trace("onNoticia: " + allowPresses); // false
 // your code here


If allowPresses is false in mouseUpHandler() and true in onNoticia(), then the TouchEvent is triggering later than expected. Try increasing the duration of the delayedCall and let us know if that affects anything e.g.

// use a frame based delay to skip an extra frame, just to be sure
// (surely touchEvents are accurate to a frame though right?)
TweenLite.delayedCall(2, function() { allowPresses = true; }, null, true); // delay for 2 frames

// OR

// just to be completely sure it isn't a timing issue, delay for a
// whole second. If allowPresses is true on your 'mouseup'
// onNoticia(), then I'm somewhat stumped...
TweenLite.delayedCall(1, function() { allowPresses = true; });

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.