How to run Saola's action directly from console

Hi,
I’m wondering, is it possible to run Saola’s action directly from the browser’s console? For example, I want to show/hide an element from the console. If possible, how can I do it?

Thanks.

Yes, you can use AtomiSaola.topDocs[0] to get the main document and call other APIs from this document object.

var doc = AtomiSaola.topDocs[0];
var element = doc.getElement('element name') ;

Regards

Hi,
Sorry for the late response. I was just able to try this today and this is working. Thank you.
However, I have another question related to this matter:

How can I use this code, but from a package rather than the browser’s console?

What I want to do is to combine Adobe Animate HTML5 with Saola. What I’ve done so far is to create a simple Adobe Animate HTML5 project and then publish it to a folder which then is imported to Saola as HTML Widget. Inside the Adobe Animate project, I wrote the line of code that you give to manipulate an element created in Saola. But then I get an error, stating that topDocs is not recognized. I also tried to console.log the AtomiSaola, but it was unrecognized.

So, is there a way to this use case? It’s okay if there’s none. I’m simply trying things out in Saola.

Regards

Hi,

An HTML Widget embeds the content in a child frame, so in the embedded content (Adobe Animate in your case) you need to get AtomiSaola object from its parent frame:

// get Saola Animate document from embedded content in an HTML Widget
var doc = window.parent.AtomiSaola.topDocs[0];

Regards

Works like a charm. Thank you for your help. Awesome app!

Hi,
Curiosity got me, and now I have another question regarding this.

Seeing that it’s possible to get a Saola document from an HTML Widget, is it possible for the opposite? Using the previous case, is it possible for me to get the Adobe Animate HTML5 document from Saola?

To get Adobe Animate HTML5 document itself, we can use:

// Turn myElement to invisible
window.parent.stage.children[0].myElement.visible = false;

written directly to the browser’s console. But turns out this is only working if the HTML page is “directly” created from Adobe Animate HTML5.

Regards

Hi,

You can get the embedded window in an HTML Widget, and use it to access your embedded content APIs:

// get JavaScript window and document object of the content in an HTML Widget
var frameNode = doc.getElement('your HTML Widget name').embeddedDom;
var embeddedWindow = frameNode.contentWindow;
var embeddedDocument = frameNode.contentDocument;

// call the embedded API from embeddedWindow, e.g.
 embeddedWindow.stage.children[0].myElement.visible = false;

Regards

Works like magic! Once again, thank you, and have a nice day!

1 Like