Resolving Component libs with Flex SDK mxmlc
-
10-07-2019 - |
Question
I'm new to Flex SDK and trying to implement a simple project using Doug Mccune's CoverFlow widget. Most of the documentation out there on how to do this assumes that one is using Adobe's FlexBuilder product, which is a $250 Eclipse plug-in that I'd rather avoid buying. The problem I'm having is simply getting Doug's swc file, which is the binary version of his component lib, to be recognized by mxmlc, the Flex SDK project compiler. I keep getting error messages such as
Error: Could not resolve to a component installation
and
Error: Type was not found or was not a compile-time constant: CoverFlow.
I have also tried the type "VideoCoverFlow" as I am pretty sure that these types are defined in Doug's lib. Alas, I am stuck on figuring out where I've gone wrong.
The following is the full text for my mxml project file, called coverflow.mxml.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:local="*"
height="100%"
width="100%"
layout="absolute">
<local:CoverFlow
id="CoverFlow"
horizontalCenter="0"
verticalCenter="0"
borderThickness="10"
borderColor="#FFFFFF"
width="100%"/>
</mx:Application>
I am trying to compile it with the following command:
c:\flex_sdk_3\bin\mxmlc.exe -compiler.source-path=lib coverflow.mxml
I have also tried moving the CoverFlow_lib.swc file into the same dir as the mxml file instead of using the source-path argument, but that does not seem to make a difference.
I would gladly go RTFM if somebody could be so kind as to point me in the direction of the proper docs. There are related Stack Overflow questions here and here.
Thank you!
Update: I have changed my build command to the following:
mxmlc -library-path+=lib coverflow.mxml
And I also tried the following:
mxmlc -library-path+=CoverFlow_lib.swc coverflow.mxml
With the swc file in the same dir as the mxml file. However, I'm still getting the same errors.
There's also a video here showing the same library that I'm trying to use, but in Flex Builder. Unfortunately, it doesn't show how to use mxmlc.
I've also tried stripping down my mxml to simply,
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:local="*" >
<local:VideoCoverFlow />
</mx:Application>
Solution
Here is a link to the mxmlc command line tool docs from Adobe and a direct link to the command line options reference. I also find mxmlc -help list
to be a good place to start.
As another poster recommended, you really want to use library-path
to add the path to the directory that contains the swc file. Use the += operator to make sure you don't overwrite the previous values
e.g.)
c:\flex_sdk_3\bin\mxmlc.exe -library-path+=lib coverflow.mxml
OTHER TIPS
If it is an swc shouldn't you be using library-path rather than source-path and referencing the swc?
I finally got my project to build. The use of library-path was part of the solution, but I also had to take a closer look at the Doug Mccune library's sources so I could use the correct path information and type names in my mxml.
The winning command line is
mxmlc -library-path+=lib coverflow.mxml
And the working mxml is
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:coverflow="com.dougmccune.coverflow.*"
xmlns:containers="com.dougmccune.containers.*"
xmlns:local="*" >
<containers:CoverFlowContainer id="flow" />
</mx:Application
For some reason my container complains if I use id="coverflow"
. I get an error saying that the id name and the type name aren't allowed to be the same. If anyone can explain that to me, I'd love to understand what's going on there.
Thanks again for the help, Simon and James.