0

I have looked at questions like this, this, this and this, but none of these seem to describe my problem?

I am declaring these variables:

<fx:Script>
    <![CDATA[
        import assets.Page;
        public var oneTwo:Page = new Page("...");
        public var oneThree:Page = new Page("...");
        protected var oneFour:Page = new Page("...");
        protected var oneFive:Page = new Page("...");
        protected var oneSix:Page = new Page("...");

... are referencing objects that do exist, and Flex is okay with the constructors of each of these items. Next, I try to set other properties of these objects:

        oneThree.next = oneFour;
        oneThree.prev = oneTwo;
        oneFour.next = oneFive;
        oneFour.prev = oneThree;
        oneFive.next = oneSix;
        oneFive.prev = oneFour;

etc. Now, when I click each of these, Flex highlights the variable in each instance, and recognizes all of them as valid during coding. But compilation gives:

-1120: Access of undefined property oneThree.
-1120: Access of undefined property oneFour.
-1120: Access of undefined property oneFour.
-1120: Access of undefined property oneFive.

and so on, one for each time each variable is used (so twelve times in the case here). You can see I made some public and some protected, this does not seem to make a difference.

1 Answer 1

0

[This][1] question led me to the solution.

The variables in the second code block need to be edited within their own function, getting:

<fx:Script>
    <![CDATA[
        import assets.Page;
        public var oneTwo:Page = new Page("...");
        public var oneThree:Page = new Page("...");
        protected var oneFour:Page = new Page("...");
        protected var oneFive:Page = new Page("...");
        protected var oneSix:Page = new Page("...");

        oneThree.next = oneFour;
        oneThree.prev = oneTwo;
        oneFour.next = oneFive;
        oneFour.prev = oneThree;
        oneFive.next = oneSix;
        oneFive.prev = oneFour;
    ]]>
</fx:Script>

instead of this:

<fx:Script>
    <![CDATA[
        import assets.Page;
        public var oneTwo:Page = new Page("...");
        public var oneThree:Page = new Page("...");
        protected var oneFour:Page = new Page("...");
        protected var oneFive:Page = new Page("...");
        protected var oneSix:Page = new Page("...");

        protected function _init():void
        {
            oneThree.next = oneFour;
            oneThree.prev = oneTwo;
            oneFour.next = oneFive;
            oneFour.prev = oneThree;
            oneFive.next = oneSix;
            oneFive.prev = oneFour;
        }
    ]]>
</fx:Script>

that took care of the errors for me. Hope this helps someone else!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.