Flex Embed - Unable to resolve error

Hello,

I am evaluating replacing Flex Buider with IntelliJ (first contact with IntelliJ). Therefore I am trying to build current flex code with IntelliJ but I have an issue with Embedding 'resources'. Flex compiler always returns

"unable to resolve '<embedded resource>'"

E.g.


[Embed(source="/com/assets/mouseMove.gif")]

==>

Error: unable to resolve '/com/assets/mouseMove.gif' for transcoding.

I assume I have to set some module configuration but have not been able to figure out how or what.

Guidance warmly welcomed!

Thanks,

Peter



21 comments
Comment actions Permalink

Hi Peter!

I couldn't reproduce your issue. Please make sure that /com/assets/mouseMove.gif file exists and is marked as source folder of your IDEA module (see Project Structure -> Modules -> Sources). Also make sure that your source file (where you use embedded resource) is under source folder of the module. If this doesn't help please provide some more information about your configuration: - IDEA version (including build number) - Do you use Flex module or Flex facet? - What Flex SDK have you configured for Flex module or facet? - What folders are marked as source folders? - Where is file mouseMove.gif located and where is source file that embeds it located? - Please try Build ->]]> Rebuild project and paste full log from Messages
toolwindow

0
Comment actions Permalink

My text above seems to be corrupted. Trying once more.

Hi Peter!

I couldn't reproduce your issue. Please make sure that {some
path}/com/assets/mouseMove.gif file exists and {some path} is marked as
source folder of your IDEA module (see Project Structure -> Modules ->
Sources).

If this doesn't help please provide some more information about your
configuration:
- IDEA version (including build number)
- Do you use Flex module or Flex facet?
- What Flex SDK have you configured for Flex module or facet?
- What folders are marked as source folders?
- Where is file mouseMove.gif located and where is source file that
embeds it located?
- Please try Build -> Rebuild project and paste full log from Messages
toolwindow

0
Comment actions Permalink

Thanks for the prompt reaction. I have it working now. I must have messed up some config somewhere when 'importing' projects from Eclipse.

I am all set to continue my testing.

Thanks!

Peter

0
Comment actions Permalink

Hi Alex,

Im currently having exactly the same issue with my Embeds under IntelliJ Idea 9.0.2.

While before Ive managed to get around it by adding the embeds folder to source, this time it doesnt seem to want to play ball.
Ive also tried rebuilding the project every step I try.

Here is my log file too.

Cheers,
Filipe Lima



Attachment(s):
idea_flex_embeds.txt.zip
0
Comment actions Permalink

Hi Filipe!
Flex dev guide says that in this case you must write embedded file path with leading slash: http://livedocs.adobe.com/flex/3/html/help.html?content=embed_3.html (see About setting the path to the embedded asset)
Flash Builder's compiler does not follow this specification and compiles even without leading slash. Flex SDK command line compiler will not compile such code as well as IDEA. So if you want to have reliable code please write like [Embed(source="/embed/image/loading_small.swf")]. And of course the parent folder of the 'embed' folder must be a source folder.

0
Comment actions Permalink

Hi Alex,

Thank you, that definitely did it. Funny thing is that within Flash Builder, where this project was originaly developed, Adobe does not force for the same kind of consistent usage. Builder like in IDEA the src path is a source path and the embed folder is inside of it, so the compiler with builder should also throw the same error but doesnt.

Thanks again for the quick heads up.

Filipe

0
Comment actions Permalink

Hi,

I have just upgraded to version 10 from 9.0.4.

I have a maven project that built perfectly under 9.0.4 but compiles with errors under 10. (I have only imported it and not changed a thing!!!)

The editor shows the code as OK and I can jump to the declaration using CTRL-B. It starts with a '/' and exists in my resources folder which Idea has correctly marked as a source folder.

When I compile i get the errors :-

[cf_script_swc (Flex)] unable to resolve '/images/bullet_blue.png' for transcoding
[cf_script_swc (Flex)] Unable to transcode /images/bullet_blue.png.

for each embedded resource.

Please help.


Lewis

0
Comment actions Permalink

Hi Lewis,
What is your Flexmojos version and Flex SDK version?
I tried some sample but it is ok for me. I suspect 2 possible reasons of compilation failure in your environment:
1. Compiler config file is not correct. Please run from command line mvn compile -DconfigurationReport=true and just after successful compilation try to compile in IDEA.
2. Something is wrong with new IDEA's built-in Flex compiler shell. Please try another compiler at File | Settings | Compiler | Flex Compiler

0
Comment actions Permalink

Flexmojos :- 3.8
Flex :- 3.5.0.12683
AIR : 2.5
Player :- 10.0.45.2

I deleted all the *.i* files from the modules and reopened the project from the pom.xml...just to make sure!

1) Same problem.

2) Changed the compiler to 'Flex Compiler Shell (fsch).... Works!


Regards

Lewis

0
Comment actions Permalink

Seems we need to fix new IDEA's compiler. Can you please attach you target/...-config-report.xml file and paste code snippet that references resource file and specify location of this source file and resource file?

0
Comment actions Permalink

<?xml version="1.0" ?>
<mx:Tree xmlns:mx="http://www.adobe.com/2006/mxml"
         xmlns:helpers="com.cf.fb.view.macro.helpers.*"
         labelField="@name"
         iconFunction="treeIconFunction"
         disclosureClosedIcon="@Embed(source='/images/closed.png')"
         disclosureOpenIcon="@Embed(source='/images/open.png')">

    <!-- RLH Group macros -->

    <mx:Script><![CDATA[
        [Embed(source="/images/bullet_blue.png")]
        private var treeIcon:Class;

        private function treeIconFunction(node:XML):Class {
            return treeIcon;
        }
        ]]>
    </mx:Script>

    <mx:dataDescriptor>
        <helpers:MacroTemplateTreeDataDescriptor/>
    </mx:dataDescriptor>
</mx:Tree>

The source file is :-

src\main\flex\com\cf\fb\view\macro\MacroToolbar.mxml

The resources are in :-

src\main\resources\images

Regards

Lewis



Attachment(s):
cf_script_swc-2.7.2-SNAPSHOT-config-report.xml
0
Comment actions Permalink

Thank you!
I definitely need to find the bug in new IDEA's compiler, but I still can't reproduce the issue. Compilation is ok for me with any available Flex compiler. Attached is a sample project I played with. Can you please try in in your environment and modify in order to reproduce the issue?



Attachment(s):
some_lib.zip
0
Comment actions Permalink

This fails.

All I did was to add the missing

                    <configurationReport>true</configurationReport>

Run mvn clean compile

Then try compiling through IDEA....


Lewis



Attachment(s):
flex compile errors.png
pom.xml
some_lib-1.0-SNAPSHOT-config-report.xml
0
Comment actions Permalink

Thank you, the problem is clear now. Compiler classpath should start with idea-flex-compiler-fix.jar and for some reason it doesn't.
Most probably autogenerated Flexmojos SDK has incorrect version number. Please try to remove SDK that is set for imported Flex facet from Project Structure | SDKs and reimport project again.

0
Comment actions Permalink

By the way we do not recommend to set option <configurationReport>true</configurationReport> in pom. Configuration is generated correctly when doing mvn compile, but in case of mvn install references to dependent projects link to local repository while for development purposes you need them to be within project. You can remove this option from pom and as soon as you need to generate auxuliary files for IDEA run mvn compile -DconfigurationReport from command line.

0
Comment actions Permalink

Did y'all ever figure out what this is? I've scoured the net all day and nothing works beyond changing my Embed source to use ../ vs. /. Code works fine in Flash Builder 4.5, no dice in IntelliJ 10.5.2. Only "strange" thing I'm doing is source path is:

main/flex/src

And src is marked as source. Again, if I did a Find & Replace on all the Embed tags in the entire app to be relative, it works. But ... yeah... not really going to do that, so......???????

0
Comment actions Permalink

Hi Jesse,
can you please help us to localize your problem:
- snippet that contains code that doesn't compile in IDEA
- location of file with this code
- location of asset you want to embed
- flex SDK version
- which compiler is set at File | Settings | Compiler | Flex Compiler

0
Comment actions Permalink

- snippet that contains code that doesn't compile in IDEA

[Embed(source='/embedded-assets/elevationIcons/45u-rack-front.png')]
private var rack45Front:Class;



- location of file with this code

com.company.project.domain.model.ImageCache.as

folder structure is:

Project/src/main/flex/com/company/project/domain/model/ImageCache.as

Source folder set in IntelliJ is:

src/main/flex


- location of asset you want to embed

Project\src\main\flex\embedded-assets\elevationIcons\42u-rack-rear.png

- flex SDK version

4.5.1 build 21328

- which compiler is set at File | Settings | Compiler | Flex Compiler

built in compiler shell

0
Comment actions Permalink

All,

The answer is....

You must change the compiler to 'fcsh' in the project settings.

Compiler => Flex Compiler => Flex Compiler Shell (fcsh)

I think the 'Built-in' compiler is still broken!


Regards

Lewis

0
Comment actions Permalink

Failed to reproduce. Attached is a project I played with. Can you please check it in your environment?



Attachment(s):
embed_compile_problem.zip
0
Comment actions Permalink

Lewis, we still don't have reproducible sample and consider built-in compiler to be correct. If you think that compiler is broken please open a new issue in http://youtrack.jetbrains.net with details.

0

Please sign in to leave a comment.