This is an automated email from the ASF dual-hosted git repository.
carlosrovira pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/royale-docs.git
The following commit(s) were added to refs/heads/master by this push:
new d8ff47a more updates to some pages, some still WIP
d8ff47a is described below
commit d8ff47a6d50fc26b2ddfab7c1034f903feacf8b5
Author: Carlos Rovira <[email protected]>
AuthorDate: Sat Aug 24 13:24:06 2019 +0200
more updates to some pages, some still WIP
---
welcome/features-and-concepts.md | 12 +++++-------
welcome/features/external-interface.md | 26 +++++++++++++++++---------
2 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/welcome/features-and-concepts.md b/welcome/features-and-concepts.md
index fe1eae3..4d2f897 100644
--- a/welcome/features-and-concepts.md
+++ b/welcome/features-and-concepts.md
@@ -20,23 +20,21 @@ title: Features and Concepts
# Features and Concepts
-Key points to learn
+Key points to learn Royale
Here are some things you may need to know to help you be more productive with
Royale, although some folks get pretty far by just following the tutorial in
[Create an Application](create-an-Application.html) and extending it.
-## Languages
+## AS3 and MXML Languages
-Royale uses both a declarative markup language called
[MXML](welcome/features/mxml.html) and a scripting language called
[ActionScript](welcome/features/as3.html) that is like JavaScript, but with
classes and interfaces and types. This allows you to more efficiently declare
the static portions of your application and write up the dynamic portions in a
language where the compiler can catch more errors sooner.
+Royale uses both a declarative markup language called
[MXML](welcome/features/mxml.html) and a scripting language called
[ActionScript](welcome/features/as3.html) that is like JavaScript, but with
classes, interfaces and types. This allows you to more efficiently declare the
static portions of your application and write up the dynamic portions in a
language where the compiler can catch more errors sooner.
## Pay as you go (PAYG)
-Royale provides a variety of [component
sets](./user-interface/components.html), each tuned towards different
applications requirements. The easiest one to learn and use is the Express
component set. It is designed for rapid-prototyping and proof-of-concept
development. You can often take code using Express into production, but because
Express components are designed to be customized in MXML, as your application
grows in size, you may find yourself wishing for smaller, faster components.
-
-Royale also provides a Basic component set that is the opposite of Express.
The components are small and fast, but don't have lots of built-in
customization options. This is because Basic components are designed with a
["Pay as you go"](welcome/features/payg.html) philosophy. Only the most common
functionality is built into the component, and other options are added as
plugins called Beads. You can [read more about PAYG
here](welcome/features/payg.html).
+Royale provides a variety of [component
sets](./user-interface/components.html), each tuned towards different
applications requirements. Components are designed with a ["Pay as you
go"](welcome/features/payg.html) philosophy. Only the most common functionality
is built into the component, and other options are added as plugins called
Beads. Components designed this way use to be small and fast, and don't have
lots of built-in customization options that will never use most of the times. Y
[...]
## Strands and Beads
-It turns out that the Express components are really just Basic components with
lots of Beads packed into them by default. The underlying component patterns
in most Royale components rely on a plug-in model. Instead of making large
component classes with lots of code baked in, each individual feature of a
component is designed as its own class with an interface marking it as a
"Bead", and then the component itself is called a "Strand" and Beads are placed
on the Strand to compose a Roya [...]
+The underlying component patterns in most Royale components rely on a plug-in
model. Instead of making large component classes with lots of code baked in,
each individual feature of a component is designed as its own class with an
interface marking it as a "Bead", and then the component itself is called a
"Strand" and Beads are placed on the Strand to compose a Royale component. You
can [read more about Strands and Beads
here](welcome/features/strands-and-beads.html).
## Calling to/from external JavaScript code
diff --git a/welcome/features/external-interface.md
b/welcome/features/external-interface.md
index fe6c710..d7babe4 100644
--- a/welcome/features/external-interface.md
+++ b/welcome/features/external-interface.md
@@ -20,40 +20,47 @@ title: Calling to/from External JavaScript
# Calling to/from External JavaScript
-In Flash, there is a class,
-<A
HREF="https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html"
target="_blank">ExternalInterface</A>,
+
+
+In Flash, there is a class,
[ExternalInterface](https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html){:target='_blank'},
that lets your Flex (or Flash) application call other JavaScript code that has
been embedded on the hosting web page,
and lets external JavaScript code call a function within the Flex application.
When you port a Flex application to Royale,
you may need to replicate this functionality.
-To make this easier, there is an implementation of the same API available as
-<A
HREF="https://github.com/apache/royale-asjs/blob/developframeworks/projects/MXRoyale/src/main/royale/mx/external/ExternalInterface.as"
target="_blank">mx.external.ExternalInterface</A>.
+To make this easier, there is an implementation of the same API available as
[mx.external.ExternalInterface](https://github.com/apache/royale-asjs/blob/developframeworks/projects/MXRoyale/src/main/royale/mx/external/ExternalInterface.as){:target='_blank'}.
You should be able to just rename your imports from
`flash.external.ExternalInterface` to `mx.external.ExternalInterface`.
For new code, it would be preferable to create an ActionScript wrapper API
into the required JavaScript.
This allows you to define a typed interface and the compiler would then pick
up any issues around incompatible types
or incorrectly spelled function names. This could allow a line such as:
-```
+
+```as3
ExternalInterface.call("MyFunction", "value", 123);
```
+
to be replaced by
-```
+
+```as3
MyJSInterface.MyFunction("value", 123);
```
+
ensuring that you haven't misspelled "MyFunction" and that the function is
being passed the correct number and types of arguments.
The implementation of your API wrapper class is where you would call the
JavaScript functionality directly, which could be simply via reflection:
-```
+
+```as3
public static function MyFunction(param : String, val : uint) : void
{
window["myFunction"](param, val);
}
```
+
It should be possible to make the call to `myFunction` directly, but we may
need asdoc decoration to avoid the 'unknown function' error.
For JavaScript to call into a Royale application, we need a listener or
callback of some kind to be set up from the Royale application
(particularly if we want to have some context retained). This can be an
extension of our existing class, `MyJSInterface`, where we register the
callback:
-```
+
+```as3
public static function RegisterCallback(fncName : String, fncClosure :
Function) : void
{
MyJSInterface[fncName] = fncClosure;
@@ -63,7 +70,8 @@ When we add our callback (e.g.
`MyJSInterface.RegisterCallback("testFunction", T
the Royale compiler creates a method closure that contains the context from
where this registration call is made. This lets you access variables -
particularly the "this" variable - within the TestFunc method during the
callback.
The JavaScript code then can access this via the Royale-generated JavaScript
for MyJSInterface:
-```
+
+```as3
MyJSInterface.testFunction("This will be passed to TestFunc");
```