flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Coleman <david_coleman_...@hotmail.com>
Subject RE: Embedded assets are null after compile with ant
Date Mon, 25 Nov 2013 19:06:31 GMT
After sharing the code with Alex, he pointed me to this link below:
http://stackoverflow.com/questions/12914660/embedded-resources-with-incremental-build-provokes-runtime-exception-with-flex-4

Apparently the fix is to compile a module when using ant using incremental=false.  Looks like
that's a known issue.

Thank you very much Alex!!!

Hope someone else can benefit from this!

I will also update the relevant question on Adobe Discussions.

-Dave


> From: aharui@adobe.com
> To: users@flex.apache.org
> Date: Mon, 25 Nov 2013 08:03:30 -0800
> Subject: Re: Embedded assets are null after compile with ant
> 
> I suspect you are still missing some setting.  Can you send the SWF to me
> directly?  I'll dump it out and see if I can figure out what is going
> wrong.
> 
> -Alex
> 
> On 11/25/13 1:36 AM, "David Coleman" <david_coleman_007@hotmail.com> wrote:
> 
> >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: aharui@adobe.com
> >> To: users@flex.apache.org
> >> 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" <david_coleman_007@hotmail.com>
> >>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
> >> >
> >> > 		 	   		  
> >> 
> > 		 	   		  
> 
 		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message