Question

I want to use vkontakte's new wrapper feature, that enhances your application abilities by running under SWF wrapper.

This is a sample application that uses this mechanism. It uses pure action script to display it's contents rather than an mx:Application.

Using the wrapper on my mx:Application failed due to the following error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
 at mx.managers::FocusManager/activate()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\FocusManager.as:702]
 at mx.managers::SystemManager/activateForm()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\SystemManager.as:2493]
 at mx.managers::SystemManager/activate()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\SystemManager.as:2451]
 at mx.core::Application/initManagers()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Application.as:1152]
 at mx.core::Application/initialize()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Application.as:834]
 at DummyApp/initialize()[C:\Users\Eran.HOME\Documents\Web Projects\MaxiMarketing\TestMarketing\src\DummyApp.mxml:0]
 at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::childAdded()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\SystemManager.as:2127]
 at mx.managers::SystemManager/initializeTopLevelWindow()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\SystemManager.as:3396]
 at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::docFrameHandler()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\SystemManager.as:3219]
 at mx.managers::SystemManager/docFrameListener()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\SystemManager.as:3065]

So I figure I could create a wrapper to the wrapper that can launch my application and came up with this (DummyApp is the application I want to lunch):

package 
{
 import Components.SidePanel;

 import flash.display.Sprite;
 import flash.events.Event;

   public class AppWrapper extends Sprite 
   {    
     public function AppWrapper() {
      this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
     }

     public function onAddedToStage(e: Event): void {
      var mainApp:DummyApp = new DummyApp();

      this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage); 
     }
   }
}

Unfortunately - it also failed, and the question remains, how to start Application from a simple AS file?

Was it helpful?

Solution 2

Vkontakte's wrapper is now supporting Flex, which makes this question obsolete.

OTHER TIPS

Are you trying to make a pure actionscript project or a flex application project (former does not use the Flex Framework, latter does)? You'd need at least an application mxml file to use the Flex framework. If you create an "Actionscript project" in Flex, the main application file (.as) will be your "document class" or wrapper. Here's a related post on using an Actionscript Application wrapper:

Possible to use Flex Framework/Components without using MXML?

You'll see here though that you still need to use a bit of mxml to "init" the actionscript class.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top