Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: HELP: Global functions in Adobe Edge  (Read 1228 times)

Enzo

  • Bay Watcher
    • View Profile
HELP: Global functions in Adobe Edge
« on: March 24, 2013, 05:19:25 pm »

First of all, my adobe account is having issues accessing the official forums. Also you guys are smart. Hence me posting this here.

Basically, for my final project in a Digital Media class I'm using Adobe Edge to create a simple point and click adventure game. Unfortunately, Edge is a very new program and documentation for more advanced applications in really lacking. I'm got the basic framework of the game mapped out and everything seems to be doable, however I've hit a (rather large) roadblock. I can't seem to create global functions that are recognized properly in my timeline and element events.

My understanding is, if you open the full code you can add your javascript functions to the top you should be able to call them from within your event code. Very simple example, the player is always centered in the screen, movement is achieved by simply hiding all but the appropriate sprite and moving his surroundings around him:

Code: [Select]
function playerWalkR() // hides all player sprites except walk-right animation
{
sym.$("manStandR").hide();
sym.$("manWalkR").show();
sym.$("manStandL").hide();
sym.$("manWalkL").hide();
}

Clearly, this function is so simple that it should obviously do what it's supposed to do. If I add the function directly into the event code it works swimmingly, within that particular event. But the function has to be re-added to every event that uses it. However if I add it to the beginning of the full code I can't call it anywhere, nor can I call functions from one event into another.

Does anybody have ANY experience scripting in Adobe Edge, or enough general Javascript knowledge to pinpoint my error? I'm not all that experienced in Javascript nor am I a natural coder, I know there's got to be some parent-child structure or something Edge uses I'm not addressing, but I can't for the life of me get it to work. One tutorial suggested adding the prefix "Stage_" to any elements your global functions call (as they are all children of the stage element), but that didn't help. It looks like the functions aren't even getting called properly. What do.
« Last Edit: March 24, 2013, 05:28:25 pm by kinseti »
Logged