Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list
SOLVED

Referencing a script object in another script object

Avatar

Level 3

Can I reference another script object in a script object? All script objects would be under the same Variables hierarchy.

I have a dropdown field.

In the 'exit' event, the first reference:

DropExit.Exit1(this);

In the DropExit script object:

function Exit1(current)

{

if(Drop.rawValue =="1")

{Color1.presence = "visible";} else {Color1.presence = "invisible";}

if(Drop.rawValue =="2")

{Color2.presence = "visible";} else {Color2.presence = "invisible";}

}

No problems!

But, I would like to do something like this:

function Exit1(current)

{

If(Drop.rawValue == "1")

Selection.S1(this);

If(Drop.rawValue == "2")

Selection.S2(this);

}

then I would have another script object,

Selection script object:

function S1(current)

{

{Color1.presence = "visible";} else {Color1.presence = "invisible";}

{

function S2(current)

{

{Color2.presence = "visible";} else {Color2.presence = "invisible";}

}

in my little mind, this seems like it would work... is it possible?

Thank you in advance!

1 Accepted Solution

Avatar

Correct answer by
Level 7

I would think if you have multiple script objects you might need to be more specific with it's reference.

For Example:

1525502_pastedImage_1.png

If i was working in my script object vars but wanted to access my function in moreVars, it would be referenced like this:

moreVars.profileCount();

I dont know if thats what you were after.

View solution in original post

3 Replies

Avatar

Correct answer by
Level 7

I would think if you have multiple script objects you might need to be more specific with it's reference.

For Example:

1525502_pastedImage_1.png

If i was working in my script object vars but wanted to access my function in moreVars, it would be referenced like this:

moreVars.profileCount();

I dont know if thats what you were after.

The ultimate experience is back.

Join us in Vegas to build skills, learn from the world's top brands, and be inspired.

Register Now