robotlegs / robotlegs-framework

An ActionScript 3 application framework for Flash and Flex
https://robotlegs.tenderapp.com/
MIT License
967 stars 261 forks source link

Adobe AIR 4.0 - iPad mini Retina - Error Variable UIComponent is not defined. #160

Closed edegaia closed 10 years ago

edegaia commented 10 years ago

Before anything runs in debug mode on the iPad mini i get this error

ReferenceError: Error #1065: Variable UIComponent is not defined. at org.robotlegs.base::MediatorBase$cinit() at global$init() at global$init()

darscan commented 10 years ago

Interesting. That would be because of this:

https://github.com/robotlegs/robotlegs-framework/blob/version1/src/org/robotlegs/base/MediatorBase.as#L132

And by the sounds of things the catch is not working properly on that device.

Try overriding the static checkFlex() method in your derived class and make it return false.

Or, you could implement IMediator in your own base class and sub-class from that instead.

edegaia commented 10 years ago

I'm sorry i don't comprehend what you just mentioned. I don't even know which Sprite is generating that.

darscan commented 10 years ago

No problem. There aren't any Sprites involved at that point. Those methods are static and run as soon as the MediatorBase class is referenced (and probably before any of your code has even run).

Your app must be making use of mediators if you are seeing this. Which means you must be extending MediatorBase to make your mediators. I'm suggesting that you create your own mediator base class and extend from that instead of the default RL1 MediatorBase.

edegaia commented 10 years ago

but i'using a SWC i cannot modify that... Can you give me an example if it's not that complicated?

Actually my code uses import org.robotlegs.mvcs.StarlingMediator; from the starling-robotkegs-plugin

darscan commented 10 years ago

How many mediators do you have in your app?

edegaia commented 10 years ago

Up to 20 mediators

darscan commented 10 years ago

Create a file called MediatorBaseFixed.as:

package org.robotlegs.base
{
    import org.robotlegs.core.IMediator;

    public class MediatorBaseFixed implements IMediator
    {
        protected var viewComponent:Object;

        public function MediatorBase()
        {
        }

        /**
         * @inheritDoc
         */
        public function preRegister():void
        {
            onRegister();
        }

        /**
         * @inheritDoc
         */
        public function onRegister():void
        {
        }

        /**
         * @inheritDoc
         */
        public function preRemove():void
        {
            onRemove();
        }

        /**
         * @inheritDoc
         */
        public function onRemove():void
        {
        }

        /**
         * @inheritDoc
         */
        public function getViewComponent():Object
        {
            return viewComponent;
        }

        /**
         * @inheritDoc
         */
        public function setViewComponent(viewComponent:Object):void
        {
            this.viewComponent = viewComponent;
        }
    }
}

and put it into a folder like this org/robotlegs/base (or src/org/robotlegs/base depending on your setup).

Now find all your mediators and make them extend MediatorBaseFixed instead of MediatorBase.

darscan commented 10 years ago

P.S. For general Robotlegs support you can ask questions over at: http://knowledge.robotlegs.org

edegaia commented 10 years ago

As I told you I'm not using robotlegs directly but i'm passing by the plugin for Starling.

edegaia commented 10 years ago

Much simpler I got the 1.5.2 source of Robotlegs and commented the function and returned false.

darscan commented 10 years ago

Cool, glad it's working for you. The error itself should not be possible (due to the try-catch block), and looks like a Flash-on-device bug, so this is not something we can fix in the RL source.

edegaia commented 10 years ago

Can't you guys talk from the folks at adobe? This could improve the Flash player on ios and android.

Me i'm nobody but you guys they will listen to you.

thanx for your help