vendredi 3 février 2017

Why can't a computed property be accessed as namespace?

I've found an issue in AS3 namespace indexing nearly a month ago, but got no help so far. This is just for research.

First, my test:

package  {

    import flash.display.MovieClip;

    public class main extends MovieClip {

        /* Namespace definition */
        protected namespace Demo;
        Demo const AMOUNT = 0;

        public function main() {

            /* Put the namespace inside a property */
            const obj = {
                Demo: Demo

            /* Now namespace-index this property */
            /* The following fails: obj.Demo::AMOUNT,
             * it's aproximately obj::AMOUNT */


It works as expected, outputing 0. But when I want to compute the get resolver obj.Demo, it throws an error (it's not English, but: 1043: Espacio de nombres no definido), or Namespace not defined:


I'd like to know the reason (and obj['Demo']::AMOUNT results in a syntax error).

Aucun commentaire:

Enregistrer un commentaire