Mouse click and drag through turntable animation

Hi all,
First - thanks for taking the time to look through and possibly helping me with this question.
I'm just getting to grips with flash cc actionscript 3.0 - so I apologise in advance to my not so technical jargon.
In the past I have used actionscript 1.0 to create an interactive html file that contains a turntable animation of a 3D model. Users can mouse click and drag to the left or right to 'spin' the model around - however what they are really doing is scrubing through the timeline which contained 360 images of it from 360 degrees. Similar ideas can be found here: Interactive Thyroidectomy
Now annoying I can't use the old code any more as I'm working in the latest flash cc actionscript 3.0
So how do I do the same thing but in actionscript 3.0?
So I've worked this bit out so far
On my main stage I have two layers - actions layer and another layer with my movie clip (movieclip_mc)
In the actions layer so far:
movieclip_mc.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
movieclip_mc.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
function onMouseDown(event:MouseEvent):void
  movieclip_mc.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
  //I should put something in here about mouseX  - but no idea what
function onMouseUp(event:MouseEvent):void
  movieclip_mc.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
function onMouseMove(event:MouseEvent):void
//I have to put something in about total frames - width of movieclip_mc etc but I'm not sure how   
// this is what someone else did on another forum - but I'm not sure what it means:
     var delta:int = backgroundClip.mouseX - clickedMouseX;
   var wantedFrame:uint = (clickedFrame + delta * clip.totalFrames / backgroundClip.width) % clip.totalFrames;
   while (wantedFrame < 1)
  wantedFrame += clip.totalFrames;
  clip.gotoAndStop(wantedFrame);
Also I think i need something in the beginning like.....:
import flash.events.MouseEvent;
import flash.display.MovieClip;
import flash.display.Sprite;
var clickedMouseX:int;
var clickedFrame:uint;
var backgroundClip:Sprite = getChildByName("background") as Sprite;
var clip:MovieClip = getChildByName("animation") as MovieClip;
clip.stop();
clip.mouseEnabled = false;
.....but I'm a bit confused about what all of it means
So I understand the principle but no idea how to actually make it work - Could anyone help explain it to me or help with the code?
Thanks so much to anyone who can offer some help
Catherine

Hi Ned,
sorry to bother you again on this subject -
the script...
function onMouseMove(event:MouseEvent): void {
  movieclip.gotoAndStop(Math.round(mouseX/movieclip.width*(movieclip.totalFrames-1))+1 )
worked fine - but when you click and drag on the movie clip it didn't always get to the end of the movie and never carried on through the frames back to the beginning like i wanted it to (such as this one does Interactive Thyroidectomy)
So I went back to the older 2.0 script and played with it a bit to be :
function onMouseMove(event:MouseEvent): void {
  changeDistance = movieclip.mouseX - startX;
  travelDistance = startFrame + changeDistance;
  if (travelDistance > movieclip.totalFrames) {
  movieclip.gotoAndStop (travelDistance % movieclip.totalFrames);
  } else if (travelDistance < 0) {
  movieclip.gotoAndStop (movieclip.totalFrames + (travelDistance % movieclip.totalFrames));
  } else {
  movieclip.gotoAndStop (travelDistance);
.... which almost works but it is very stuttery to mouse over and then it has this output error..
mouseDown
ArgumentError: Error #2109: Frame label 2.3500000000000227 not found in scene 2.3500000000000227.
  at flash.display::MovieClip/gotoAndStop()
  at flashdoc_fla::MainTimeline/onMouseMove()
ArgumentError: Error #2109: Frame label 3.6499999999999773 not found in scene 3.6499999999999773.
  at flash.display::MovieClip/gotoAndStop()
  at flashdoc_fla::MainTimeline/onMouseMove()
ArgumentError: Error #2109: Frame label 4.949999999999989 not found in scene 4.949999999999989.
  at flash.display::MovieClip/gotoAndStop()
  at flashdoc_fla::MainTimeline/onMouseMove()
ArgumentError: Error #2109: Frame label 6.25 not found in scene 6.25.
  at flash.display::MovieClip/gotoAndStop()
  at flashdoc_fla::MainTimeline/onMouseMove()
ArgumentError: Error #2109: Frame label 7.600000000000023 not found in scene 7.600000000000023.
  at flash.display::MovieClip/gotoAndStop()
  at flashdoc_fla::MainTimeline/onMouseMove()
ArgumentError: Error #2109: Frame label 8.899999999999977 not found in scene 8.899999999999977.
  at flash.display::MovieClip/gotoAndStop()
  at flashdoc_fla::MainTimeline/onMouseMove()
ArgumentError: Error #2109: Frame label 11.5 not found in scene 11.5.
  at flash.display::MovieClip/gotoAndStop()
  at flashdoc_fla::MainTimeline/onMouseMove()
ArgumentError: Error #2109: Frame label 12.850000000000023 not found in scene 12.850000000000023.
  at flash.display::MovieClip/gotoAndStop()
  at flashdoc_fla::MainTimeline/onMouseMove()
ArgumentError: Error #2109: Frame label 14.149999999999977 not found in scene 14.149999999999977.
  at flash.display::MovieClip/gotoAndStop()
  at flashdoc_fla::MainTimeline/onMouseMove()
ArgumentError: Error #2109: Frame label 15.449999999999989 not found in scene 15.449999999999989.
  at flash.display::MovieClip/gotoAndStop()
  at flashdoc_fla::MainTimeline/onMouseMove()
ArgumentError: Error #2109: Frame label 16.75 not found in scene 16.75.
  at flash.display::MovieClip/gotoAndStop()
  at flashdoc_fla::MainTimeline/onMouseMove()
mouseUp
I've obviously put some code in the wrong place - could you help me find out what it might be?
I haven't labelled any frames odd numbers such as 15.4499999999999989 or labeled scenes than number either.
I can send you my scene if that would help?
Thanks very much for your time Ned
(p.s Or maybe if it is easier you might offer some guidance as to how i can change the action script
function onMouseMove(event:MouseEvent): void {
  movieclip.gotoAndStop(Math.round(mouseX/movieclip.width*(movieclip.totalFrames-1))+1 )
to allow it to be more like Interactive Thyroidectomy

Similar Messages

  • Scripting a mouse click and drag

    does anyone know how to script a mouse click and drag. I tried XTools. No luck. What about Cliclick. I had tons of success with TextCommands but I dont know how to get OSAX plugin code to work. Thanks in advance.
    I am trying to move a desktop clock (QuartzClock) from the center of the screen to the side.

    I tried (unsuccessfully) to find a mouse move and click solution in Applescript.
    My search brought me to this site: http://www.geekorgy.com/index.php/2010/06/python-mouse-click-and-move-mouse-in-a pple-mac-osx-snow-leopard-10-6-x/
    The following python script will move an object from position 60.100 to 60.300
    #!/usr/bin/python
    import sys
    import time
    from Quartz.CoreGraphics import * # imports all of the top-level symbols in the module
    def mouseEvent(type, posx, posy):
    theEvent = CGEventCreateMouseEvent(None, type, (posx,posy), kCGMouseButtonLeft)
    CGEventPost(kCGHIDEventTap, theEvent)
    def mousemove(posx,posy):
    mouseEvent(kCGEventMouseMoved, posx,posy);
    def mouseclickdn(posx,posy):
    mouseEvent(kCGEventLeftMouseDown, posx,posy);
    def mouseclickup(posx,posy):
    mouseEvent(kCGEventLeftMouseUp, posx,posy);
    def mousedrag(posx,posy):
    mouseEvent(kCGEventLeftMouseDragged, posx,posy);
    ourEvent = CGEventCreate(None);
    currentpos=CGEventGetLocation(ourEvent); # Save current mouse position
    mouseclickdn(60, 100);
    mousedrag(60, 300);
    mouseclickup(60, 300);
    time.sleep(1);
    mousemove(int(currentpos.x),int(currentpos.y)); # Restore mouse position
    See also:
    http://developer.apple.com/mac/library/documentation/Carbon/Reference/QuartzEven tServicesRef/Reference/reference.html
    http://developer.apple.com/graphicsimaging/pythonandquartz.html
    Tony

  • Is it possible to play an animation by clicking and dragging?

    I currently have right and left arrow buttons to control an animation.
    I was wondering if it's possible to control the animation by dragging the mouse? So if the user clicked and dragged the mouse to the left it would play the animation, then when they released the click it would stop. And if they dragged to the right it would play in reverse.
    I've been looking around and haven't found anything on this topic. Any help would be appreciated.

    Hi, cameronnicol-
    The code should work on the Stage, as it's internally just a symbol.  You should ensure that you reference the object as Stage in your code and not stage (note the capitalization).  The other thing to consider is that click and drag events are not very performant on devices; touch events generally register very quickly and will give your users a better experience.
    -Elaine

  • I am unable to click and drag some songs to a playlist I just created. There is a red circle with a line diagonal through it when I attempt to drag it to the playlist?

    I am unable to add some songs to a playlist.  There is a red circle with a line diagnonally through it that appears when I click and drag to the new playlist.

    That problem can be caused by the Yahoo! Toolbar or the Babylon extension that extents too much downwards and covers the top part of the browser window and thus makes links and buttons in that part of the screen not clickable.
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Cannot click and drag with bluetooth mouse?

    I have installed bluetooth mouse and works fine but cannot click and drag using the mouse in any applications. will highlight stuff and cursor moves fine but then cannot drag using the mouse. Any ideas?

    I was trying with this code which I got from this website as I am beginner of AS3.
    var images:MovieClip = images_mc;
    var offsetFrame:int = images.currentFrame;
    var offsetX:Number = 0;
    var offsetY:Number = 0;
    var percent:Number = 0;
    images.addEventListener(MouseEvent.MOUSE_DOWN,startDragging);
    images.addEventListener(MouseEvent.MOUSE_UP,stopDragging);
    function startDragging(e:MouseEvent):void
    images.addEventListener(MouseEvent.MOUSE_MOVE,drag);
    offsetX = e.stageX;
    offsetY = e.stageY;
    function stopDragging(e:MouseEvent):void
    images.removeEventListener(MouseEvent.MOUSE_MOVE,drag);
    offsetFrame = images.currentFrame;
    function drag(e:MouseEvent):void
    percent =  (e.stageX - offsetX)/images.width;
    percent =  (e.stageY - offsetY)/images.height;
    var frame:int = Math.round(percent*images.totalFrames) + offsetFrame +1;
    while (frame>images.totalFrames)
      frame -=  images.totalFrames;
    while (frame<=0)
      frame +=  images.totalFrames;
    images.gotoAndStop(frame);
    This has to rotate in top also i.e., I also have images sequence placed with top view also.
    If I use keyboard, it has to work with arrow keys also and also with mouse interactivity.

  • Mouse not clicking and dragging

    My mouse pointer responds well to moving around the screen and double ckicking etc. However when I try to click and drag it 'loses' the object (file name or card in Freecell) or will not select all that I shift& drag. All the drivers are up to date. I have removed, waited and then replaced the Bluetooth USB fitting in the back of the computer and the batteries are fresh. Any Ideas?
    HP TouchSmart 520-1010ukH
    Microsoft mouse model MG-0982
    Windows 7
    This question was solved.
    View Solution.

    Hello again @itsmagicvi,
    If you have tried a different mouse on your computer and it is not happening to that mouse I suspect that your Microsoft Mouse is the problem and suggest you contact Microsoft on their forums at Microsoft Community as they may have addressed this issue with their hardware before.
    I hope I have answered your question to your satisfaction. Thank you for posting on the HP Forums. Have a great day!
    Please click the "Thumbs Up" on the bottom right of this post to say thank you if you appreciate the support I provide!
    Also be sure to mark my post as “Accept as Solution" if you feel my post solved your issue, it will help others who face the same challenge find the same solution.
    Dunidar
    I work on behalf of HP
    Find out a bit more about me by checking out my profile!
    "Customers don’t expect you to be perfect. They do expect you to fix things when they go wrong." ~ Donald Porter

  • Mouse will not perform click and drag

    My Magic Mouse will not perform click-and-drag function anymore after Mavericks.

    Problem solved thanks to Eric Cote:
    https://discussions.apple.com/message/15696875#15696875:
    "you may want to trash your preference files under:
    Users/<your user name>/Library/Preferences/com.apple.driver.AppleHIDMouse.plist
    then reset the mouse prefs"
    Thank you Eric!

  • Mouse clicking amd Dragging

    Hi, I have the following code so far, and when run in conjunction with other classes it creates a carousel feature.
    When you click and hold on the carousel and drag up or down, the carousel moves in the relevant direction.
    I am trying to change this click and drag, so instead when you click one of the polygons (which represent up and down arrows), the carousel moves up or down depending on which you click.
    Can anyone help with this?!
    Thanks very much!
    class ScheduleBarCanvas extends Canvas implements MouseListener,
    MouseMotionListener, ActionListener
    * CONSTANTS *
    /** Width of a slot, in pixels. */
    static final int SLOT_WIDTH = 2;
    /** Width of an entire day schedule bar, in pixels. */
    static final int BAR_WIDTH = Slot.SLOTS_PER_DAY * SLOT_WIDTH;
    /** Half of the height of a day schedule bar, in pixels. */
    static final int BAR_HALF_HEIGHT = 20;
    /** The width of an hour within a day schedule bar, in pixels. */
    static final double HOUR_WIDTH = BAR_WIDTH / 24;
    * The schedule day bars are represented as a rotatable 'wheel'. This value
    * defines the 'angle' allocated to a single day bar.
    private static final float DEGREES_PER_DAY_BAR = 10;
    * For convenience, this value represents the number of day bars that occupy
    * a 90-degree 'slice' of the schedule wheel.
    private static final int DAY_BARS_PER_90_DEGREES = (int) 9;
    * The maximum number of day bars that can be represented in the wheel.
    private static final int MAX_BARS = 9*2-1;
    * FIELDS *
    * Popup menu to use for right click menu. The right click menu allows users
    * to perform actions such as changing the climate for a selected period of
    * time.
    private final JPopupMenu rightClickMenu = new JPopupMenu();
    * Determines whether 'paste day schedule' is an available option in the
    * right click menu. 'Paste day schedule' should remain unavailable until
    * the user has copied a day schedule bar.
    private boolean allowPaste = false;
    * When the user has chosen to copy a day schedule, it will be stored here.
    private DaySchedule copiedDaySchedule;
    * A day schedule with the default period allocations.
    private final DaySchedule defaultDaySchedule;
    /** X coordinate of the left end of the schedule bars. */
    private int barLeftX;
    /** Y coordinate of centre of schedule bar display. */
    private int centreY;
    /** Width of canvas, pixels. */
    private int width;
    /** Height of canvas, pixels. */
    private int height;
    /** X coordinate of last mouse click. */
    private int lastMouseClickPositionX = 0;
    /** Y coordinate of last mouse click. */
    private int lastMouseClickPositionY = 0;
    /** X coordinate of last right mouse button click. */
    private int lastRightClickPositionX = 0;
    /** Y coordinate of last right mouse button click. */
    private int lastRightClickPositionY = 0;
    /** Start time of last selected period. */
    private Slot periodStartTime = new Slot(0);
    /** End time of last selected period. */
    private Slot periodEndTime = new Slot(0);
    /** Last-pressed mouse button. */
    private int pressedButton;
    * While clicking and dragging to modify the end time of a period, this
    * field stores the 'old' end time of the period.
    private int currentPeriodEnd;
    * While clicking and dragging to modify the end time of a period, this
    * field stores the width of the current period. At other times, this field
    * has the value 0.
    private int currentPeriodWidth = 0;
    * Rather than directly manipulating the window's canvas, a buffer is used.
    * All updates to the display are computed 'out of sight', by writing to
    * this buffer's Graphics object (see 'graphicsBuffer') and then copied to
    * the canvas in one go.
    private Image imageBuffer;
    private Image imageBuffer2;
    /** Graphics object buffer to use when updating the display. */
    private Graphics graphicsBuffer;
    private double animationSpeed = 0;
    private double simTimeInc;
    private double simTime = 0; // simulated time, HOURS from start
    /** Collection of days */
    private Schedule schedule;
    * The set of day schedule bars visible on screen at present. As the user
    * scrolls through different days, schedule bars will come in and out of
    * sight, and hence will enter and leave this array.
    private DayBar[] visibleScheduleBars;
    /** Stores the available schedulables */
    private List<Schedulable> palette;
    private int barZeroDay;
    /** Currently highlighted period - not currently used */
    private Period selection;
    /** Previously highlighted selection - not currently used */
    private Period oldSelection; // button 3 selections
    private Period dayDrag; // button 1 drag region
    private DaySchedule daySched; // schedule affected by drag
    * When clicking and dragging to change the duration of a Period, this value
    * is used to store the number of the slot being dragged.
    * If this is a new Period, and hence no prior boundary existed, this value
    * will be -1.
    private int draggedSlotBoundary;
    * When you right click on a Period, the system fills this value with the
    * number of the first slot in that Period. For instance, if 13:00 to 16:00
    * is set to 'away', and you right click at 14:40 (or any other slot inside
    * the 'away' Period), then this value will be set to the index of the slot
    * 13:00.
    private int firstSlotNumber;
    * When you right click on a Period, the system fills this value with the
    * number of the last slot in that Period. For instance, if 13:00 to 16:00
    * is set to 'away', and you right click at 14:40 (or any other slot inside
    * the 'away' Period), then this value will be set to the index of the slot
    * 16:00.
    private int lastSlotNumber;
    private DaySchedule selectedDaySchedule;
    private boolean createPeriods = true;
    * CONSTRUCTORS *
    * Setting various schedules that can be displayed
    * Initialises the display of the scheduler
    * Setting right click menu
    ScheduleBarCanvas()
    int delay = 0; // milliseconds
    int period = 40; // milliseconds
    final double updateFreq = 1000.0 / period; // H
    visibleScheduleBars = new DayBar[20];
    palette = new ArrayList<Schedulable>();
    palette.add(new Schedulable(new Color(50, 50, 220))); // away
    palette.add(new Schedulable(new Color(100, 180, 160))); // sleep
    palette.add(new Schedulable(new Color(150, 150, 120))); // busy
    palette.add(new Schedulable(new Color(200, 100, 20))); // relax
    defaultDaySchedule = new DaySchedule(palette);
    schedule = new Schedule(palette);
    Timer timer = new Timer();
    // Inner class construction for a java.util.Timer object with a
    // defined TimerTask to run processes. See the java.util library
    // in the Java API for details. Also refer to other java utility
    // assistance classes which may be useful to you in the future.
    timer.schedule(new TimerTask()
    public void run()
    simTimeInc = getAnimationSpeed() / (updateFreq * 200.0);
    if (simTimeInc > 0.0)
    { // Advance simulation time at
    simTime += simTimeInc; // current rate
    repaint(); // then update the display ASAP.
    }, delay, period); // schedule's init delay & repeat-call period
    JMenuItem menuItem1 = new JMenuItem(
    "Set climate to 'Away'", new ImageIcon("away.png")),
    menuItem2 = new JMenuItem(
    "Set climate to 'Sleeping'", new ImageIcon("sleep.png")),
    menuItem3 = new JMenuItem(
    "Set climate to 'Relaxing'", new ImageIcon("relax.png")),
    menuItem4 = new JMenuItem(
    "Set climate to 'Busy'", new ImageIcon("busy.png")),
    menuItem5 = new JMenuItem(
    "Reset day schedule", new ImageIcon("refresh.png")),
    menuItem6 = new JMenuItem(
    "Copy day schedule", new ImageIcon("copy.png"));
    menuItem1.addActionListener(this);
    menuItem2.addActionListener(this);
    menuItem3.addActionListener(this);
    menuItem4.addActionListener(this);
    menuItem5.addActionListener(this);
    menuItem6.addActionListener(this);
    rightClickMenu.add(menuItem2);
    rightClickMenu.add(menuItem4);
    rightClickMenu.add(menuItem1);
    rightClickMenu.add(menuItem3);
    rightClickMenu.add(menuItem5);
    rightClickMenu.add(menuItem6);
    addMouseListener(this);
    addMouseMotionListener(this);
    * GRAPHICS METHODS *
    * Updates the GUI.
    * @param g graphics object to draw to.
    public void update(Graphics g)
    // NB: repaint() above automatically calls update(Graphics g) ASAP.
    paint(g);
    * Updates the display.
    * @param g canvas to draw on.
    public void paint(Graphics g)
    float carouselRadius = 100; // Carousel radius in pixels
    float degreesPerPixel = (float) (57.29 / carouselRadius);
    if (currentPeriodWidth != 0)
    simTime += currentPeriodWidth * (degreesPerPixel / DEGREES_PER_DAY_BAR) * 24;
    currentPeriodEnd += currentPeriodWidth;
    currentPeriodWidth = 0;
    barZeroDay = (int) simTime / 24; // treat 1 sim sec as 1 hour
    int maxDayNo = barZeroDay + MAX_BARS;
    if (barZeroDay < 0 || maxDayNo >= Schedule.N_SCHEDULES)
    return; // invalid day number; do nothing
    Dimension dim = getSize();
    int maxX = dim.width - 1, maxY = dim.height - 1;
    barLeftX = maxX / 7;
    centreY = maxY / 2;
    if (width != dim.width || height != dim.height)
    width = dim.width;
    height = dim.height;
    imageBuffer = createImage(width, height);
    graphicsBuffer = imageBuffer.getGraphics();
    graphicsBuffer.clearRect(0, 0, width, height);
    graphicsBuffer.setColor(new Color(0, 0, 0));
    int hour = (int) simTime - barZeroDay * 24;
    float dayZeroOffsetAngle = (float) (((hour - 12) / 24.0) * DEGREES_PER_DAY_BAR);
    for (int barNo = 0; barNo <= MAX_BARS; barNo++)
    int dayNo = barZeroDay + barNo;
    int daysEarlier = DAY_BARS_PER_90_DEGREES - barNo;
    float dayAngle = daysEarlier * DEGREES_PER_DAY_BAR
    + dayZeroOffsetAngle;
    float z = carouselRadius * (float) Math.cos(0);
    float y = carouselRadius * (float) Math.sin(dayAngle / 57.3);
    float x = z / 20;
    DayBar dayBar = new DayBar(dayNo, schedule.getDaySchedule(dayNo),
    graphicsBuffer, barLeftX, centreY, x, y);
    visibleScheduleBars[barNo] = dayBar;
    for (int barNo = 0; barNo <= MAX_BARS; barNo++)
    visibleScheduleBars[barNo].paintBar(oldSelection, selection);
    g.drawImage(imageBuffer, 20, 0, null);
    g.setColor(Color.WHITE);
    g.drawRect(40,25,375,50);
    g.fillRect(40,25,375,50);
    g.drawRect(40,205,375,65);
    g.fillRect(40,205,375,65);
    Point bigArrowPoint1 = new Point(0,0);
    Point bigArrowPoint2 = new Point(0,0);
    Point bigArrowPoint3 = new Point(0,0);
    Point smallArrowPoint1 = new Point(0,0);
    Point smallArrowPoint2 = new Point(0,0);
    Point smallArrowPoint3 = new Point(0,0);
    bigArrowPoint1 = new Point(100,100); //top left
    bigArrowPoint2 = new Point(100,100); //middle right
    bigArrowPoint3 = new Point(100,100); //bottom left
    smallArrowPoint1 = new Point(100,100); //top left
    smallArrowPoint2 = new Point(100,100); //middle right
    smallArrowPoint3 = new Point(100,100); //bottom left
    Polygon bigArrow = new Polygon();
    bigArrow.addPoint(bigArrowPoint1.x+310,bigArrowPoint1.y-25);
    bigArrow.addPoint(bigArrowPoint2.x+320,bigArrowPoint2.y-25);
    bigArrow.addPoint(bigArrowPoint3.x+315,bigArrowPoint3.y-30);
    Polygon smallArrow = new Polygon();
    smallArrow.addPoint(smallArrowPoint1.x+310,smallArrowPoint1.y+105);
    smallArrow.addPoint(smallArrowPoint2.x+320,smallArrowPoint2.y+105);
    smallArrow.addPoint(smallArrowPoint3.x+315,smallArrowPoint3.y+110);
    g.setColor(Color.black);
    g.fillPolygon(bigArrow);
    g.drawPolygon(bigArrow);
    g.setColor(Color.black);
    g.fillPolygon(smallArrow);
    g.drawPolygon(smallArrow);
    addMouseListener(this);
    addMouseMotionListener(this);
    * Sets a new percentage value for the animation speed of the application.
    * @param animationSpeed desired animation speed.
    void setAnimationSpeed(double animationSpeed)
    this.animationSpeed = animationSpeed;
    * Returns the current speed of the animation, as a percentage.
    * @return the current speed of the animation, as a percentage.
    private double getAnimationSpeed()
    return animationSpeed;
    * Finds and returns a slot based upon the specified mouse position
    * coordinates.
    * @param x x coordinate of selection, relative to centre-left of schedule
    * bar display.
    * @param y y coordinate of selection, relative to centre-left of schedule
    * bar display.
    * @return a Slot value corresponding to the selected slot if available. If
    * no slot was selected, null is returned.
    private Slot findSlot(int x, int y)
    int barNumber = findDayBarNumber(x, y);
    if (barNumber == -1)
    return null;
    int foo = (x - (int) visibleScheduleBars[barNumber].getLeftAngleX());
    int bar = (barNumber * Slot.SLOTS_PER_DAY + foo / SLOT_WIDTH);
    return new Slot(bar + barZeroDay * Slot.SLOTS_PER_DAY);
    * Finds the day bar specified by the provided mouse coordinates, and then
    * returns its number.
    * @param x x coordinate of mouse position.
    * @param y y coordinate of mouse position.
    * @return the number of the day bar, or -1 if no day bar was found at the
    * specified mouse coordinates.
    private int findDayBarNumber(int x, int y)
    for (int barNo = MAX_BARS - 1; barNo >= 0; barNo--)
    DayBar dayBar = visibleScheduleBars[barNo];
    if (x >= dayBar.getLeftAngleX() && x <= dayBar.getBarRightAngleX()
    && y >= dayBar.getBarBottomAngleY()
    && y <= dayBar.getBarTopAngleY())
    return barNo;
    return -1;
    * EVENT HANDLER METHODS *
    * This event handler is unused.
    * @param evt ignored.
    public void mouseClicked(MouseEvent evt)
    * This event handler is unused.
    * @param evt ignored.
    public void mouseExited(MouseEvent evt)
    * This event handler is unused.
    * @param evt ignored.
    public void mouseEntered(MouseEvent evt)
    * This event handler is unused.
    * @param evt ignored.
    public void mouseMoved(MouseEvent evt)
    * Called when the mouse button is released.
    * 1. Displays the right click menu if the right mouse button was clicked 2.
    * Updates 'last click position' fields 3. Modifies end time of current
    * selection
    * @param evt mouse event information.
    public void mouseReleased(MouseEvent evt)
    if (evt.isPopupTrigger()) // was the menu requested?
    displayRightClickMenu(evt);
    // Update 'last click position' fields
    lastMouseClickPositionX = evt.getX();
    lastMouseClickPositionY = evt.getY();
    if (pressedButton == MouseEvent.BUTTON3)
    { // selecting
    int barPositionX = lastMouseClickPositionX - barLeftX;
    int barPositionY = centreY - lastMouseClickPositionY;
    periodEndTime = findSlot(barPositionX, barPositionY);
    selection.setEnd(periodEndTime);
    * Called when mouse button is pressed. Updates slot with schedulable.
    * @param evt mouse event information.
    public void mousePressed(MouseEvent evt)
    if (evt.isPopupTrigger()) // was the menu requested?
    displayRightClickMenu(evt);
    lastMouseClickPositionX = evt.getX();
    int barPositionX = lastMouseClickPositionX - barLeftX;
    lastMouseClickPositionY = evt.getY();
    int barPositionY = centreY - lastMouseClickPositionY;
    periodStartTime = findSlot(barPositionX, barPositionY);
    if (periodStartTime == null)
    return;
    if (periodStartTime.getDayNumber() < 0
    || periodStartTime.getDayNumber() >= Schedule.N_SCHEDULES)
    return; // boundary case.
    pressedButton = evt.getButton(); // 1=left, 2=mid or wheel 3= right
    if (pressedButton == MouseEvent.BUTTON1)
    { // dragging
    // but maybe creating new selection too so...
    oldSelection = selection;
    currentPeriodEnd = barPositionY;
    currentPeriodWidth = 0;
    dayDrag = new Period(periodStartTime, periodStartTime);
    int s = periodStartTime.getSlotNumber();
    if (!createPeriods)
    return;
    daySched = schedule.getDaySchedule(periodStartTime.getDayNumber());
    draggedSlotBoundary = daySched.findNearBoundary(s, 3);
    if (draggedSlotBoundary < 0)
    if (s < 0 || s >= Slot.SLOTS_PER_DAY)
    return; // boundary case
    // Not near a boundary, so create seed slot for new
    // period
    if (daySched.getSlot(s) == palette.get(0))
    daySched.setSlot(s, palette.get(1));
    else
    daySched.setSlot(s, palette.get(0));
    draggedSlotBoundary = s;
    } else
    Schedulable SS = daySched.getSlot(draggedSlotBoundary);
    if (draggedSlotBoundary < s)
    daySched.insert(SS, draggedSlotBoundary, s);
    else
    daySched.insert(SS, s, draggedSlotBoundary);
    else if (pressedButton == MouseEvent.BUTTON3)
    { // selecting
    oldSelection = selection;
    periodStartTime = findSlot(barPositionX, barPositionY);
    selection = new Period(periodStartTime, periodStartTime);
    * Called when the mouse is moved while a button on it is held down.
    * Changes the end time of the selected Period.
    * @param evt information about the current mouse cursor state, e.g.
    * position.
    public void mouseDragged(MouseEvent evt)
    lastMouseClickPositionX = evt.getX();
    int barPositionX = lastMouseClickPositionX - barLeftX;
    lastMouseClickPositionY = evt.getY();
    int barPositionY = centreY - lastMouseClickPositionY;
    if (pressedButton == MouseEvent.BUTTON1)
    { // dragging
    Slot selectedSlot = findSlot(barPositionX, barPositionY);
    currentPeriodWidth = barPositionY - currentPeriodEnd;
    if (draggedSlotBoundary < 0 || selectedSlot == null)
    return; // out of bounds
    if (!createPeriods)
    return;
    for (int s = draggedSlotBoundary + 1; s < selectedSlot.getSlotNumber(); s++)
    daySched.setSlot(s, daySched.getSlot(draggedSlotBoundary));
    dayDrag.setEnd(selectedSlot); // or could use Selection instead
    if (pressedButton == MouseEvent.BUTTON3)
    { // selecting
    Slot selectedSlot = findSlot(barPositionX, barPositionY);
    selection.setEnd(selectedSlot);
    * Displays the right click menu.
    * @param evt information about the current mouse cursor state, e.g.
    * position.
    private void displayRightClickMenu(MouseEvent evt)
    // Calculate positions of mouse click relative to centre-left of
    // schedule bars display.
    lastRightClickPositionX = evt.getX() - barLeftX;
    lastRightClickPositionY = centreY - evt.getY();
    // identify bar to modify
    DayBar db = null;
    for (int barNo = MAX_BARS - 1; barNo >= 0; barNo--)
    DayBar currentBar = visibleScheduleBars[barNo];
    if (lastRightClickPositionX >= currentBar.getLeftAngleX()
    && lastRightClickPositionX <= currentBar.getBarRightAngleX()
    && lastRightClickPositionY >= currentBar.getBarBottomAngleY()
    && lastRightClickPositionY <= currentBar.getBarTopAngleY())
    db = currentBar;
    break;
    if (db == null)
    return;
    // identify 'selected' section/setting
    Slot t = findSlot(lastRightClickPositionX, lastRightClickPositionY);
    int slot = t.getSlotNumber();
    if (slot < 0)
    return; // out of bounds
    // find out colour of selected section
    selectedDaySchedule = db.getDaySchedule();
    Color colour = selectedDaySchedule.getSlot(slot).colour;
    // go left/back; find earliest section with this colour
    firstSlotNumber = slot;
    while (true)
    Color currentSlotColour = selectedDaySchedule
    .getSlot(firstSlotNumber).colour;
    if (!currentSlotColour.equals(colour))
    firstSlotNumber++;
    break;
    if (firstSlotNumber > 0) // lower boundary case
    firstSlotNumber--;
    else
    break;
    // go right/forwards; find latest section with this colour
    lastSlotNumber = slot;
    while (true)
    Color currentSlotColour = selectedDaySchedule
    .getSlot(lastSlotNumber).colour;
    if (!currentSlotColour.equals(colour))
    break;
    if (lastSlotNumber < Slot.SLOTS_PER_DAY - 1) // upper bound case
    lastSlotNumber++;
    else
    break;
    rightClickMenu.show(evt.getComponent(), evt.getX(), evt.getY());
    * Called when the user selects an item from the right click menu. Changes
    * the Schedulable for the selected Period to the requested value.
    * @param evt an ActionEvent, providing information about the command that
    * was selected from the menu.
    public void actionPerformed(ActionEvent evt)
    String command = evt.getActionCommand();
    if (command.equals("Copy day schedule"))
    if (!allowPaste) {
    * If the user copies a day schedule, we must enable
    * the paste option in the menu.
    JMenuItem menuItem7 = new JMenuItem("Paste day schedule",
    new ImageIcon("paste.png"));
    menuItem7.addActionListener(this);
    rightClickMenu.add(menuItem7);
    allowPaste = true; // only do this once
    int barNo = findDayBarNumber(
    lastRightClickPositionX, lastRightClickPositionY);
    DayBar db = visibleScheduleBars[barNo];
    /* It's important that we copy the day schedule by value, not by
    * reference. If we just copy a reference, then if we 'copy' a bar,
    * changing the source bar after the copy operation will change what
    * is ultimately 'pasted'.
    copiedDaySchedule = db.getDaySchedule().clone();
    else if (command.equals("Paste day schedule"))
    int barNo = findDayBarNumber(
    lastRightClickPositionX, lastRightClickPositionY);
    DayBar db = visibleScheduleBars[barNo];
    db.getDaySchedule().insert(
    copiedDaySchedule, 0, Slot.SLOTS_PER_DAY-1);
    else if (command.equals("Reset day schedule"))
    int barNo = findDayBarNumber(
    lastRightClickPositionX, lastRightClickPositionY);
    DayBar db = visibleScheduleBars[barNo];
    db.getDaySchedule().insert(
    defaultDaySchedule, 0, Slot.SLOTS_PER_DAY-1);
    else
    * Identifies which new Schedulable was requested. This Schedulable
    * will replace the selected Period's Schedulable value.
    * For instance, if "Away" was selected from the menu, then we must
    * fetch the "Away" Schedulable.
    Schedulable schedulable;
    if (evt.getActionCommand().equals("Set climate to 'Away'"))
    schedulable = palette.get(2); // the 'away' Schedulable
    else if (evt.getActionCommand().equals("Set climate to 'Sleeping'"))
    schedulable = palette.get(0); // the 'sleeping' Schedulable
    else if (evt.getActionCommand().equals("Set climate to 'Busy'"))
    schedulable = palette.get(1);
    else if (evt.getActionCommand().equals("Set climate to 'Relaxing'"))
    schedulable = palette.get(3);
    else
    // Should never occur
    throw new Error("Unrecognised command.");
    // Now fill the selected Period with the requested Schedulable.
    selectedDaySchedule.insert(
    schedulable, firstSlotNumber, lastSlotNumber);
    * User is able to edit schedule when boolean is set to true
    * @param createPeriods sets state of interaction with day schedules
    void setCreatePeriods(boolean createPeriods) {
    this.createPeriods = createPeriods;
    }

    Here is the Apple document covering Magic Mouse faults.  Symptom number 6 seems the one to check out.  Is this a longstanding or a recently developed fault?
    And, of course, is it still under the 12 month warranty.
    One thing to pay particular attention to is the proximity of electronic items such as cradles for phones and the like which if active, can interfere with the signal.
    Troubleshooting wireless mouse and keyboard issues

  • I have created a site with iWeb. I have replaced the iWeb Nav bar with a vertical one I made myself. Problem is, my top button disables itself if it overlaps into the "hidden" nav bar area. I can cmd click and drag it into this area, but then all the rest

    I have created a site with iWeb. I have replaced the iWeb Nav bar with a vertical one I made myself. Problem is, my top button disables itself (and the animation doesn't work) if it overlaps into the "hidden" nav bar area (indicated by a blue rectangle). I can cmd click and drag it into this area, but then all the rest of my site is pushed down the page. Don't know what to do about this. I don't know how to bring the rest of the page up without dragging it also into the designated nav bar area. Also, by doing this, is it affecting my site in ant way? see my site here at www.steveburrowsimages.com
    The home page is with it all draged into the nav bar area and the about page is with is outside the nav bar area (notice that the top button does not animate or work as a button.
    Getting confused here. Anyone got any ideas?

    Well, you made a good start with SEO by getting rid of the iWeb default navigation since it doesn't help the spiders and, out there in the real world, there are more people than you would think with javascript turned off in their browsers.
    One of the downsides of iWeb is that it doesn't allow for the alt attribute in the img tag. Its well worth adding these to give you extra keywords even if you have captioned all your images. Use iWeb SEO Tool for this...
    http://www.iwebformusicians.com/Search-Engine-Optimization/Tags.html
    iWeb, just like most drag and drop software, creates a huge amount of code which causes the pages to load slowly in the browser. Running you files through an optimizer will help to reduce this problem and further reduce the size of image files even beyond the initial optimization you do before loading them into iWeb...
    http://www.iwebformusicians.com/Search-Engine-Optimization/Optimize.html

  • The MacBook Pro will not allow me to cut-and-paste to and from or to click-and-drag to the external drive. I can copy-and-paste, but then I must send the original to the trash, which doubles the time and effort. Is there any way to cut-and-paste?

    I have recently switched from a PC to a MacBook Pro.
    I have a large number of documents and photographs on a multiterrabite external drive, backed up on a second multiterrabite external drive.
    Both external drives are formatted for MacIntosh. This has been verified by agents at an Apple store and also at Best Buy in two different cities.
    This is the problem:
    The MacBook Pro will not allow me to cut-and-paste to and from or to click-and-drag to the external drive. I can copy-and-paste, but then I must send the original to the trash, which doubles the time and effort. Is there any way to cut-and-paste?
    Also, the MacBook Pro will not allow me to rename multiple documents or photographs. I can click-and-rename a single one, but this is impossibly time consuming. I can batch-rename in iPhoto, but when I transfer the photographs to the external drive, the rename does not transfer.
    I’m reduced to using my wife’s Toshiba to cut-and-past, rename, and transfer documents. It works perfectly. Is there any way to do this on the MacBook Pro?
    Thanks!
    Roderick Guerry
    [email protected]

    Roderick Guerry wrote:
    The MacBook Pro will not allow me to cut-and-paste to and from or to click-and-drag to the external drive. I can copy-and-paste, but then I must send the original to the trash, which doubles the time and effort. Is there any way to cut-and-paste?
    No, this is a philosophical difference between Apple and Microsoft. Apple believes that it's dangerous to cut a file in case the user never pastes it; in that case the file is lost. Microsoft seems to not have this problem (if I remember Windows correctly) because they don't delete the originating file if it's cut but never pasted.
    Even though Macs have a lot of keyboard shortcuts, philosophically Macs have traditionally been mouse-first. This applies to file copy operations. In your case, what a Mac user would do is open the source window, open the destination window (on your second drive), and then Command-drag the selected files from the source to destination window. This is because a normal drag would leave the originals behind, while adding the Command modifier key tells OS X that this is a Move, not a Copy, so don't leave the originals behind.
    (In addition there are different rules for drag-copying within the same volume or between different volumes. If you drag between two folders on the same volume, the files are moved. If you drag between different volumes, the files are copied unless you hold down Command to delete the copies on the source volume.)
    Roderick Guerry wrote:
    Also, the MacBook Pro will not allow me to rename multiple documents or photographs. I can click-and-rename a single one, but this is impossibly time consuming. I can batch-rename in iPhoto, but when I transfer the photographs to the external drive, the rename does not transfer.
    Two problems in this case. First, batch file renaming is not built into OS X unless you build something with Automator. However, there are many utilities that can do batch file renaming which you can find at macupdate.com or on the App Store. Since I work with media I often batch rename using one of the media managers I have lying around like Media Pro or Adobe Bridge (comes with Photoshop).
    iPhoto is a database front end designed to shield the file system from the consumer and let them concentrate on creativity and sharing. As such it is often a poor choice for managing files directly. When you "transferred the photographs" chances are you moved the originals, not the ones iPhoto edited which are stored in a hidden folder.
    Roderick Guerry wrote:
    I’m reduced to using my wife’s Toshiba to cut-and-past, rename, and transfer documents. It works perfectly. Is there any way to do this on the MacBook Pro?
    There will not be a way to do it exactly like Windows. As described above, there are ways to do it "the Mac way." If it is possible to remove judgment on which way is "better" you might find the Mac way to be acceptable, but of course sometimes we simply prefer what we're used to.

  • Cursor issues, stuck on click and drag mode.

    My cursor is stuck on click and drag mode.I assumed issue was faulty track pad. Purchased a magic mouse, and initially it was fine then the same issues started occurring. Is this a virus? Ran disk repair and permissions repair , no change.

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of the test is to determine whether the problem is caused by third-party software that loads automatically at startup or login, by a peripheral device, by a font conflict, or by corruption of the file system or of certain system caches.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards, if applicable. Start up in safe mode and log in to the account with the problem. You must hold down the shift key twice: once when you boot, and again when you log in.
    Note: If FileVault is enabled, or if a firmware password is set, or if the boot volume is a Fusion Drive or a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to boot and run than normal, with limited graphics performance, and some things won’t work at all, including sound output and Wi-Fi on certain models. The next normal boot may also be somewhat slow.
    The login screen appears even if you usually login automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    Test while in safe mode. Same problem?
    After testing, reboot as usual (not in safe mode) and verify that you still have the problem. Post the results of the test.

  • Windows 7 in boot camp - two finger click and drag issues

    Hey everyone. I have Windows 7 on Boot Camp (MacBook Pro mid-2010, Mac OS X Lion) and I cannot seem to click on a window with one finger, then use a second finger to drag it. Every time I try it brings up the right click menu. Is there any way of fixing this? I want to be able to drag, darn it! Thanks.
    Grant

    Having had the same issue on my MacBook Pro with Boot Camp 5.0.5033 on Windows 8, workaround being external mouse, I have found the following:
    If Trackpad->Two Fingers->Secondary Click is enabled in Control Panel/Boot Camp, in order to Click and Drag one cannot click any place on the trackpad. One must click bottom area of the trackpad with one finger, and then use another finger to drag.
    If Trackpad->Two Fingers->Secondary Click is disabled, Click and Drag works the same way as in Mac OS X: one can click any place on MacBook Pro built-in trackpad with one finger, and then use another finger to drag the window or select a fragment of text. The two fingers Secondary Click, consequently, becomes disabled.
    For me Mac OS X-style Click&Drag is more important, so I disabled two fingers Secondary Click, and assigned Bottom-Right-Corner of the trackpad to be Right-Click instead.
    Don’t know if the question is still open… Hope, however, the info might be helpful to those having the same inconvenience with Click and Drag under Boot Camp.
    HTH

  • Premiere Pro CC 2014 crash when I Click and Drag

    Hi All, I have a problem with Premiere CC 2014 that is driving me crazy!
    The issue is as follows:
    If I try to drag a clip, sequence, effect or transition anywhere within the premiere, it will crash - with "Sorry, a serious error has occurred" message. The program will crash, quit and the saved recovery project is usually healthy (luckily!). BUT, as soon as I've re-started the program, and reloaded the project - or any project for that matter - the problem persists. As soon as I click and drag, Premiere crashes!
    In order to 'reset' this, I have to restart my machine. Once I have done so, I can continue editing as normal for a while (not long, perhaps up to an hour, or so) but eventually, it WILL crash again. I've not been able to work out what I have to do in order to trigger this - it seems random. But once it's happened, only restarting my computer will resolve it - and then only temporarily.
    Here are all the facts:
    The crash ONLY happens when I drag something... This can include moving a clip on the timeline, dragging a clip form the source viewer or project window, dragging an effect or transition.
    The crash happens after I have clicked, as soon as I start to move my mouse.
    I CAN click and drag to extend in and out points on the timeline, and I can do 'insert' edit using the button on the source monitor. No crash here.
    The footage plays fine.
    I am trying this on a CLEAN OS X install, with only Adobe packages installed, to eliminate any potential of interference from other programs. There are no third party plugins or drivers installed. No user data installed either (preferences, photos, documents, etc) - as fresh as it comes!
    I am not running Time Machine in the BG
    My system is: Macbook Pro 2011, 16GB Ram, 1tb SSD, OS X Yosemite 10.10.1. Intel Graphics card, so no option to turn on or off hardware acceleration. It is set to software only.
    I have tested this with projects and footage on an external drive, as well as internal, same issue.
    I noticed the issue had started on, or around 25-27th November 2014.
    Interestingly, I have noticed that once this crash has occurred in Premiere, a similar problem will occur in After Effects as soon as I drag a file or layer... doesn't matter what the layer is. The crash seems less elegant here, I don't get an error message, it just freezes and I have to 'force quit'. Again, the problem persists until the machine is restarted.
    I have been using my macbook and premiere pro cc 2014 on Mavericks for a long time, and had no problems - so I know it should work fine! The only things that changed were an update to Yosemite, I started using Time Machine to make regular backups, I installed a few new fonts and any CC updates that happened in the background... I can rule out most of these because of my fresh install, with no user data, fonts plugins or time machine to confuse matters... It must be an Adobe bug with Yosemite!
    Any ideas?
    Thanks so much in advance!!

    Hi Vince,
    vince_email wrote:
    ...The only things that changed were an update to Yosemite, I started using Time Machine to make regular backups...
    Please check this blog post. Updating from Time Machine can cause this issue: Premiere Pro CC, CC 2014, or 2014.1 freezing on startup or crashing while working (Mac OS X 10.9, and later).
    Thanks,
    Kevin

  • HT1751 when I click and drag itunes into a external harddrive all I get is a icon in the harddrive not the files

    when I click and drag itunes to an external harddrive all I get is a shortcut an icon to itunes not the files the music to itunes
    I am running  windows xp home edition

    I had this problem once and in my case it happenned with music I had not purchased through itunes and also to music that stored in icloud.  Once I brought that music off icloud and into my laptop it resolved most of the issue.

  • Why can't I click and drag clone brush??

    I'm working with a trial version of Aperture and trying to clone out a couple of annoying background details. When I use the clone tool, I cannot click and drag or "paint" with it. I only get a circular clone that is the diameter of the brush. I don't want to clone out the problem areas with a bunch of little circles! I want a smooth, painted cloned area. Is this possible with Aperture or do I need to go back to Photoshop....

    OK--Think I finally discovered the issue. I'm using a trackball and keyboard setup from Euphonix that communicates with the Mac via Ethernet and TCP/IP. Aperture cannot deal with mouse strokes transmitted this way. If I switch to a USB mouse connected directly to the Mac, the brushes work normally. Still a disappointment since the Euphonix is my default keyboard/mouse and I don't really want to keep a separate USB mouse hooked up.....

Maybe you are looking for

  • How to configure one TREX host with multiple index servers ?

    Hi All, Does anyone know how to configure TREX on the one host, with multiple index servers ? Reason for this is to make better use of resources available on the host server(4 Gig, 4 Processor, Windows2003), to improve the search performance of our K

  • Just found out liquid has been spilt on my MBA 2013 13"

    Bought my MBA four weeks ago from the UAE Apple Store (adds to the aggravation of the story) and last night a little bit of liquid (I'm guessing Vodka) got split over the keyboard and trackpad. I only realised today, as my keys on the right side of t

  • Letter of volatility for PXI

    Hello, I am in need of Letters of Volatility for the following PXI components.            - PXI-8431/8            - PXI-2503            - PXI-4065 Thanks in advance

  • Is there a workaround in Acrobat that lets you flip a pdf horiz and vert for composite output?

    The flip horizontally and vertically option is grayed out for composite output and only enabled for separations. I need to be able to flip pdfs horiz and vert when using hole-punched paper in my printer because the paper has to feed from the unpunche

  • Pdf not working

    I have converted a doc file to a pdf  using both works and open office, both with the same result.  It adds 30 blank pages and rearranges my pictures.  I have tried everything I can think of, even reinstalling all writting programs and adobe services