1 Reply Latest reply on Nov 27, 2007 4:32 PM by peterent

    Getting errors

    Tigomark Level 1
      OK so here is my

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml" width="200" height="130" backgroundColor="#000000" color="#ff0000" fontSize="20">
      <mx:Script source="../asa/clock.as" />

      My AS file

      import flash.display.Sprite;
      import flash.events.TimerEvent;
      import flash.utils.Timer;

      public class ShortTimer extends Sprite
      public function ShortTimer()
      // creates a new five-minute Timer
      var minuteTimer:Timer = new Timer(1000, 300);

      // designates listeners for the interval and completion events
      minuteTimer.addEventListener(TimerEvent.TIMER, onTick);
      minuteTimer.addEventListener(TimerEvent.TIMER_COMP LETE, onTimerComplete);

      // starts the timer ticking

      public function onTick(evt:TimerEvent):void
      // displays the tick count so far
      // The target of this event is the Timer instance itself.
      trace("tick " + evt.target.currentCount);

      public function onTimerComplete(evt:TimerEvent):void

      and my application file

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" width="100%" viewSourceURL="srcview/index.html" height="100%"
      <mx:Style source="source.css"/>
      <mx:Image source="images/title.jpg" width="210" height="65" top="4" left="15"/>
      <mx:Image source="images/title1.jpg" id="image1" horizontalAlign="right" verticalAlign="top" width="784" height="58" y="3" right="0"/>
      <mx:XML id="tempXML" source=" http://something.net/interface.php?username=admin&amp;password=pass&amp ;customer=63&amp;action=showopen&amp;operation=def ects&amp;format=xml&amp;critcal=both" />
      <c:Red_co x="627" y="69" width="394" height="32" color="#ff0000" fontSize="25"/>

      <mx:XMLListCollection id="defectXMLList" source="{tempXML.defect}" />

      horizontalCenter="0" bottom="56" top="72" width="100%" backgroundColor="#000000" color="#ff0000" fontSize="27" borderColor="#000000" columnWidth="300" rowHeight="50" themeColor="#808080" fontWeight="bold" allowMultipleSelection="true"/>


      All this and I still get the error

      1037: Packages cannot be nested
        • 1. Re: Getting errors
          peterent Level 2
          When you use <mx:Script source="..." /> it is EXACTLY the same as:

          <![CDATA .... ]]>

          In other words, the content of the external AS file are brought into the MXML file and expanded in place, as if you had put those exact same lines into the <mx:Script> block. Since an MXML file is actually an ActionScript class, you cannot have a package and class definition within a class, as the error states.