2014-01-10 3 views
2

В приведенном ниже коде я не могу понять, почему я получаю эту ошибку: Не удается однозначно разрешить многоуровневую ссылку. spark.components: Ярлык работал раньше, и теперь я просто получаю сообщение об ошибке.Spark Label Unamigyious Issue

<?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" width="800" height="523" maxWidth="800" maxHeight="523" initialize="httpService.send()" showStatusBar="false" backgroundColor="white" backgroundAlpha="1"> 
    <fx:Script> 
     <![CDATA[ 
      import mx.collections.ArrayCollection; 
      import mx.controls.Label; 
      import mx.rpc.events.ResultEvent; 

      public var returnData:ArrayCollection; 

      protected function httpService_handler(event:ResultEvent):void{ 
       returnData = event.result.people.person; 

       for(var i:int = 0; i < 5; i++){ 

        var lbl:Label = new Label(); 
        lbl.text = "News Item " + i; 
        //newsHGroup.addElement(lbl); 
       } 
      } 
     ]]> 
    </fx:Script> 
    <fx:Style> 
     @namespace s "library://ns.adobe.com/flex/spark"; 
     @namespace mx "library://ns.adobe.com/flex/mx"; 


    </fx:Style> 
    <fx:Declarations> 
     <!-- Place non-visual elements (e.g., services, value objects) here --> 
     <s:HTTPService id="httpService" url="http://pipingautos.com/~nibbrco/glen-dev-folder/air/school-catch-up/test.php" result="httpService_handler(event)" /> 
    </fx:Declarations> 

    <s:BorderContainer borderVisible="false" mouseDown="nativeWindow.startMove();" skinClass="MainStyle" width="800" height="523" id="container"> 
     <s:Group id="newsSlider" left="435" top="120" height="100" width="340"> 
      <s:Rect width="100%" height="100%" id="backRect"> 
       <s:fill><s:SolidColor color="0xc7d1e5" alpha="0.5" /></s:fill> 
      </s:Rect> 
      <s:HGroup> 
       <s:Label text="testing" /> 
      </s:HGroup> 
     </s:Group> 

    </s:BorderContainer> 
</s:WindowedApplication> 

ответ

4

Вы путаете spark.components.Label с mx.controls.Label. Ярлык в вашем коде AS является mx (см. Инструкцию import), но ярлык в вашем коде mxml - это версия Spark (см. Пространство имен s).
Они на самом деле вид - один и тот же компонент; первый - эквивалент Flex 4 последнего, который является компонентом Flex 3.
Поскольку вы, кажется, строите приложение Flex 4, просто придерживайтесь версии Spark. Просто замените Ое «импорт» заявление с искровыми классами:

import spark.components.Label 
+0

Обратите внимание, что если вы хотите, чтобы отобразить список лиц, вы бы лучше быть с помощью списка или DataGroup вместо добавления меток «вручную». – RIAstar