Controlling the Position of an Element with Java


(Robert) #1

Is there a way of changing an elements co-ordibation with Java. I would like to move a graphic up or down when I click on a button. I’m trying to do this on a single frame and I don’t want to move along the timeline.

I can see the scripts for finding the co ordinations of a element, but nothing on controlling it.

Sorry if this is an obvious question, but I’m very new and probably still thinking in Flash mythologies.


(𝕄𝕚𝕔𝕙𝕒𝕖𝕝 𝔾𝕒𝕣𝕠𝕗𝕒𝕝𝕠) #2

First, it’s JavaScript. (Java is a different programming language.)

You have lots of possible solutions here. You might not need to create custom JavaScript. Instead, you could use a bunch of options…

Relative starting point - when an element is clicked, a timeline is played and then that actor moves to a specific point.

Multiple Timelines - Basically, you can have more than one timeline, so two sets of animation can be independent of each other.

Symbol - This is basically a self-contained timeline, which can have its own set of animations.

If you want to use JavaScript, then the Get / Set API is probably what you’re looking for. You can “get” an element’s top/left location and then “set” a new value.


(Fernando) #3

I have not understood very well. But I think you do not need Jasscript for that. Watch this template with attention to the inspector of actions of the elements “U” and “D”.
controlofelement.hype.zip (16.7 KB)


(Robert) #4

Thank you to both of you. What I had in mind was a simple javascript line that could be used to re-position an element without having to leave the frame on the timeline. In the end I followed Michael’s lead and used a symbol within a symbol. It’s probably not the most elegant way of doing it - but it seems to work!
Film_Menu.hype.zip (78.6 KB)