-
1. Re: Including javascript dependencies issues in EB2.1
mlavie Oct 30, 2014 3:10 AM (in response to Loic_aigon)Hi Loic,
Did you ever get this solved? How?
Regards,
mlavie
-
2. Re: Including javascript dependencies issues in EB2.1
Loic_aigon Oct 30, 2014 3:37 AM (in response to mlavie)Hi MLavie,
Yeah I did it working thanks to Martinho. Fact is you cannot use dependencies with a clear code. You have to compile it in JSXBIN, then eval this code:
Source JSX File
function toto();
Binary
@2.0UUYAUAYUYZAUYUYUYUYUY…
JSX to call
eval('@2.0UUYAUAYUYZAUYUYUYUYUY…');
From AS3
JSX.toto();
I wish we could have keep the whole thing open but nothing to expect now Seems like the HTML5 extensibility will allow this kind of stuff
-
3. Re: Re: Including javascript dependencies issues in EB2.1
mlavie Oct 30, 2014 5:56 AM (in response to Loic_aigon)Hi Loic,
Thanks for the quick response. However, I don't think I understood the answer. My situation is as follows:
I have an embedded JSX: JSX1.jsx, whose contents are:
function action1()
{
action2();
}
The definition for action2() is found in JSX file JSX2.jsx, located in the /src dir, whose contents are:
function action2()
{
alert('I am action2','title',false);
}
In my ActionScript, I call action1() as follows:
[Embed(source="JSX1.jsx", mimeType= "application/octet-stream" )]
private static var _jsx1ProxyClass:Class;
private static var _jsx1Interface:HostObject;public function performJsx()
{
_jsx1Interface = HostObject.getRoot(HostObject.extensions[0]);
_jsx1Interface.eval(new _jsx1ProxyClass().toString());_jsx1Interface.action1();
}
Could you please explain step-by-step what to do?
- Which of the 2 files (or both) are converted to JSXBIN?
- In which folder should they be placed in the ExtensionBuilder project's folder tree? /src? Does it matter?
- What changes (if any) need to be made in my ActionScript, JSX1.jsx or JSX2.jsx source code so that my JSX1.jsx "sees" JSX2.jsx?
Thank you for your time!
mlavie
-
4. Re: Re: Including javascript dependencies issues in EB2.1
Loic_aigon Oct 30, 2014 7:01 AM (in response to mlavie)Hi MLavie,
Given your scripts within the src folder :
Source Main Code : JSX1.jsx
#include "JSX2.jsx"
function action1() {
action2();
}
Now you need a third script JSX_BIN.jsx
but first compile as binary your JSX1.jsx script.
Once that done copy/paste the jsxbin string
eval(your JSX1.jsx script as binary goes here);
Then you embed the JSX_BIN.jsx script.
[Embed(source="JSX_BIN.jsx", mimeType= "application/octet-stream" )]
private static var _jsx1ProxyClass:Class;
private static var _jsx1Interface:HostObject;
And call it as you did :
public function performJsx()
{
_jsx1Interface = HostObject.getRoot(HostObject.extensions[0]);
_jsx1Interface.eval(new _jsx1ProxyClass().toString());_jsx1Interface.action1();
}
And yes, as many changes you do in the source JSX1 file, you need to recompile and copy/paste in the JSX_BIN.jsx script.
Hope that helps,
Loic

