Error while loading app with DocumentPreloader

2 views
Skip to first unread message

fdufau

unread,
Oct 16, 2009, 6:32:31 AM10/16/09
to sekati-api
Hello,

I have an error only when i'm trying to load app with document
preloader.

i have 2 swf :

- preloader.swf wich extends DocumentPreloader
- main.swf wich extends Document

if i launch main.swf, all is ok

but if i use document preloader, it bug when trying to load first an
xml with XMLLoader in the initEntryPoint overriden method;

If i go to AbstractLoader and i comment typeEnforcer call, it run
well.

Any idea ?

Thanks.
Fred

sek...@gmail.com

unread,
Oct 19, 2009, 11:02:36 AM10/19/09
to sekati-api
Hi Fred,

Can you let us know what version of the API you are using (if you are
not sure you can right click in the SWF or check the API_VERSION
property in sekati.core.App) - it would be helpful if you could post
some source for us to look at - if my comments below don't help you
resolve your problem consider opening up an issue ticket @
http://code.google.com/p/sekati/issues/list

Based on what you mentioned I'm going to assume the error you are
having is somehow related to trying to implement one of the frameworks
pseudo-abstract classes: any class which employs
TypeEnforcer.enforceAbstract() which is designed to throw an error if
directly instantiated: AbstractLoader is, of course, one of these
classes. From the sounds of it you, somewhere, somehow are attempting
'new AbstractLoader()' which would throw the error: 'AbstractLoader is
an Abstract Class which must be sub-classed: it cannot be instantiated
directly.' - you should *not* see this error if you are instantiating
XMLLoader (which I just ran the unit test on in trunk and seems to be
working properly).

Also; in case you did not know - the framework has a way to
automatically load XML content as part of its bootstrapping sequence:
take a look at config.xml: <data load="true">xml/data.xml</data> - you
insert your xml path here, set <config persist="true"> and the XML
content will automatically be loaded and parsed before
Document.initEntryPoint (it is stored in App.db.data) @see
http://docs.sekati.com/sekati/sekati/core/Bootstrap.html#loadData()
for more.

Again if this doesn't help or I've misunderstood the problem you are
experiencing please open up an issue ticket with more details.

Thanks for your interest in the project!
Jason / Sekati

Frédéric DUFAU

unread,
Oct 19, 2009, 11:25:36 AM10/19/09
to sekat...@googlegroups.com
Hi Jason,

My version of the api is : Public Alpha 3.0.5.3 - "Gigan"

I've seen the data xml autoload option in config file but in my case, i call a class that load many other xml. So i can't use this option.

If that can help, this is the class i call in entryPoint method :

**************************************************************


package com.denis.model
{
    import flash.events.EventDispatcher;
    import flash.events.Event;
   
    import sekati.log.Logger;
    /**
     * ...
     * @author Fred DUFAU
     */
    public class ProxyLoader extends EventDispatcher
   
    {
        private static var _instance:ProxyLoader;
       
        public function ProxyLoader(pEnforcer:SingletonEnforcer)
        {
           
        }
       
        public static function get instance():ProxyLoader
        {
            if ( _instance == null )
            {
                _instance = new ProxyLoader( new SingletonEnforcer() );
            }
            return _instance;
        }
       
        public function init():void
        {
            HomeXMLDataProxy.instance.addEventListener( Event.COMPLETE, onDataLoaded);
            HomeXMLDataProxy.instance.loadData();
           
            EntrepriseXMLDataProxy.instance.addEventListener( Event.COMPLETE, onDataLoaded);
            EntrepriseXMLDataProxy.instance.loadData();
           
            MateriauxXMLDataProxy.instance.addEventListener( Event.COMPLETE, onDataLoaded);
            MateriauxXMLDataProxy.instance.loadData();
           
            RealisationsXMLDataProxy.instance.addEventListener( Event.COMPLETE, onDataLoaded);
            RealisationsXMLDataProxy.instance.loadData();
           
            GlobalXMLDataProxy.instance.addEventListener( Event.COMPLETE, onDataLoaded);
            GlobalXMLDataProxy.instance.loadData();
        }
       
        private function onDataLoaded(pEvt:Event):void
        {
            if ( HomeXMLDataProxy.instance.dataLoaded
                && EntrepriseXMLDataProxy.instance.dataLoaded
                && MateriauxXMLDataProxy.instance.dataLoaded
                && RealisationsXMLDataProxy.instance.dataLoaded
                && GlobalXMLDataProxy.instance.dataLoaded )
                {
                    Logger.$.notice(_instance, " =>  onDataLoaded");
                    dispatchEvent( new Event( Event.COMPLETE ) );
                }
        }
    }
   
}

class SingletonEnforcer {};


*********************************************************************
the bug appear in the call of HomeXMLDataProxy, this is the code for this class :

package com.denis.model
{
    import flash.events.EventDispatcher;
    import flash.events.Event;
   
    import sekati.log.Logger;
    import sekati.load.XMLLoader;
   
    /**
     * .DYNAMIC CLASS
     * @author Fred DUFAU
     */
    dynamic public class HomeXMLDataProxy extends EventDispatcher
    {
        private static var _instance:HomeXMLDataProxy;
       
        private var _xmlLoader : XMLLoader;
        private var _dataLoaded : Boolean = false;
        private var _data : XML;
       
        public function HomeXMLDataProxy(pEnforcer:SingletonEnforcer)
        {
           
        }
       
        public static function get instance():HomeXMLDataProxy
        {
            if ( _instance == null )
            {
                _instance = new HomeXMLDataProxy( new SingletonEnforcer() );
            }
            return _instance;
        }
       
        public function loadData():void
        {
            _xmlLoader = new XMLLoader( "xml/home.xml" );
            _xmlLoader.addEventListener( Event.INIT, onLoadXML );
            _xmlLoader.load();
        }
       
        /**
         * dynamic class here
         * @param    pEvt
         */
        private function onLoadXML( pEvt:Event ):void
        {
            Logger.$.info(instance, " :: onLoadXML");
           
            _data = _xmlLoader.content;
               
            for each( var elem:XML in _data.elements() )
            {
                this[ elem.localName() ] = elem.toString();
            }
           
            _dataLoaded = true;
           
            dispatchEvent( new Event (Event.COMPLETE) );
        }
       
        public function get dataLoaded():Boolean
        {
            return _dataLoaded;
        }
    }
   
}

class SingletonEnforcer {};

*********************************************

thanks

sek...@gmail.com

unread,
Oct 23, 2009, 2:09:48 PM10/23/09
to sekati-api
Hi Fred,

I believe I have discovered the reason behind the issue you are having
(with XMLLoader's use of TypeEnforcer.enforceAbstract) - the
TypeReferenceError is caused by the use of getDefinitionByName in a
loaded SWF where the applicationDomain has not created a reference to
the class.

A new version of the API (3.0.5.7) will be committed later today which
will resolve this issue (I will catch the error in preloaded SWF's and
instead of throwing an error send a simple notification with Logger.
$.error). I recommend you update to the latest version of the API
later today and all these issues should evaporate.

Thanks for letting me know - if you find any other issues feel free to
open an issue @ http://code.google.com/p/sekati/issues/entry

Best,
Jason / Sekati
> >http://docs.sekati.com/sekati/sekati/core/Bootstrap.html#loadData()<http://docs.sekati.com/sekati/sekati/core/Bootstrap.html#loadData%28%29>

sek...@gmail.com

unread,
Oct 23, 2009, 2:10:35 PM10/23/09
to sekati-api
Oh and if you'd like more details on why this happens check out the
comment responses to this post:
http://www.mikechambers.com/blog/2006/06/22/actionscript-3-get-a-class-reference-by-class-name/

On Oct 23, 2:09 pm, "sek...@gmail.com" <sek...@gmail.com> wrote:
> Hi Fred,
>
> I believe I have discovered the reason behind the issue you are having
> (with XMLLoader's use of TypeEnforcer.enforceAbstract) - the
> TypeReferenceError is caused by the use of getDefinitionByName in a
> loaded SWF where the applicationDomain has not created a reference to
> the class.
>
> A new version of the API (3.0.5.7) will be committed later today which
> will resolve this issue (I will catch the error in preloaded SWF's and
> instead of throwing an error send a simple notification with Logger.
> $.error). I recommend you update to the latest version of the API
> later today and all these issues should evaporate.
>
> Thanks for letting me know - if you find any other issues feel free to
> open an issue @http://code.google.com/p/sekati/issues/entry

Frédéric DUFAU

unread,
Oct 24, 2009, 7:06:47 AM10/24/09
to sekat...@googlegroups.com
Thanks for support Jason !

Reply all
Reply to author
Forward
0 new messages