This is an automated email from the ASF dual-hosted git repository. harbs pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/royale-docs.git
commit 9e23624a8f5cd79bae43f139ac379b41407a89dc Author: Harbs <[email protected]> AuthorDate: Thu Dec 16 16:55:40 2021 +0200 Added language-basics --- _data/toc.json | 3 ++ features/as3/language-basics.md | 66 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/_data/toc.json b/_data/toc.json index e907358..ec39a76 100644 --- a/_data/toc.json +++ b/_data/toc.json @@ -50,6 +50,9 @@ "path": "features/as3.md", "children": [ { + "path": "features/as3/language-basics.md" + }, + { "path": "features/as3/packages.md" }, { diff --git a/features/as3/language-basics.md b/features/as3/language-basics.md new file mode 100644 index 0000000..a1951fe --- /dev/null +++ b/features/as3/language-basics.md @@ -0,0 +1,66 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +layout: docpage +title: Language Basics +description: Language basics in ActionScript 3 +permalink: /features/as3/language-basics +--- + +# Language Basics + +Language basics in ActionScript 3 + +## Scope + +There are four levels of access scope in ActionScript: +1. public +2. private +3. protected +4. internal + +These are defined by declaring an access modifier before a declaration. + +More details to fill in... + +## Accessor Types +There are three basic accessor types in ActionScript +1. function +2. var +3. const + +ActionScript does not support arrow functions or `let`. The use of the three accessor types are similar to Javascript. + +## Instance and Class Accessors +By default any accessors of a class are instance accessors. For class-level methods, vars and const, you need to add the `static` modifier. The order of the modifiers do not matter, so `public static var` is the same as `static public var`. + +Class accessors are not inherited by their subclasses. + +Instance and class accessors must have unique names, so you cannot have both `public var foo` and `public static var foo`. + +## Primitive Types +TODO + +## XML Types +TODO + +## Vector Types +TODO + +## Type Casting +There's two ways to do type casting: `Foo(myInstance)` and `fooInstance as Foo`. There is a noteworthy difference between these two: `Foo(myInstance)` will throw an error if th type cannot be cast, while `fooInstance as Foo` will assign `null` if it cannot be cast without throwing an error. Runtime type checking can be turned off in the compiler. (add details) + +TODO what else belongs here? \ No newline at end of file
