How to run an application from a simple AS file?

I want to use the vkontakte new wrapper feature that enhances your application experience by working under the SWF wrapper.

This is a sample application that uses this mechanism. It uses a pure script action to display its content, not mx:Application

.

Using the shell on mine 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 suppose I can create a wrapper for a shell that can launch my application, and came up with this ( DummyApp

is the application I want to dine in):

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 the application from a simple AS file?

+2


source to share


2 answers


The Vkontakte wrapper now supports Flex making this question obsolete.



0


source


Are you trying to create a pure ActionScript project or flex app project (the former doesn't use the Flex Framework, the latter does)? To use a Flex frame, you need at least an mxml application file. If you create an ActionScript Project in Flex, the main application (.as) file will be your "document class" or wrapper. Here is a related post on using the Actionscript Application Wrapper:

Can I use Flex Framework / Components without using MXML?



You will see here, although you still need to use the mxml bit for the "init" class actionscript.

+1


source







All Articles