3 Replies Latest reply on Dec 22, 2009 12:36 AM by golubev.pavel

    Application.application.parameters throws exception

    golubev.pavel

      Hello.

       

      I'm very new in Flex. Trying to pass FlashVars to some class in my application and getting exception.

       

      My ChristmasTree.mxml looks like:

       

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="807" height="730">

      <mx:Script>

      <![CDATA[

      import ru.vkontakte.apps.controllers.ApplicationController;

       

      private var app:ApplicationController = new ApplicationController(Application.application.parameters);

      ]]>

      </mx:Script>

      </mx:Application>

       

      And my ApplicationController is:

       

      package ru.vkontakte.apps.controllers

      {

       

      public class ApplicationController

      {

      private var params:Object;

       

      public function ApplicationController(params:Object)

      {

      this.params = params;

      }

       

      }

      }

       

      Why am I getting exception and how do I pass params to my class?

       

      TypeError: Error #1009: Cannot access a property or method of a null object reference.

      at ChristmasTree()[/Users/golubeff/dev/flash_test/ChristmasTree/src/ChristmasTree.mxml:7]

      at _ChristmasTree_mx_managers_SystemManager/create()

      at mx.managers::SystemManager/initializeTopLevelWindow()[C:\autobuild\3.2.0\frameworks\proje cts\framework\src\mx\managers\SystemManager.as:3188]

      at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::docFrameHandler()[C:\autobuild\3.2.0\framework s\projects\framework\src\mx\managers\SystemManager.as:3064]

      at mx.managers::SystemManager/docFrameListener()[C:\autobuild\3.2.0\frameworks\projects\fram ework\src\mx\managers\SystemManager.as:2916]