You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@royale.apache.org by yushiro maeda <ro...@gmail.com> on 2020/08/11 06:56:40 UTC

@externs tutorial I can not work.

Hello

I follow the tutorial below. But the link is bloken and the @externs does
not seem to be recognized well


Uncaght ReferenceError: hljs is not defined


hljs.as is in the same src folder as main.mxml .but do I need anything else?

It would be helpful if you could tell me.

Best regards

Re: @externs tutorial I can not work.

Posted by Carlos Rovira <ca...@apache.org>.
Hi,

the difference you see is that we changed the code generation for externs,
since it was not working for IE11.
So both are valid, but if you want to support IE11 you'll need the newer
version.

Also, I upgrade all examples and blog posts to newer versions,, and added
captures since now examples look a bit
different due to jewel theme upgrades done during this year, so right now
all published should be up to date.
Maybe if you see old code could be due to browser caching

best

Carlos

El lun., 17 ago. 2020 a las 4:47, yushiro maeda (<ro...@gmail.com>)
escribió:

> Hello, Carlos.
>
> Thank you for the update on the example.
>
> I compared it to the file on the site that was uploaded and found a
> difference in index.html
>
> I tried to find out why, but I found out that the sdk we used was different
>
> The following index.html is different between royale0.9.7 and royale0.9.8.
>
> apache-royale-0.9.8 index.html
> --------------------------------
> <!DOCTYPE html>
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>     <meta name="Custom Template for injecting custom style CSS">
>     <meta name="viewport" content="width=device-width, initial-scale=1.0,
> maximum-scale=1.0, user-scalable=no" />
>     <link rel="stylesheet" type="text/css"
> href="Ryale098BrowserProject.min.css">
>     <link href="https://fonts.googleapis.com/css?family=Lato:400,700"
> rel="stylesheet">
> <script type="text/javascript">
>  var script = document.createElement("script");
>  script.setAttribute("src", "
> https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js
> ");
>  document.head.appendChild(script);
>  var link = document.createElement("link");
>  link.setAttribute("rel", "stylesheet");
>  link.setAttribute("title", "Atom One Dark");
>  link.setAttribute("type", "text/css");
>  link.setAttribute("href", "
> https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css
> ");
>  document.head.appendChild(link);
> </script>
> <script type="text/javascript" src="./Ryale098BrowserProject.js"></script>
>
> </head>
> <body>
> <script type="text/javascript">
> new Ryale098BrowserProject().start();
> </script>
>
> </body>
> </html>
>
> apache-royale-0.9.7 index.html
> --------------------------------
> <!DOCTYPE html>
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>     <meta name="Custom Template for injecting custom style CSS">
>     <meta name="viewport" content="width=device-width, initial-scale=1.0,
> maximum-scale=1.0, user-scalable=no" />
>     <link rel="stylesheet" type="text/css"
> href="Royale097BrowserProject.min.css">
>     <link href="https://fonts.googleapis.com/css?family=Lato:400,700"
> rel="stylesheet">
> <script type="text/javascript" src="./Royale097BrowserProject.js"></script>
>
> </head>
> <body>
> <script type="text/javascript">
> new Royale097BrowserProject().start();
> </script>
>
> </body>
> </html>
>
>
>
>
> It seems to work well with royale0.9.8
>
> One question: will this @ externs not work on royale 0.9.7? Or do I need
> to add something?
>
>
> Also, thank you for teaching me about percentWidth and percentHeigh
>
> I always used to write "width="100%", so this time it's smarter and easier
> to understand
>
>
> Thank you all for following along.
>
> 2020年8月11日(火) 18:32 Carlos Rovira <ca...@apache.org>:
>
>> Hi Yushiro,
>>
>> just updated the example:
>> https://royale.apache.org/using-external-javascript-libraries-in-apache-royale/
>>
>> thanks for reporting. Through these months we modified some things like
>> the inject_html directive, so I updated the code accordingly.
>> Also the look and feel of jewel themes change a bit. I updated the
>> running example.
>> Also notice that at that time I used percentWidth/Height instead of the
>> more common width="100%" for example.
>> The link to hljs was referring to the Tour de Jewel example, while this
>> example has its own for demonstration, so now is pointing to the right file
>> in the repository.
>>
>> I think all is fine now.
>>
>> I'll try to update other examples too,
>>
>> El mar., 11 ago. 2020 a las 10:09, yushiro maeda (<ro...@gmail.com>)
>> escribió:
>>
>>> Hello
>>>
>>> The location of the error.
>>>
>>> <j:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>>> xmlns:j="library://ns.apache.org/royale/jewel" xmlns:js="library://
>>> ns.apache.org/royale/basic" xmlns:html="library://
>>> ns.apache.org/royale/html" initialize="codeTextLoader.send();">
>>> <fx:Script> <![CDATA[ [Bindable] public var code_txt:String; public
>>> function highLightContent():void { COMPILE::JS { hljs.highlightBlock(sourceCodeMXMLText.element);
>>> } } ]]> </fx:Script>
>>>
>>> error at the
>>>
>>> hljs.highlightBlock(sourceCodeMXMLText.element)
>>>
>>>
>>> Uncaught ReferenceError: hljs is not defined
>>>
>>>
>>>
>>> Best regards
>>>
>>> 2020年8月11日(火) 午後4:07 Yishay Weiss <yi...@hotmail.com>:
>>>
>>>> Hi Yushiro,
>>>>
>>>>
>>>>
>>>> Can you share your code so we can help you?
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> *From: *yushiro maeda <ro...@gmail.com>
>>>> *Sent: *Tuesday, August 11, 2020 9:56 AM
>>>> *To: *users@royale.apache.org
>>>> *Subject: *@externs tutorial I can not work.
>>>>
>>>>
>>>>
>>>> Hello
>>>>
>>>>
>>>>
>>>> I follow the tutorial below. But the link is bloken and the @externs
>>>> does not seem to be recognized well
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Uncaght ReferenceError: hljs is not defined
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> hljs.as is in the same src folder as main.mxml .but do I need anything
>>>> else?
>>>>
>>>>
>>>>
>>>> It would be helpful if you could tell me.
>>>>
>>>>
>>>>
>>>> Best regards
>>>>
>>>>
>>>>
>>>
>>
>> --
>> Carlos Rovira
>> http://about.me/carlosrovira
>>
>>

-- 
Carlos Rovira
http://about.me/carlosrovira

Re: @externs tutorial I can not work.

Posted by yushiro maeda <ro...@gmail.com>.
Hello, Carlos.

Thank you for the update on the example.

I compared it to the file on the site that was uploaded and found a
difference in index.html

I tried to find out why, but I found out that the sdk we used was different

The following index.html is different between royale0.9.7 and royale0.9.8.

apache-royale-0.9.8 index.html
--------------------------------
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="Custom Template for injecting custom style CSS">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,
maximum-scale=1.0, user-scalable=no" />
    <link rel="stylesheet" type="text/css"
href="Ryale098BrowserProject.min.css">
    <link href="https://fonts.googleapis.com/css?family=Lato:400,700"
rel="stylesheet">
<script type="text/javascript">
 var script = document.createElement("script");
 script.setAttribute("src", "
https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js
");
 document.head.appendChild(script);
 var link = document.createElement("link");
 link.setAttribute("rel", "stylesheet");
 link.setAttribute("title", "Atom One Dark");
 link.setAttribute("type", "text/css");
 link.setAttribute("href", "
https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css
");
 document.head.appendChild(link);
</script>
<script type="text/javascript" src="./Ryale098BrowserProject.js"></script>

</head>
<body>
<script type="text/javascript">
new Ryale098BrowserProject().start();
</script>

</body>
</html>

apache-royale-0.9.7 index.html
--------------------------------
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="Custom Template for injecting custom style CSS">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,
maximum-scale=1.0, user-scalable=no" />
    <link rel="stylesheet" type="text/css"
href="Royale097BrowserProject.min.css">
    <link href="https://fonts.googleapis.com/css?family=Lato:400,700"
rel="stylesheet">
<script type="text/javascript" src="./Royale097BrowserProject.js"></script>

</head>
<body>
<script type="text/javascript">
new Royale097BrowserProject().start();
</script>

</body>
</html>




It seems to work well with royale0.9.8

One question: will this @ externs not work on royale 0.9.7? Or do I need to
add something?


Also, thank you for teaching me about percentWidth and percentHeigh

I always used to write "width="100%", so this time it's smarter and easier
to understand


Thank you all for following along.

2020年8月11日(火) 18:32 Carlos Rovira <ca...@apache.org>:

> Hi Yushiro,
>
> just updated the example:
> https://royale.apache.org/using-external-javascript-libraries-in-apache-royale/
>
> thanks for reporting. Through these months we modified some things like
> the inject_html directive, so I updated the code accordingly.
> Also the look and feel of jewel themes change a bit. I updated the running
> example.
> Also notice that at that time I used percentWidth/Height instead of the
> more common width="100%" for example.
> The link to hljs was referring to the Tour de Jewel example, while this
> example has its own for demonstration, so now is pointing to the right file
> in the repository.
>
> I think all is fine now.
>
> I'll try to update other examples too,
>
> El mar., 11 ago. 2020 a las 10:09, yushiro maeda (<ro...@gmail.com>)
> escribió:
>
>> Hello
>>
>> The location of the error.
>>
>> <j:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>> xmlns:j="library://ns.apache.org/royale/jewel" xmlns:js="library://
>> ns.apache.org/royale/basic" xmlns:html="library://
>> ns.apache.org/royale/html" initialize="codeTextLoader.send();">
>> <fx:Script> <![CDATA[ [Bindable] public var code_txt:String; public
>> function highLightContent():void { COMPILE::JS { hljs.highlightBlock(sourceCodeMXMLText.element);
>> } } ]]> </fx:Script>
>>
>> error at the
>>
>> hljs.highlightBlock(sourceCodeMXMLText.element)
>>
>>
>> Uncaught ReferenceError: hljs is not defined
>>
>>
>>
>> Best regards
>>
>> 2020年8月11日(火) 午後4:07 Yishay Weiss <yi...@hotmail.com>:
>>
>>> Hi Yushiro,
>>>
>>>
>>>
>>> Can you share your code so we can help you?
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *From: *yushiro maeda <ro...@gmail.com>
>>> *Sent: *Tuesday, August 11, 2020 9:56 AM
>>> *To: *users@royale.apache.org
>>> *Subject: *@externs tutorial I can not work.
>>>
>>>
>>>
>>> Hello
>>>
>>>
>>>
>>> I follow the tutorial below. But the link is bloken and the @externs
>>> does not seem to be recognized well
>>>
>>>
>>>
>>>
>>>
>>> Uncaght ReferenceError: hljs is not defined
>>>
>>>
>>>
>>>
>>>
>>> hljs.as is in the same src folder as main.mxml .but do I need anything
>>> else?
>>>
>>>
>>>
>>> It would be helpful if you could tell me.
>>>
>>>
>>>
>>> Best regards
>>>
>>>
>>>
>>
>
> --
> Carlos Rovira
> http://about.me/carlosrovira
>
>

Re: @externs tutorial I can not work.

Posted by Carlos Rovira <ca...@apache.org>.
Hi Yushiro,

just updated the example:
https://royale.apache.org/using-external-javascript-libraries-in-apache-royale/

thanks for reporting. Through these months we modified some things like the
inject_html directive, so I updated the code accordingly.
Also the look and feel of jewel themes change a bit. I updated the running
example.
Also notice that at that time I used percentWidth/Height instead of the
more common width="100%" for example.
The link to hljs was referring to the Tour de Jewel example, while this
example has its own for demonstration, so now is pointing to the right file
in the repository.

I think all is fine now.

I'll try to update other examples too,

El mar., 11 ago. 2020 a las 10:09, yushiro maeda (<ro...@gmail.com>)
escribió:

> Hello
>
> The location of the error.
>
> <j:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
> xmlns:j="library://ns.apache.org/royale/jewel" xmlns:js="library://
> ns.apache.org/royale/basic" xmlns:html="library://
> ns.apache.org/royale/html" initialize="codeTextLoader.send();">
> <fx:Script> <![CDATA[ [Bindable] public var code_txt:String; public
> function highLightContent():void { COMPILE::JS { hljs.highlightBlock(sourceCodeMXMLText.element);
> } } ]]> </fx:Script>
>
> error at the
>
> hljs.highlightBlock(sourceCodeMXMLText.element)
>
>
> Uncaught ReferenceError: hljs is not defined
>
>
>
> Best regards
>
> 2020年8月11日(火) 午後4:07 Yishay Weiss <yi...@hotmail.com>:
>
>> Hi Yushiro,
>>
>>
>>
>> Can you share your code so we can help you?
>>
>>
>>
>>
>>
>>
>>
>> *From: *yushiro maeda <ro...@gmail.com>
>> *Sent: *Tuesday, August 11, 2020 9:56 AM
>> *To: *users@royale.apache.org
>> *Subject: *@externs tutorial I can not work.
>>
>>
>>
>> Hello
>>
>>
>>
>> I follow the tutorial below. But the link is bloken and the @externs does
>> not seem to be recognized well
>>
>>
>>
>>
>>
>> Uncaght ReferenceError: hljs is not defined
>>
>>
>>
>>
>>
>> hljs.as is in the same src folder as main.mxml .but do I need anything
>> else?
>>
>>
>>
>> It would be helpful if you could tell me.
>>
>>
>>
>> Best regards
>>
>>
>>
>

-- 
Carlos Rovira
http://about.me/carlosrovira

Re: @externs tutorial I can not work.

Posted by yushiro maeda <ro...@gmail.com>.
Hello

The location of the error.

<j:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:j="library://
ns.apache.org/royale/jewel" xmlns:js="library://ns.apache.org/royale/basic"
xmlns:html="library://ns.apache.org/royale/html"
initialize="codeTextLoader.send();"> <fx:Script> <![CDATA[ [Bindable]
public var code_txt:String; public function highLightContent():void {
COMPILE::JS { hljs.highlightBlock(sourceCodeMXMLText.element); } } ]]>
</fx:Script>

error at the

hljs.highlightBlock(sourceCodeMXMLText.element)


Uncaught ReferenceError: hljs is not defined



Best regards

2020年8月11日(火) 午後4:07 Yishay Weiss <yi...@hotmail.com>:

> Hi Yushiro,
>
>
>
> Can you share your code so we can help you?
>
>
>
>
>
>
>
> *From: *yushiro maeda <ro...@gmail.com>
> *Sent: *Tuesday, August 11, 2020 9:56 AM
> *To: *users@royale.apache.org
> *Subject: *@externs tutorial I can not work.
>
>
>
> Hello
>
>
>
> I follow the tutorial below. But the link is bloken and the @externs does
> not seem to be recognized well
>
>
>
>
>
> Uncaght ReferenceError: hljs is not defined
>
>
>
>
>
> hljs.as is in the same src folder as main.mxml .but do I need anything
> else?
>
>
>
> It would be helpful if you could tell me.
>
>
>
> Best regards
>
>
>

Re: @externs tutorial I can not work.

Posted by yushiro maeda <ro...@gmail.com>.
Hi

Thank you for your reply.

The code is the same as the following link.

https://github.com/apache/royale-asjs/tree/develop/examples/blog/BE0012_Using_external_javascript_libraries_in_Apache_Royale

In
https://royale.apache.org/using-external-javascript-libraries-in-apache-royale/


The difference is that the folder configuration is different because it was
 newly created in moonshineIDE.

For the following

src
     - hljs.as
     - BE0012_Using_external....mxml


js-debug
      as3code.txt
      BE0012_Using_external...css
      BE0012_Using_external....js
      BE0012_Using_external....js.map
      hljs.js
      hljs.js.map
      index.html


Best regards


2020年8月11日(火) 午後4:07 Yishay Weiss <yi...@hotmail.com>:

> Hi Yushiro,
>
>
>
> Can you share your code so we can help you?
>
>
>
>
>
>
>
> *From: *yushiro maeda <ro...@gmail.com>
> *Sent: *Tuesday, August 11, 2020 9:56 AM
> *To: *users@royale.apache.org
> *Subject: *@externs tutorial I can not work.
>
>
>
> Hello
>
>
>
> I follow the tutorial below. But the link is bloken and the @externs does
> not seem to be recognized well
>
>
>
>
>
> Uncaght ReferenceError: hljs is not defined
>
>
>
>
>
> hljs.as is in the same src folder as main.mxml .but do I need anything
> else?
>
>
>
> It would be helpful if you could tell me.
>
>
>
> Best regards
>
>
>

RE: @externs tutorial I can not work.

Posted by Yishay Weiss <yi...@hotmail.com>.
Hi Yushiro,

Can you share your code so we can help you?



From: yushiro maeda<ma...@gmail.com>
Sent: Tuesday, August 11, 2020 9:56 AM
To: users@royale.apache.org<ma...@royale.apache.org>
Subject: @externs tutorial I can not work.

Hello

I follow the tutorial below. But the link is bloken and the @externs does not seem to be recognized well


Uncaght ReferenceError: hljs is not defined


hljs.as<http://hljs.as> is in the same src folder as main.mxml .but do I need anything else?

It would be helpful if you could tell me.

Best regards