I'm having a problem VERY similar to this issue:
http://forums.adobe.com/thread/941800

Basically I have a module whose sole purpose in life is to contain a ton of 
graphics and binary assets.

Here is an example of my code:


<?xml version="1.0" encoding="utf-8"?>
<s:Module xmlns:fx="http://ns.adobe.com/mxml/2009"; 
          xmlns:s="library://ns.adobe.com/flex/spark" 
          xmlns:mx="library://ns.adobe.com/flex/mx"
          implements="com.hof.lobby.modules.IStaticAssets"
          initialize="onCreationComplete(event)"
          creationComplete="onCreationComplete(event)"
          >
...
            protected var _inboxAssets:IInboxAssets = new InboxAssets();
            public function get inboxAssets():IInboxAssets {
                return _inboxAssets;
            }
...

    public class InboxAssets extends EventDispatcher implements IInboxAssets {
        [Embed(source="./inboxEnvelope.png", mimeType="image/png")]
        protected var _inboxIconNormal:Class;
        public function get inboxIconNormal():Class {
            return _inboxIconNormal;
        }
        
        [Embed(source="./inboxEnvelopeOver.png", mimeType="image/png")]
        protected var _inboxIconOver:Class;
        public function get inboxIconOver():Class {
            return _inboxIconOver;
        }
    }

...

when i compile with flash builder all is perfect, these getters return assets.

when i compile with ANT, i get an swf with the same size as with flash builder, 
and when i decompile it with sothink, i can see that my assets are indeed in 
the file.

when i use moduleLoader and load the assets, it instantiates properly, so we 
are good there.

however when i try to ACCESS the assets, I get this:
ReferenceError: Error #1065: Variable InboxAssets__inboxIconOver is not defined.

    at flash.display::MovieClip/nextFrame()
    at mx.core::FlexModuleFactory/deferredNextFrame()
    at mx.core::FlexModuleFactory/update()
    at mx.core::FlexModuleFactory/moduleCompleteHandler()

this error ONLY occurs if I compile with ANT.

If i change the getter to be:

        [Embed(source="./inboxEnvelope.png", mimeType="image/png")]
        protected var _inboxIconNormal:Class;
        private var _inboxIconNormalInstance:Bitmap;
        public function get inboxIconNormal():Bitmap {
            if(!_inboxIconNormalInstance) {
                _inboxIconNormalInstance = new _inboxIconNormal();
            }
            return _inboxIconNormalInstance;
        }

the error does not occur.

however I don't think that I should have to re-write all my assets just to 
support an ANT build...

Can anyone give me any pointers. please?

Thank you very much,
Dave

                                          

Reply via email to