1

Why do I need to do add extra namespace declarations (below) in a Flex 4.1 "MX only component set" project to get it to compile within Flash Builder? (It says mx:LineChart cannot be resolved when a chart is added via Design View, and datavisualization.swc is referenced.)

Is there a way I can get this to compile without adding these special xmlns:charts, xmlns:series and chartClasses to the declaration? (If I just leave the default namespaces and use mx:SomeChartComponent, it doesn't compile.)

<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:fx="http://ns.adobe.com/mxml/2009" 
xmlns:mx="library://ns.adobe.com/flex/mx" 
xmlns:charts="mx.charts.*"
xmlns:series="mx.charts.series.*"
xmlns:chartClasses="mx.charts.chartClasses.*">


<charts:PieChart id="chart" height="100%" width="100%"
             paddingRight="5" paddingLeft="5" color="0x323232"
             dataProvider="{medalsAC}" >

<charts:series>
    <series:PieSeries labelPosition="callout" field="Gold">
        <series:calloutStroke>
            <s:SolidColorStroke weight="0" 
                                color="0x888888" alpha="1.0"/>
        </series:calloutStroke>
        <series:radialStroke>
            <s:SolidColorStroke weight="0" 
                                color="#FFFFFF" alpha="0.20"/>
        </series:radialStroke>
        <series:stroke>
            <s:SolidColorStroke color="0" 
                                alpha="0.20" weight="2"/>
        </series:stroke>
    </series:PieSeries>
</charts:series>

Mifune
  • 370
  • 1
  • 5
  • 14

1 Answers1

0

I don't believe you can do it without defining the extra namespaces/packages. This is due to a change in the mx namespace when moving to Flex 4, the mx namespace is now defined as:

library://ns.adobe.com/flex/mx

it used to be:

http://www.adobe.com/2006/mxml

Here's more on namespaces: http://livedocs.adobe.com/flex/3/html/help.html?content=03_Language_and_Syntax_06.html

Basically using the old namespace should work for the charting code since it's defined with that namespace however then it would expect to find all the updated mx components with that namespace too which is where I think you'd be running into problems.

shaunhusain
  • 19,630
  • 4
  • 38
  • 51
  • I don't mind having the extra namespaces, but the issue I have is that Flash Builder isn't adding the required namespaces like it should when I drag/drop a charting component or even if I use autocompletion. It wants to use mx: for everything, which obviously isn't working. Is this a Flash Builder bug or could I have something configured wrong? – Mifune Mar 13 '12 at 13:10
  • Even more odd, I have another entirely different project which only uses the fx and mx namespaces (same as above), which appears to be identical in all ways configuration wise - but the charting components work fine! I have mx:ColumnChart and other such stuff in this project, no compile errors, same 4.1 SDK. So *something* must be different at the project level, but I can't figure out what. – Mifune Mar 13 '12 at 13:13
  • Are you sure they're using the same version of the SDK, in the Flex build path have you tried removing the SDK then re-adding it sometimes I've seen cases where you start with a 3.x project then up the SDK version but it ends up with a mix of 3.4 dependencies and 4.x dependencies (I'd be surprised if this could build let alone run smoothly though). What if you create two new projects and copy the source from your two existing projects? This could help determine if something is simply mis-configured for one of the projects. – shaunhusain Mar 13 '12 at 16:03
  • After doing so if both work I guess you're in good shape and just had some corruption in one of the projects. If they both don't work then you can do a diff of the old one that does work with the new copy of it that doesn't to see what's going on (relevant files would be .actionscriptProperties .project .flexConfig.xml .flexProperties) I don't use the design view or charting often for that matter so I haven't directly encountered the issue. – shaunhusain Mar 13 '12 at 16:07
  • Pretty sure they're using the same SDK version. Probably the next thing to try is to set up a new project, move the source over, and see what happens. – Mifune Mar 15 '12 at 21:24