0
votes

A teammate on my project added a swc that had some mx logging classes in it, and now my project won't compile. Error:

Class mx.logging.targets::LineFormattedTarget could not be found.

I'm on the latest Flash Builder 4.6, fresh install. I notice when I go to project > properties > Actionscript Compiler then select Libraries, there is no options to select MX like there was before. Anybody know how to solve this problem. I thought the idea behind swc's is that they are self-contained and wouldn't need to me add extra imports. Thanks.

1
"I thought the idea behind swc's is that they are self-contained and wouldn't need to me add extra imports." - Not necessarily. When you compile a swc, just as when compiling to swf, you can choose to embed the framework packages or have them linked, to be found at runtime.Jude Fisher
Yah the idea behind a swc is just like that of a jar from Java if you're familiar, it's just a single file that contains the metadata about the classes it contains and the bytecode of the compiled classes for that swc, it doesn't mean it necessarily includes all of it's dependencies (though with how flash builder is setup by default I'm pretty sure it compiles in the classes referenced). You should probably 1 roll back to the SDK the library was compiled against and use that, or 2 get the original source and update it to compile against the latest SDK.shaunhusain
It's probably worth noting that you can open the swc with any compression tool (winzip or winrar or file roller or whatever) and you'll find a catalog.xml file in there that has at the top what version of Flex the SWC was compiled with. I find it useful to try opening most unfamiliar file formats with a robust text editor (that won't die if I feed it a large file) and a compression tool if it appears to be garbled when viewing the text, just to see if I can pull the file apart and understand what composes it.shaunhusain
@shaunhusain i figured it could be some funny business with sdk compatibility, and although i haven't ruled it out, i know that another dev on the project compiles just fine with both flash builder 4.5 and 4.6 both using sdk 4.6 (same as me).botbot
Hmm yah actually just did a quick search on my SDKs folder and I find that file in the 4.6 source as well looks like it should be in the framework.swc included from the 4.6 SDK I think? C:\CleanFS\SDKs\flex\4.6.0.23201B\frameworks\projects\framework\src\mx\logging\targetsshaunhusain

1 Answers

1
votes

Yah very strange... so after discussing above a bit I threw together a sample project and this compiles fine against the 4.6.0 SDK I'm using, I can see the LineFormattedTarget class within my framework.swc when I expand it in the libraries in the navigator on the left:

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                       xmlns:s="library://ns.adobe.com/flex/spark" 
                       xmlns:mx="library://ns.adobe.com/flex/mx"
                       creationComplete="windowedapplication1_creationCompleteHandler(event)">
    <fx:Script>
        <![CDATA[
            import mx.core.mx_internal;
            import mx.events.FlexEvent;
            import mx.logging.targets.LineFormattedTarget;

            protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void
            {
                var test:LineFormattedTarget = new LineFormattedTarget();
            }

        ]]>
    </fx:Script>
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>

</s:WindowedApplication>

I would check to make sure it shows the framework.swc inside of the 4.6 referenced library, if the swc isn't there try removing and re-adding the framework to the library path, if that fails with the same result I would look at pulling down the SDK fresh.