3 Replies Latest reply on Dec 4, 2009 4:59 AM by JeffryHouser

    Flex multiple namespaces

    andre1011

      Does Flex support multiple namespaces?

      I have a simple calorie calculator application which uses the adobe namespace =>  xmlns:mx="http://www.adobe.com/2006/mxml" automatically

      I also want to include the namespace "http://www.w3.org/1999/xhtml" to use standard xhtml tags but I keep getting this error


      Could not resolve <andre:h1> to a component implementation.    Calory/src    Calory.mxml    line 58    1259888536456    15

       

      Here is my full code

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application  xmlns:andre="http://www.w3.org/1999/xhtml" xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="populateCombo(event)" color="#679D88" backgroundGradientAlphas="[1.0, 0.47]" backgroundGradientColors="[#D2DDDF, #684E4E]">
      <mx:Style source="calorie.css" />
          <mx:states>
              <mx:State name="results">
                  <mx:SetProperty target="{labelDuration}" name="width" value="190"/>
                  <mx:SetProperty target="{resultOfCalculation}" name="width" value="530"/>
              </mx:State>
          </mx:states>
      <mx:Script>
          <![CDATA[
              import mx.events.FlexEvent;
              import flash.events.MouseEvent;
              private function populateCombo(e:FlexEvent):void
              {
                var dp:Array = new Array();
                dp.push({label:"Choose exercise ...", data:0});
                dp.push({label:"Aerobics (high impact)", data:0.07142});
                dp.push({label:"Aerobics (low impact)", data:0.0333});
                dp.push({label:"Basketball", data:0.0779});
                dp.push({label:"Cycling", data:0.0779});
                dp.push({label:"Jogging (slow)", data:0.0666});
                dp.push({label:"Jogging (moderate)", data:0.0974});     
                dp.push({label:"Jogging (fast)", data:0.1});
                dp.push({label:"Soccer", data:0.07142});
                dp.push({label:"Swimming (moderate)", data:0.05844});
                dp.push({label:"Tennis", data:0.06666});
                dp.push({label:"Walking (brisk)", data:0.0666});
                comboExerciseType.dataProvider = dp;
             
              }
             
              private function getCalories(e:MouseEvent):void
              {
                  var calsBurned:Number = Number(comboExerciseType.value);
                  var kjBurned:Number;
                  var duration:Number = Number(textDuration.text);
                  var weightLBS:Number;
                 
                  if(rdoKilograms.selected == true)
                  {
                      weightLBS = 2.2 * Number(textWeight.text);
                  }
                  else
                  {
                      weightLBS = Number(textWeight.text);
                  }
                  calsBurned = calsBurned * weightLBS * duration;
                  currentState = "results";
                  kjBurned = calsBurned * 4.2;
                  resultOfCalculation.text = "You burned " + String(Math.floor(calsBurned)) + " calories or " +
                                             String(Math.floor(kjBurned)) + " kilojoules";
              }
          ]]>
      </mx:Script>
          <mx:Panel x="58.5" y="72" width="556" height="332" layout="absolute" title="Calorie Calculators" id="panel1">
              <mx:VBox x="0" y="0" height="292" width="536" id="vbox1">
              <andre:h1> //This line is the problem
                  This is the standard header
              </andre:h1>
              <mx:Spacer width="300">
                 
              </mx:Spacer>
                  <mx:HBox width="537">
                      <mx:Label text="Weight" width="190" height="34" id="labelWeight" styleName="labelWeight"/>
                      <mx:TextInput width="333" height="35" id="textWeight"/>
                  </mx:HBox>
                  <mx:HBox width="536">
                      <mx:Label text="Exercise Type" width="190" id="labelExerciseType" enabled="true" styleName="labelExerciseType"/>
                      <mx:ComboBox height="29" width="336" id="comboExerciseType"></mx:ComboBox>
                  </mx:HBox>
                  <mx:HBox width="100%">
                      <mx:Label text="Duration (min)" width="187" id="labelDuration" styleName="labelDuration"/>
                      <mx:TextInput height="28" width="339" id="textDuration"/>
                  </mx:HBox>
                  <mx:HBox width="100%">
                      <mx:Spacer width="190"/>
                      <mx:RadioButton label="Pounds" fontWeight="bold" fontSize="20" fontFamily="Georgia" groupName="rdoWeight" selected="true" id="rdoPounds" width="171" styleName="rdoPounds"/>
                      <mx:RadioButton label="Kilograms" fontWeight="bold" fontSize="20" fontFamily="Georgia" groupName="rdoWeight" id="rdoKilograms" styleName="rdoKilograms"/>
                  </mx:HBox>
                  <mx:HBox width="100%">
                      <mx:Button label="Calculate" fontWeight="normal" fontSize="20" fontFamily="Georgia" click="getCalories(event) " id="buttonCalculate" styleName="buttonCalculate"/>
                  </mx:HBox>
                  <mx:Label text=" " fontWeight="bold" fontSize="20" fontFamily="Georgia" width="508" id="resultOfCalculation" styleName="resultOfCalculation" enabled="true"/>
                 
              </mx:VBox>
             
          </mx:Panel>
      </mx:Application>

       

       

       

      I will thank you for insight!