title: actionScript3 and JSON: can't figure how to adapt code to the keyframe
body: <p>SO, I'am new actionScript and JSON and can't figure out how to adapt the code to be able to paste it to the keyframe. I've got the code from.</p>
  
  <p><a href="http://snipplr.com/view/56283/" rel="nofollow">http://snipplr.com/view/56283/</a></p>
  
  <p>I get the Compiler error.</p>
  
  <p>Scene 1, Layer 'AC', Frame 1, Line 2 1037: Packages cannot be nested</p>
  
  <pre><code>package 
  {
      import flash.display.Sprite;
      import flash.events.Event;
      import flash.net.URLLoader;
      import flash.net.URLRequest;
  
      import com.adobe.serialization.json.JSON;
  
  
      public class Main extends Sprite 
      {
  
          private var _jsonPath:String = "json_example.txt";
  
          public function Main():void 
          {
              if (stage)
                  init();
              else
                  addEventListener(Event.ADDED_TO_STAGE, init);
          }
  
          private function init(e:Event = null):void 
          {
              removeEventListener(Event.ADDED_TO_STAGE, init);
  
              var loader:URLLoader = new URLLoader();
              var request:URLRequest = new URLRequest();
              request.url = _jsonPath;
              loader.addEventListener(Event.COMPLETE, onLoaderComplete);
              loader.load(request);
          }
  
  
          private function onLoaderComplete(e:Event):void 
          {
              var loader:URLLoader = URLLoader(e.target);
              var jsonArray:Array = JSON.decode(loader.data);
  
              trace("loader.data: " + loader.data);
  
              trace(jsonArray[0].Id);
              // 7
  
              trace(jsonArray[0].Mentions[0].Id);
              // 5
  
              trace(jsonArray[0].Mentions[0].StatusId);
              // 34
  
              trace(jsonArray[0].Mentions[0].CreatedDateTime);
              // /Date(1310051914617+0100)/
  
              trace(jsonArray[0].Mentions[0].Text);
              // Text
  
              trace(jsonArray[0].Mentions[0].UserName);
              // Username
  
              trace(jsonArray[0].Mentions[0].UserLocation);
              // UK
  
              trace(jsonArray[0].Mentions[0].UserLanguage);
              // en-GB
  
              trace(jsonArray[0].Mentions[0].IsCheckIn);
              // true
  
              trace(jsonArray[0].Tips[0].Id);
              // 5
  
              trace(jsonArray[0].Tips[0].FourSquareId);
              // 7e06c4b2-1fb5-4f35-9619-c99a384f5ae7
  
              trace(jsonArray[0].Tips[0].CreatedAt);
              // /Date(1310051914636+0100)/
  
              trace(jsonArray[0].Tips[0].Text);
              // Text
  
              trace(jsonArray[0].Tips[0].Username);
              // Username
  
              trace(jsonArray[0].Checkins);
              // 0
  
              trace(jsonArray[0].HereNow);
              // 0
  
              trace(jsonArray[0].TimeStamp);
              // /Date(1310051914639+0100)/
  
              trace(jsonArray[0].Venue.Id);
              // 7
  
              trace(jsonArray[0].Venue.FoursquareId);
              // cacbf3bd-f0aa-403d-9f9b-2056b4985ba1
  
              trace(jsonArray[0].Venue.Name);
              // Venue Name
          }
      }
  }
  </code></pre>