Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6050727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:43:15+00:00 2026-05-23T07:43:15+00:00

I wanted to know how I would make a whole symbol (an image) scrollable?

  • 0

I wanted to know how I would make a whole symbol (an image) scrollable? I have found out how to do the multi-touch pinch to zoom but I can’t find any code samples that will let me make the image scroll vertically only with one finger.

So all I want to do is make an image scroll up and down with a single finger input. Are there any simple methods or sample code anyone could give me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:43:16+00:00Added an answer on May 23, 2026 at 7:43 am

    There are two ways to make an image scrollable in an AS3 mobile project: using the Pan gesture (two fingers), or using mouse down, move, and up (one finger – touch events are registered as mouse events on mobile devices). The example below supports both.

    Note: With the mouse events, you may want to consider adding a timer to differentiate between clicks and drags (shown in example).

    // Necessary imports for this example - I use Flash Builder, so I'm not sure what CS5 requires.
    import flash.display.DisplayObject;
    import flash.events.MouseEvent;
    import flash.events.TransformGestureEvent;
    import flash.geom.Point;
    import flash.ui.Multitouch;
    import flash.ui.MultitouchInputMode;
    import flash.utils.getTimer;
    
    
    public class ScrollExample {
        // The image or other display object you want to scroll
        private var t:DisplayObject;
        // Dragging variables
        private var _prevX:Number; // Not required in this case since we're only scrolling vertically
        private var _prevY:Number;
        private var _dragging:Boolean = false;
        private var _lastMouseEvent:int;
        // Minimum touch time to permit drag (in milliseconds) - I use
        private static const MIN_DRAG_TIME:Number = 150;
    
    
    
        public function ScrollExample() {
            // Switch multitouch mode to support gestures (touch/mouse events are still registered)
            Multitouch.inputMode = MultitouchInputMode.GESTURE;
    
            // For my applications, I have found that the stage is much more responsive to touch events, but you may want to change "stage" here to "t"
            // Pan Gesture - two fingers up and down - like the scroll on a Mac
            stage.addEventListener(TransformGestureEvent.GESTURE_PAN, onPan);
            // Mouse down, move, and up - one finger drag
            stage.addEventListener(MouseEvent.MOUSE_DOWN, onStartDrag);
            stage.addEventListener(MouseEvent.MOUSE_MOVE, onMoveDrag);
            stage.addEventListener(MouseEvent.MOUSE_UP, onStopDrag);
        }
    
    
        private function onPan(e:TransformGestureEvent):void {
            // Move target display object by equivalent offset from pan object
            // For only vertical scrolling, don't use X!
            //t.x += e.offsetX;
            t.y += e.offsetY;
        }
    
    
        private function onStartDrag(e:MouseEvent):void {
            // Start timer to differentiate between click and drag
            _lastMouseEvent = getTimer();
    
            // Start dragging
            _dragging = true;
            // Set drag location values to track how drag is occuring
            // For only vertical scrolling, don't use X!
            //_prevX = e.stageX;
            _prevY = e.stageY;
         }
    
    
         private function onMoveDrag(e:MouseEvent):void {
             // If mouse down for less than minimum time, don't drag
             if (getTimer() > _lastMouseEvent + MIN_DRAG_TIME && _dragging) {
                 // Move target display object to a valid location - prevents scrolling too far
                 // Not using X...
                 // t.x = ValidXDragPosition(e);
                 t.y = ValidYDragPosition(e);
    
                 // Reset drag position values
                 _prevX = e.stageX;
                 _prevY = e.stageY;
             }
         }
    
    
         private function onStopDrag(e:MouseEvent):void {
             // Stop dragging
             _dragging = false;
    
             // If mouse down time was less than min time, count as click
             if (getTimer() <= _lastMouseEvent + MIN_DRAG_TIME) {
                 onClick(e);
             }
         }
    
    
         private function onClick(e:MouseEvent):void {
             // Handle your click event here...
         }
    
    
         // This function prevents your target display object from moving too far
         // In this example, it stops dragging when the display object boundary is reached
         // (Only showing Y direction)
         private function ValidYDragPosition(e:MouseEvent):Number {
             // Get the requested drag amount
             var requestedPoint:Number = _prevY - e.stageY;
    
             if (t.y - requestedPoint > 0) {
                 // If drag will move target too far down, stop at top of object
                 return 0;
             } else if (t.y - requestedPoint < stage.stageHeight - t.height) {
                 // If drag will move target too far up, stop at bottom of object
                 return stage.stageHeight - t.height;
             } else {
                 // Otherwise, allow drag by requested amount
                 return t.y - requestedPoint;
             }
         }
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted to know how PHP would execute this. Order of operations addslashes(strip_tags($record['value'])); Is
Just wanted to know if overriding UITabBarController would get my app rejected? Is it
Just wanted to know if it is possible to disallow the whole site for
I wanted to know how to make it possible that if there is no
so i wanted to make a progress bar or percent using urllib2. i found
I would like to make the whole webpage, index.html for example to act as
Suppose I have the URL for large animated gif and I wanted to make
I wanted know how the kernel is providing memory for simple C program .
Wanted to know if someone had a suggestion on code or maybe there's a
I wanted to know, while deciding which language or technology to use for implementing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.