Basically after the module is instantiated, I start to create display objects which use the classes... Since I have no further information in the stack trace I assumed it must be when i tried to access the asset my UI components.
However, what you say makes me curious, if it is during the class initialization... how can it be resolved? and why is it only when I build with ANT? > From: [email protected] > To: [email protected] > Date: Sun, 24 Nov 2013 23:31:01 -0800 > Subject: Re: Embedded assets are null after compile with ant > > What do you mean by "access the assets"? What code is doing that and when > does it run? The stack trace does not indicate that some of your code is > running, it usually means that something blew up in initializing classes. > > -Alex > > On 11/24/13 7:33 AM, "David Coleman" <[email protected]> wrote: > > >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 > > > > >
