Click the mouse and drag through the animation of Platinum

Hi all

First of all - thank you for taking the time to look through and maybe help me with this question.

I'm just addressing flash actionscript 3.0 cc - so I apologize in advance for my not so much technical jargon.

In the past, I used actionscript 1.0 to create an interactive html file containing the animation of a hub of a 3D model. Users can click the mouse and drag to the left or right to 'spin' the model around - however they do really is already through the timeline containing 360 pictures of it from 360 degrees. Similar ideas can be found here: Thyroidectomy Interactive

Now boring I can't use the old code any more that I work in the latest Flash actionscript 3.0 cc

So, how I do the same thing but in actionscript 3.0?

So I worked this piece so far

On my main stage, I have two layers - Layer actions and another layer with my video (movieclip_mc)

In the layer actions 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 at the beginning as...:

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 little confused as to what she means


So I understand the principle but no idea how to actually make it work - could someone help explain to me or help with the code?

Thank you very much to all those who can offer help

Catherine

I missed replying to your answer yesterday, although I see it - I turned away by another chore for the rest of the day.

The game of AS2 code that show you closest matches what you do with the AS3 version.  And if you include all its implications and change a little bit, it should work for you.

Your AS3 onMouseDown function was missing the mouseX code as you mentioned... converting from the AS2 version it would be...

function onMouseDown(event:MouseEvent):void
{

startX = clip.mouseX;

startFrame = clip.currentFrame;
movieclip_mc.addEventListener (MouseEvent.MOUSE_MOVE, onMouseMove);
}

The onMouseMove function is somewhat a different story because it stops looking like the AS2 version when you transfer the background object in the picture.  If you were to model after the version AS2, you might find that it will work.  The AS2 version can quite easily transformed into AS3 if you use just the following guide...

"_xmouse' in AS2 becomes"mouseX' in AS3

"_currentframe" is that as2 becomes "currentFrame" in AS3

"_totalframes' in AS2 becomes"totalFrames"in AS3

Tags: Adobe Animate

Similar Questions

  • The clicks of mouse and trackpad... do nothing.

    MacBook Air under the age of two months.

    Symptom: pointer moves on the screen I use the trackpad, noise of rattling and sensation is full, but the click does nothing in the system.  I can't click anything on the screen, can not open or close anything. Connect a wired USB mouse, same thing! -move the pointer, occurs, clicking noise but no action on the screen (or OS environment) after the clicks.

    Then... eh.

    SMC Reset works temporarily, but the same symptoms returned.

    Some responses have been that there has been a spill, crumbs or a chassis folded.

    Crumbs?  -Gosh, maybe.  Frame bent or such?

    But then WHY would a SMC restore temporarily solve the problem, as it does in my case?

    If the problem was physical (trackpad inhibited by crumbs or bent), then LANDAU or SMC should not have any effect, in my mind.

    In addition, if it's a problem of trackpad, why the same thing would happen with a usb mouse?

    Anyway, I hate just my experience on my MacBook Air two months old now.  I know, give it to Apple and they have to him.  But, dang, the problem could be temporarily fixed, so... .it, for those who know really not on motherboards, firmware or other think about it?

    Please read If your pointer is nervous when you use a trackpad, Magic Trackpad, Magic Mouse - Apple Support.

    In addition, if it's a problem of trackpad, why the same thing would happen with a usb mouse?

    The following can help you pinpoint the problem. Please refer to OS X El Capitan: mouse and Trackpad pane accessibility preferences.

    To ignore the trackpad while using the mouse, choose (Apple menu) > System Preferences > accessibility > mouse and Trackpad. Select ignore built-in trackpad when mouse or a trackpad wireless is present.

    Determine if the adjustment changes the behavior you know.

  • How can I get rid of the annoying noise of when you click your mouse and you hear a clicking sound in your headphones.

    This happened since I reinstalled Windows XP.

    If you're talking about the click that occurs when browsing in Internet Explorer, see this link:

    http://ask-Leo.com/ies_click_sound_how_do_i_turn_that_off.html

  • Click and drag the work for a few seconds then the work stoppages?

    Hi all

    See this video of drag and drop doesn't work does not in creative suite - YouTube https://youtu.be/QODs8fF84g4 that shows the problem.

    I have the same problem with Indesign, but not with the first where I can drag and drop, drag to prune, drag the elements, clips, etc.

    In photoshop I can click and drag in the layer order resort or to crop an image, etc., but after a few seconds, these functions do not work, and nothing happens at all when you click to drag. Layers are not locked, this happens with any project, no image, no matter if I open the program as an administrator or not. It is a Windows 10 computer and I'm on their beta program, but drag and drop works fine in windows/creation/other applications.

    What this may be? It worked fine a month ago.

    Help much appreciated.

    Select this option.

    The fact that you can't move the floating panels might indicate a problem with the mouse capture. When a mouse down is detected capture us the mouse and drag the user interface as you move the mouse.

    You use all third party tools that interact with the mouse?

    If you hold down the "shift" key when launching Photoshop, you can disable third-party plug-ins 3. You see the problem when you run without 3rd party plug-ins enabled?

    Jesper

  • No preview of the clip when I select the side and drag (as it was in the program monitor) now, it shows that what is in order at this time? How can I disable that (in the way that it used to be)?

    it totally ruins the way I change...

    I put several angles of the camera on the timeline and drag through each one to find the pats I want to reveal in my edit

  • A few questions about the making of the animated for a site Web Nav buttons

    Hello, I have a few questions about creating some animated for a NAV buttons.

    There are 2 actions I want to trigger on pouting above.

    If I want to use a static (PNG) image I created in Photoshop for the real button, can I use that? I want well drag the button down on the passage of the mouse and drag upward on the mouse. If I push the part of the "Web" button (sorry, that it comes from a Photoshop guy) it will disappear in the final animation? Another way to say this, if I put something lively off the coast of the white area, it no longer appears in the movie (.swf) when it is published?

    For the second part. You can see a bit of what I want to do if you look high Nav of the page of the website: http://www.photoshopsupport.com/index.html

    I need the 'light' above the button and it's going to be on another < div > color so I can't put a solid color of BG for my flash document. But I want to get the effect of the 'bar' lighting up above the button and the real key slide downwards to pouting on.

    You can provide any help would be greatly appreciated.

    We target the dynamicaly graph. Since the MouseEvent is now on the invisible sprite and not the graph itself, the one-for-all function has no reference to this graph. You can access the invisible sprite with event.target (or event.currentTarget), you can also target the chart because we declared "mygraphic" custom property to serve as a reference for the graphic. Thus, event.target.mygraphic is the benchmark for graphics.

    Of course, this is just an example. There are other variations of this trick.

    ____________________

    Design Cyboide

    Web site creation

  • I want to create a slider that can rub through an animation...

    .. .but I can't understand how the draggable cursor could be put in place. Does anyone know how this could be achieved? Or are there examples of how this might work?

    The interest of the community sharing codes, here's how I modified the code of Darrell ...

    I had a 4-second animation, which I converted to a symbol named "engine_anim". I also had a horizontal rectangle as the scrub bar, named 'bar' and a handful of scrub, also a rectangle, named "raccoon". The link to code of Darrell is in the link of the Image Slider above. That's how I changed it to what I wanted, which is to rub the back and lather through my animation:

    What follows will in the document.compositionReady Action:

    Drachma var = false;

    $(function () {})

    var washer = sym.$("scrubber");

    var bar = sym.$("bar");

    scrubber. MouseDown (Function () {Drachma = true})

    $(document) .mouseup (function () {Drachma = false})

    {$(document) .mousemove (function (e)}

    {if (Drachma)}

    var possibleX = e.pageX;

    var = bar.offset () .the leftX;

    var rightX = (leftX + bar.width ()) - scrubber.width ();

    var scrubWidth = rightX - leftX;

    limit the width of scrub bar

    If (possibleX< leftx)="">

    possibleX = leftX;

    }

    if(possibleX > rightX) {}

    possibleX = rightX;

    }

    scrubber.offset({)

    left: possibleX

    });

    var possibleX = relativeX - leftX;

    PERC var = Math.ceil ((relativeX/scrubWidth) * 4000); by multiplying the ratio by 4000 milliseconds, the duration of my animation

    sym.getComposition () .getStage ().getSymbol("engine_anim").stop (perc);

    }

    })

    })

  • not by clicking and dragging the mouse

    My mouse pointer responds well to move around the screen and double check etc. However when I try to click and drag he 'loses' of the object (file name or Freecell card) or will not select what I go & drag. All the drivers are up to date. I removed, waited and then replaced the Bluetooth USB mount to the back of the computer and the batteries are charged. Any ideas?

    HP TouchSmart 520-1010ukH

    Mouse Microsoft MG-0982 model

    Windows 7

    Hello @itsmagicvi,

    Welcome to the HP Forums, I hope you enjoy your experience! To help you get the most out of the Forums of HP, I would like to draw your attention to the Guide of the Forums HP first time here? Learn how to publish and more.

    I understand that you are having problems with your Microsoft Mouse on your home PC HP TouchSmart 520-1085uk not allowing you click and drag or use drag to select. I'd be happy to help you, but first of all, I encourage you to post what operating system you are using. And if your 32-bit OS or 64 bits like this that I can give you accurate information.

    Operating system Windows am I running?
    Is the Version of Windows on my computer 32-bit or 64-bit?

    Another thing you can try is the mouse on another computer to see if you encounter the same problem or if you are unable to do this test using a different mouse on your computer to see if the problem repeats.

    Will you please re-post with the information requested and I would be happy to provide assistance. Thanks for posting on the HP Forums. Have a great day!

  • When I choose my quick selection tool, I click and drag the first time, and he adds (my selection). BUT if I let go of the mouse button and try to select more it goes to Negative (-) and removes all selections I made and won't allow me not one

    When I choose my quick selection tool, I click and drag the first time, and he adds (my selection). BUT if I let go the mouse button and try to select it goes to Negative (-) and removes all the selections I made and not will not let me add again. I never had this problem before, you usually need to hold down the Alt (or Option MAC) to subtract from selections. No one knows what happened or how to fix this problem, maybe a setting I accidentally hit? Thanks for your suggestions! :))

    Look at the options of quick selection - particularly the four icons on the left.

  • Does anyone know why illustrator did several objects when I click and drag? No key keyboard shortcuts; only with the mouse.

    When I make a square for example, click and drag with the mouse, it makes duplicate objects until I release the mouse click. How can I disable this feature? Thank you.

    Danopoly,

    How can I disable this feature?

    By unstucking the Tilde (~) key.
  • How to code a click and drag forward/backward in the timeline

    I'm working on a project, the goal is to have a .swf as thisanimation.

    The feature I'm looking for is:

    1. I need my animated film to make a complete rotation and stop,

    and then

    2. I need to fix my AS3 so you HOLD/CLICK/DRAG to progress forward and backward through the timeline, but only when your now the mouse button down.

    Currently, the code progresses the frame forward and backward position mouseX.

    Here is my current code:

    import flash.events.MouseEvent;

    var startPosition:Number = mouseX;

    var delayTime = 10;

    gotoAndStop (1);

    stage.addEventListener (MouseEvent.MOUSE_MOVE, onMouse);

    function onMouse(e:MouseEvent):void {}

    stage.removeEventListener (MouseEvent.MOUSE_MOVE, onMouse);

    var currentPosition:Number = mouseX;

    If (mouseX-startPosition < = 0) {}

    nextFrame();

    } else {}

    prevFrame();

    }

    setTimeout (setListener, delayTime);

    }

    function setListener() {}

    startPosition = mouseX;

    stage.addEventListener (MouseEvent.MOUSE_MOVE, onMouse);

    }

    any help would be appreciated,

    Thank you.

    Found a thread a little like the one that has solved all my problems

    Here is the link for all those who might be pulling their hair trying to figure this out in the future

    http://forums.Adobe.com/thread/570903?TSTART=0

    Thank you Adobe Forums

  • What happened to the feature to get around on the artboard by pressing the space bar and dragging with the mouse?

    What happened to the feature to get around on the artboard by pressing the space bar and dragging with the mouse?

    cwalker,

    If it does not, it may be time for the list:

    Sometimes, (some) things may fail or stop working for no apparent reason. When (other) possible reasons/remedies do not work, it is perhaps a kind corruption (temporary or permanent), or even preference settings which disturbs, which can be cured with something on the following list put in place in order to provide a catch-all solution for otherwise intractable cases. It starts with a few easy suggestions and safe) 1 and 2) for cases less serious and goes two ways 3) and 4) to reset the default preferences (easily but irreversibly and more laboriously but more completely and also reversible), then follows a list 5) various other possibilities, and it ends with a complete reinstallation 6). If no other suggestion doesn't work, or if no other suggestion appears, you can start on the list and decide how to go or who can apply.

    The following is a general list of things, try when

    (A) the question is not in a specific file,

    (B) you have a printer installed, connected and turned on if it's a physical printer (you can use Adobe PDF/Acrobat Distiller as a printer by default without the need to have a printer on, of course you will need to specify when you really need print on paper), and

    (C) It is not caused by problems with opening a file from external media (see below).

    You tried/made some of them already; 1 and 2) are easier for temporary strangenesses and 3) and 4) specifically may be corrupted/inconvenient preferences); ((5) is a list in itself and 6) is the last resort.

    If possible / there is, you must record a current work first, of course.

    (1) close Illy and open again.

    (2) restart the computer (you can make up at least 5 times);

    (3) close Illy and press Ctrl + Alt + Shift / Cmd + Option + shift during startup (easy, but irreversible);

    4) move the folder (follow the link with this name) with closed Illy (more tedious but also more thorough and reversible), for CS3 - CC you can find the file here:

    https://helpx.Adobe.com/Illustrator/KB/preference-file-location-Illustrator.html

    5 look through and try the relevant among the other options (click on the link with that name, item 7) is a list of the usual suspects among other applications which can disturb and confuse Illy, point 15) applies to the maybe CS5, CS6 and CC);

    Even worse, you can:

    6 (A) uninstall (check the box to delete the preferences, if any), B) run the cleanup tool (if you have CS3/CS4/CS5/CS6/CC) and C) reinstall. It is important to use this step three way: otherwise, things may persist.

    http://www.Adobe.com/support/contact/cscleanertool.html

  • Click and drag to control the frame advance

    I have a layer that contains a video clip instance named wwr_mc, who has 19 frames. I figured out how to script, a function of turning constantly move from one image to the other by rolling on the prev or next buttons, using this code:

    wwr_mc.gotoAndStop (10);

    var t:Timer = new Timer (250.0);
    var dir:int;

    t.addEventListener (TimerEvent.TIMER, onNextFrame);

    next_btn.addEventListener (MouseEvent.ROLL_OVER, Right);
    next_btn.addEventListener (MouseEvent.ROLL_OUT, stopIF);
    function right(e:MouseEvent): void {}
    dir = - 1;
    t.Start ();
    wwr_mc.nextFrame ();
    }
    prev_btn.addEventListener (MouseEvent.ROLL_OVER, Left);
    prev_btn.addEventListener (MouseEvent.ROLL_OUT, stopIF);
    function left(e:MouseEvent): void {}
    dir = + 1;
    t.Start ();
    wwr_mc.prevFrame ();
    }
    function stopIF(e:Event): void {}
    t.Stop ();
    }
    function onNextFrame(e:TimerEvent): void {}
    wwr_mc.gotoAndStop (wwr_mc.currentFrame + dir);

    }

    This type of navigation, although functional, isn't really codusive what I am trying to accomplish. I would like to be able to click and drag the mouse and have the frameworks to advance forward or backward according to the direction of movement of the mouse.

    I tried to use the MOUSE_Move event with very limited success.

    Any suggestions would be helpful!

    Thank you!

    I don't see anything through this link that I can relate to this announcement.

    If you want to change managers only based on orientation (x) that the mouse is moved, then you need to test the current position of the mouse to the last known position...

    var startPosition:Number = mouseX;

    wwr_mc.gotoAndStop (10);

    stage.addEventListener (MouseEvent.MOUSE_MOVE, onMouse);

    function onMouse(e:MouseEvent): void {}
    If (mouseX-startPosition > = 0) {}
    wwr_mc.nextFrame ();
    } else {}
    wwr_mc.prevFrame ();
    }
    startPosition = mouseX;
    }

    I don't know what you find as being too fast.  When you do things from an event extended, such as a mouse moved for a while, then it is likely that the event runs the event handler function several times... as fast as the rate of the file allows it.  So if you want more control over the speed at which function nextFrame/prevFrame to mouse moves effect calls, then you must build in some form of delay.  In the example below, it takes the form to remove the mouse event listener move for a short period using a synchronization function (setTimeout in this example, but you can use the Timer class as well)

    var startPosition:Number = mouseX;
    var delayTime = 250; 0.25 s

    wwr_mc.gotoAndStop (10);

    stage.addEventListener (MouseEvent.MOUSE_MOVE, onMouse);

    function onMouse(e:MouseEvent): void {}
    stage.removeEventListener (MouseEvent.MOUSE_MOVE, onMouse);
    var currentPosition:Number = mouseX;
    If (currentPosition-startPosition > = 0) {}
    wwr_mc.nextFrame ();
    } else {}
    wwr_mc.prevFrame ();
    }
    setTimeout (setListener, delayTime);
    }

    function setListener() {}
    startPosition = mouseX;
    stage.addEventListener (MouseEvent.MOUSE_MOVE, onMouse);
    }

  • The task bar is not locked, but he won't move in right or left clicking and dragging.

    original title: taskbar is not locked, but he won't move in right or left clicking and dragging. Tried a different mouse, no results.

    The task bar will not move but not locked.

    Click to the right or left mouse drag, nothing happens.
    Used another mouse, still no movement.

    Hello

    Method 1:

    Try to make an auditor of the system files on your computer and search for errors on the disc: How to use the tool File Checker system to troubleshoot missing or corrupted system files on Windows Vista or Windows 7 http://support.microsoft.com/kb/929833

    Method 2:

    Step 1:

    Start the computer in safe mode and see if the problem occurs. Follow the steps from the link to start in safe mode: http://windows.microsoft.com/en-US/windows7/Start-your-computer-in-safe-mode

    Step 2:

    Start the computer and check to see if this helps: How to troubleshoot a problem by performing a clean Windows Vista or Windows 7 boot http://support.microsoft.com/kb/929135

    Note: when you are finished troubleshooting, follow step 7 to start the computer in normal startup.

    Method 3:

    Step 1:

    Try creating a new user account and check if it works very well: http://windows.microsoft.com/en-us/Windows7/Create-a-user-account

    Step 2:

    If it works fine, then try to move the files and folders from the old account to the new user account user: http://windows.microsoft.com/en-US/Windows7/Fix-a-corrupted-user-profile

  • How to control the Animation of scenario to use the click of the mouse (mouse down)?

    I create an animation on the edge of adobe, I want just to control my animation to use the mouse to click down.

    If push right click reverses early animation, left click on the timeline, if the mouse stops then the animation will stop.

    Please suggest something.

    I suggest you choose a more intuitive way to navigate your timeline.

    The default in browsers mouse events are looking to your left click to event type. If you want to learn more about how the other mouse events are managed in each browser, take a look here:

    Test page for browser mouse event

    Test your mouse events you want in as many browsers that you expect to be supported, because it is possible that not all browsers handle these events of default mouse in the same way. For example, you will need to write your own contextmenu event handler and call it (and also remove context managers integrated each browser), but who would always fire your events, mousedown and mouseout/mouseouthandler() by default when you click on and release the button to right click, so you should also have replace the default behavior on these events as well.

    HTH,

    Joe

Maybe you are looking for