2 Replies Latest reply on Feb 24, 2010 12:01 PM by alice_data

    Cannot Resolve a Multiname Reference Unambiguously

    alice_data Level 1

      Hi,

       

      I have 2 Actionscript classes here that I use for my Flex app, and for some reason I get this error: Can not resolve a multiname reference unambiguously. map:SvgMap_usaMap (from map\SvgMap_usaMap.as) and colorize:SvgMap_usaMap (from colorize\SvgMap_usaMap.as) are available.

       

        Here are the two programs:

       

      package map {

       

           import colorize.*;

           import com.zavoo.svg.*; 

           import flash.display.Sprite;

           import flash.events.Event;

           import flash.net.URLLoader;

           import flash.net.URLRequest;

           import flash.net.URLVariables;

           import mx.core.UIComponent;

          public class SvgMap extends UIComponent {  

       

               public var canvas:Sprite;

              [Embed(source="USA.svg")]

              public var usaMap:Class;

              public var paths:SvgPaths;

              private var from:Array;       

              private var stateColors:Array;

       

          public function SvgMap():void {

       

                      canvas = new usaMap();

                      canvas.width = 650;

                      canvas.height = 500;

                      addChild(canvas);                                      

              }

       

           public function setParameters(passedArray:Array,passedArray7:Array):void {

       

                  from = passedArray;

                stateColors= passedArray7;

                  changeMap(from,stateColors);

       

              }     

       

              public function changeMap(passedArray:Array,passedArray7:Array):void{

       

       

              canvas = new Sprite();

              addChild(canvas);           

       

              var from_string:String =from.join("-");

              var state_colors_string:String = stateColors.join("-"); 

       

              var loader:URLLoader = new URLLoader();

              var url:String = "http://localhost/generic.php";     

              var request:URLRequest = new URLRequest(url);

              var variables:URLVariables = new URLVariables();

              request.method = "POST";

              variables.from = from_string;

              variables.state_colors = state_colors_string;

              request.data = variables;

              loader.load(request);     

              loader.addEventListener(Event.COMPLETE, onLoadComplete);

       

              }     

       

              public function onLoadComplete(event:Event):void  {

       

                      var loader:URLLoader = URLLoader(event.target);          

                      paths = new SvgPaths(loader.data);                         

                      paths.drawToGraphics(canvas.graphics, 2, 10, 10);

       

                  }         

          }

       

      }

       

      Program 2:

       

      package colorize
      {
           import map.SvgMap;    
           import mx.controls.HSlider;
           import mx.controls.sliderClasses.SliderDirection;
           import mx.events.SliderEvent;
         
          public class Slider extends HSlider {
             
           public var i:int;
           public var j:int;
           public var next_number:int;
           public var num:Number;
           public var count:Number;  
           public var color_class:String = new String();
           public var colorsArray:Array = new Array("#000033","#663333","#CC3333","#FF3300","#FF6600","#0000FF","#3333FF","#0DCCFF","#F F9999","#FFCCCC","#FFFFCC"); //map colors
           public var color:int;
           public var stateColors:Array;   
           public var myNumber:Number;
           public var svgmap:SvgMap = new SvgMap();

       

           private var from:Array;       
           private var change_map:Function;
                
           public function Slider(){
                  super();
                         
                  this.direction = SliderDirection.HORIZONTAL;
                  this.id = "hSlider";
                  this.dataTipFormatFunction = myDataTipFunc;
                  this.minimum = 1;
                  this.labels = [this.minimum, this.maximum];
                  this.maximum = 10;
                  this.value = 5;           
                  this.liveDragging = true;
                  this.tickInterval = 10;
                  this.allowTrackClick = true;
                  this.height =  80;
                  this.snapInterval = 1;                            
              }           
             
              public function setPatientFrom(passedArray):void { from = passedArray;    }       
         
               public function myDataTipFunc(val:String):String {
                      myNumber = Number(val);
                      var roundedValue:String= String(myNumber.toFixed(0));           
                      calculation(myNumber);
                      svgmap.setParameters(from,stateColors);        
                      return "Current value: " + roundedValue; //Anything after is not going to be executed               
                  }       
             
              public function calculation(myNumber:Number):void {
                 
                  count = from.length;       
                  num = Math.round(count/myNumber);       
                  i= 1;
                  var sliderNumbers:Array = new Array();
                  while (i < myNumber) {
                 
                    sliderNumbers.push(num);
                    next_number = i + 1;
                    num = Math.round(from.length/myNumber)* next_number;
                    i++;             
                  }                        
                  colorLayout(sliderNumbers,count);      
              }
             
                public function colorLayout(sliderNumbers:Array,count:Number):void{           
                 
                  stateColors = new Array();           
                  for (j=0;j<count;j++){ //use total instances and not the highest number
                             
                  if(j<=1) color=10;               
                  else if(j<=sliderNumbers[0]) color=9;               
                  else if(j<=sliderNumbers[1]) color=8;      
                  else if(j<=sliderNumbers[2]) color=7;
                  else if(j<=sliderNumbers[3]) color=6;
                     else if(j<=sliderNumbers[4]) color=5;
                  else if(j<=sliderNumbers[5]) color=4;
                  else if(j<=sliderNumbers[6]) color=3;
                  else if(j<=sliderNumbers[7]) color=2;               
                  else if(j<=sliderNumbers[8]) color=1;               
                  else if(j<=sliderNumbers[9]) color=0;            
                  else {
                      //don't do a thing
                  }           
                   color_class = colorsArray[color];        
                   stateColors.push(color_class); //Add the color_class to the stateColors array     
                     }       
              }   
           }
      }

       

      Could anyone please give me some pointers on why I am getting this error, and how I can fix this?

      Thanks for your help.