[Scripting] Help on passing variables (to switch to specific Scene) by checking them using Timeline Actions


#1

Hello.

I’m working on a a multiple scene website that has an intro animation per scene and reverses the animation when the user clicks on a link and then go to the new scene. In Flash, before, usually, I’d declare a bunch of global variables that I pass around and then “checked” using the actions in timeline keyframes.

I uploaded a sample file here Help Passing Variables.zip (30.5 KB)

Basically I wanted to do these things:

  1. Declare Global Variables (fnDeclareGlobalVariables() I dont even know if you can declare global variables in hype) in the “On Load” so that persistent symbols can reference to it.

  1. Play the Intro animation and pause it at the end so that user interaction can happen.

  1. Now I have this rectangle thing that can be clicked after the animation stops. In its actions, I did 2 things: I called a function (fnSetNextScene() to go to “Scene 2” and then I reversed the animation.

  1. The animation reverses and the timeline marker goes to Frame 1 (i hope). With the variable passed by the rectangle (“Scene 2” in the fnSetNextScene() function). Now frame 1 has this function called fnSceneListener() that listens to changes in the varNextScene variable set cough globally cough

What I wanted to do is for this function to check which Scene the user clicked. In this case “Scene 2” after which the page then moves to Scene 2.

Can anyone help me out?

Sorry for this long post. My problem with Tumult Hype Pro is that it just like to call functions but not pass any parameters on it. I want to be able to do reusable functions that are declared globally and can be used anywhere in the site.

Please help out.

Thanks

*Edit: I saw a suggestion to use classes. I’m not good in coding is there a tutorial how to do that?
*Edit: I also saw a hype extensions… how do I do this? can anyone point me to a tutorial?


Pass parameters to function / Reduce need for multiple functions
(Hans-Gerd Claßen) #2

Help Passing Variables.hype.zip (21.6 KB)


#4

Super thanks for this. This is actually the best way for me to visually pass variables as parameters in a function without having to code everything. Thanks so much @h_classen for this! You’re a Hype God.


#5

@noct.co

Now that You mention it we really need an additional “badge” here on the Forum - “Hype God”. :+1:

There are a few members who really light up the Forum with their amazing contributions (JavaScript in particular) and without whom this Forum would not be so nearly an illuminating place of learning.

@h_classen @DBear @MarkHunte - Thank You for all the time You have devoted sharing your knowledge and insights!


(Mark Hunte) #6

Lol,

I am sure if it existed, you would have earned it to @JimScott :wink: