Forums » General

Using mate in Flex 4 project

(23 posts)
  • Started 1 year ago by mloncaric
  • Latest reply from easotokr
  1. I've decided to "port" my latest project from Flex 3 to Flex 4.

    And with some modifications I got it running again (with all mate parts commented-out, just to be sure).

    After that I've uncommented only one XEventMap class to my surprise there were no errors, until I ran application again. The problem sticks inside EventHandlers and also Injectors (maybe more), maybe the problem is inside of AbstractHandlers class, dunno.

    Here is the ErrorLog:

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    	at com.asfusion.mate.core::GlobalDispatcher/get popupDispatcher()[/Users/Miran/Documents/SVN/mate-framework/com/asfusion/mate/core/GlobalDispatcher.as:61]
    	at com.asfusion.mate.core::GlobalDispatcher/addEventListener()[/Users/Miran/Documents/SVN/mate-framework/com/asfusion/mate/core/GlobalDispatcher.as:86]
    	at com.asfusion.mate.actionLists::EventHandlers/commitProperties()[/Users/Miran/Documents/SVN/mate-framework/com/asfusion/mate/actionLists/EventHandlers.as:229]
    	at com.asfusion.mate.actionLists::AbstractHandlers/validateNow()[/Users/Miran/Documents/SVN/mate-framework/com/asfusion/mate/actionLists/AbstractHandlers.as:266]
    	at com.asfusion.mate.actionLists::AbstractHandlers/setDispatcher()[/Users/Miran/Documents/SVN/mate-framework/com/asfusion/mate/actionLists/AbstractHandlers.as:239]
    	at com.asfusion.mate.actionLists::EventHandlers/setDispatcher()[/Users/Miran/Documents/SVN/mate-framework/com/asfusion/mate/actionLists/EventHandlers.as:186]
    	at com.asfusion.mate.actionLists::AbstractHandlers/initialized()[/Users/Miran/Documents/SVN/mate-framework/com/asfusion/mate/actionLists/AbstractHandlers.as:409]
    	at com.loncaric.xxx.maps::RegisterEventMap/_RegisterEventMap_EventHandlers1_i()[/Users/Miran/Documents/Flex Builder 3/ddd_f4/src/com/loncaric/xxx/maps/RegisterEventMap.mxml:3]
    	at com.loncaric.xxx.maps::RegisterEventMap()[/Users/Miran/Documents/Flex Builder 3/ddd_f4/src/com/loncaric/xxx/maps/RegisterEventMap.mxml:9]
    	at Main/_Main_RegisterEventMap1_i()
    	at Main()[/Users/Miran/Documents/Flex Builder 3/ddd_f4/src/Main.mxml:5]
    	at _Main_mx_managers_SystemManager/create()
    	at mx.managers::SystemManager/initializeTopLevelWindow()[/Users/Miran/Documents/SVN/FlexSDK/frameworks/projects/framework/src/mx/managers/SystemManager.as:3190]
    	at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::docFrameHandler()[/Users/Miran/Documents/SVN/FlexSDK/frameworks/projects/framework/src/mx/managers/SystemManager.as:3066]
    	at mx.managers::SystemManager/docFrameListener()[/Users/Miran/Documents/SVN/FlexSDK/frameworks/projects/framework/src/mx/managers/SystemManager.as:2918]

    EDIT: It seems the problem sticks inside SystemManager which GlobalDispatcher uses.

    Posted 1 year ago #
  2. I didn't have time to install Flex 4 in my laptop yet.
    But once I set it up I will take a look to that bug.
    I think that some of the internals of Flex Framework changed in flex 4. But I need to dig in more.
    I will update you once I fix it.
    My goal is that Mate is supported in Flex 4.

    Posted 1 year ago #
  3. I'm interested if anyone has made any progress on this?

    Posted 1 year ago #
  4. develar
    Member

  5. Interested in what you changed? I found only Application.application issues with typing and use of FlexGlobals instead of Application.application.

    Posted 1 year ago #
  6. develar
    Member

    Index: src/com/asfusion/mate/core/MateManager.as
    ===================================================================
    --- src/com/asfusion/mate/core/MateManager.as (revision 119)
    +++ src/com/asfusion/mate/core/MateManager.as Thu Apr 02 11:46:22 MSD 2009
    @@ -72,7 +72,8 @@
    import flash.events.IEventDispatcher;
    import flash.utils.Dictionary;

    -import mx.core.Application;
    +import spark.components.Application;
    +import mx.core.FlexGlobals;
    import mx.events.FlexEvent;
    import mx.logging.ILoggingTarget;
    import mx.managers.ISystemManager;
    @@ -97,7 +98,7 @@
    //.........................................application..........................................
    public function get application():Application
    {
    - return Application.application as Application;
    + return Application(FlexGlobals.topLevelApplication);
    }

    //.........................................systemManager..........................................
    Index: src/com/asfusion/mate/core/GlobalDispatcher.as
    ===================================================================
    --- src/com/asfusion/mate/core/GlobalDispatcher.as (revision 51)
    +++ src/com/asfusion/mate/core/GlobalDispatcher.as Tue Mar 17 11:55:05 MSK 2009
    @@ -26,8 +26,8 @@
    import flash.events.Event;
    import flash.events.EventPhase;
    import flash.events.IEventDispatcher;
    -
    +
    - import mx.core.Application;
    + import mx.core.FlexGlobals;

    /**
    * GlobalDispatcher is the default dispatcher that "Mate" uses.
    @@ -46,7 +46,7 @@
    */
    public function get applicationDispatcher():IEventDispatcher
    {
    - return Application.application as IEventDispatcher;
    + return IEventDispatcher(FlexGlobals.topLevelApplication);
    }

    /*-.........................................popupDispatcher..........................................*/
    @@ -57,8 +57,7 @@
    */
    public function get popupDispatcher():IEventDispatcher
    {
    - var application:Application = applicationDispatcher as Application;
    - return (application.systemManager) ? application.systemManager.topLevelSystemManager : SystemManagerFinder.find().topLevelSystemManager;
    + return (FlexGlobals.topLevelApplication.systemManager) ? FlexGlobals.topLevelApplication.systemManager.topLevelSystemManager : SystemManagerFinder.find().topLevelSystemManager;
    }

    Index: src/com/asfusion/mate/core/IMateManager.as
    ===================================================================
    --- src/com/asfusion/mate/core/IMateManager.as (revision 119)
    +++ src/com/asfusion/mate/core/IMateManager.as Thu Apr 02 11:45:44 MSD 2009
    @@ -24,7 +24,7 @@
    import flash.events.IEventDispatcher;
    import flash.utils.Dictionary;

    - import mx.core.Application;
    + import spark.components.Application;
    import mx.logging.ILoggingTarget;
    import mx.managers.ISystemManager;
    /**

    Posted 1 year ago #
  7. While the solution above works, and has stronger typing than my solution, have you considered if the user is using the Flex 4 framework, but has a halo base application?

    According to the docs, FlexGlobals.topLevelApplication will return the top most Application. Which can be spark or halo. Because this was potentially problematic for me, I opted to use "Object" instead of Application.

    Interested in a better solution, and certainly very interested in what the creators of Mate are thinking as well..

    Posted 1 year ago #
  8. @develar ... good stuff, thanks for sharing.

    Posted 1 year ago #
  9. Thanks @develar this seemed to work for me too, for now.

    Greets!

    Posted 1 year ago #
  10. I've just posted on this : http://blog.lyraspace.com/2009/07/28/mate-framework-and-flex-4-sdk/

    Could you comment on news regarding the patch being implemented into the code base?

    Posted 1 year ago #
  11. We need to refactor the code a little bit to make it work because the patch works on Flex 4 but not on Flex 3. Any way, we are working on that and we will have a fix on the next release.

    Posted 1 year ago #
  12. Cool. Maybe a note to people downloading your latest SWC would be helpful. Noobs like me will just assume it's their code that is not working in FB4.

    Posted 1 year ago #
  13. fireraven
    Member

    Has this made it into 0.8.8.1? I can't seem to find the patched .SWC anymore at the links referenced? Please advise...

    Posted 11 months ago #
  14. You can get a Flex 4 version of Mate here:

    http://github.com/viatropos/mate/tree/master

    Posted 11 months ago #
  15. fireraven
    Member

    Thanks! Is there a compiled .SWC anywhere, or is grabbing and compiling the source the only option?

    Posted 11 months ago #
  16. Yeah, just git clone it into your flex builder directory and import it, flexll compile it without any configuring into a swc. Then you can easily debug mate and extend it :), and if u want, just push your changes for others to see.

    Posted 11 months ago #
  17. fireraven
    Member

    Got it. Done. No worries... Thanx!

    Posted 11 months ago #
  18. I'm trying to pass the scope.dispatcher into one of my managers, but it keeps giving me a null value for the dispatcher. Am I doing something wrong or could this also be related to compiling with Flex4? I'm using the version of mate that can be downloaded from http://github.com/viatropos/mate/tree/master

    In the EventMap

    <mate:EventHandlers type="{LoginEvent.AUTHENTICATE}">
    			<mate:ObjectBuilder generator="{SessionManager}" constructorArguments="{scope.dispatcher}" />
    </mate:EventHandlers>

    In the constructor of the SessionManager:

    public function SessionManager(target:IEventDispatcher=null)
    		{
    //traces null
    			trace("my dispachter = "+target);
    			super(target);
    		}
    Posted 11 months ago #
  19. Newer mind, I figured it out. The reason was that I had a Injectors mapping that was being called before this event handler fired, and in that injector I used the SessionManager but without instanciating it properly using constructor arguments. I solved this by adding a event handler for FlexEvent.preinitialize and using ObjectBuilder there to create the SessionManager instance that is then used throughout the event map.

    Posted 11 months ago #
  20. inuwan
    Member

    I'm using the latest nightly SDK of Flex 4 and I downloaded the http://github.com/viatropos/mate/tree/master version of Mate. However I get 64 "definition is in a circular inheritance" compiler errors, one for a different class. For example CallBack.as, CachSetter.as, AsyncCommandInvoker.as, etc. Anyone else experience these and able to fix them?

    Posted 10 months ago #
  21. inuwan
    Member

    Nevermind - found a fix. Which is to deselect all source in under Build Path sources, save. Rebuild. Then go back to the Build Path sources and then select all. Rebuild. The "definition is in a circular inheritance" errors are now gone

    Posted 10 months ago #
  22. QuantumInformation
    Member

    Any update on the status of flex + mate?

    Posted 5 months ago #
  23. easotokr
    Member

    Please a help, I'm migrating my Flex 3 App into Flex 4, but when I run it, the events are not working at all. Checking the XMLList Created to manage the menu actions I found the XML component with the navigation Event comes empty.

    please any hint it's welcome

    Posted 4 weeks ago #

RSS feed for this topic

Reply

You must log in to post.