HELP!My symbol stop action when the scene is dragged

I made a perpetual rotate symbol, and found it stop rotate at some conditions,

SCENE ONE

Rotate symbol is normal at first, I drag the scene, rotation stopped after 1 circle

SCENE TWO

Just one click on PLAY, everything goes well. Then I click PAUSE, the symbol still rotating, I PLAY again, rotate stopped!!

Does anybody help me please?

symbol stop.zip (30.3 KB)

@iamwanming

Hype Project Demo: symbol stop JHSv1.hype.zip (29.0 KB)

There are two separate solutions in this Demo - one for each scene…


"drag" scene


A drag action overrides a timeline action applied to an element - in this case the “Rotate” symbol with the “Rotate Angle (Z)” timeline property, and so the rotation stops as soon as the symbol is dragged.

One way around this situation is to use a JavaScript function. In this Demo I wrote a function called rotateSymbol() - applied to the “On Symbol Load” action for the “Rotate” symbol:

As soon as this symbol loads it begins to rotate - AND - dragging the symbol does not cancel the playing of the “Rotate” symbol’s “Main Timeline”.

Note: The “Rotate” symbol has been given the unique ID of “rotateMe” which is stored in the variable (var) “rotateSymb”. A unique ID for an element is created in the “Identity Inspector” panel.

The script for the function rotateSymbol():

var rotateSymb = hypeDocument.getSymbolInstanceById('rotateMe');
rotateSymb.startTimelineNamed('Main Timeline', hypeDocument.kDirectionForward);

"click" scene


A different approach for this scene - we are going to use a “Custom Behavior” (more about “Custom Behaviors” here - which are a “Hype Pro” only feature).

The following custom behavior (“ContinueSymbolRotate”) was created in the “Symbol Inspector” - which appears when a symbol is entered (opened) in Hype’s interface. I created “ContinueSymbolRotate” in the “click” scene’s “Rotate” symbol:


This custom behavior is triggered in the "click" scene by the "Play" button's "On Mouse Click" handler in the "Actions Inspector":

1 Like