3 Replies Latest reply on Mar 21, 2011 9:31 AM by Joan Llenas

    ActionScript Project question

    Zolotoj Level 3

      I am creating a new project. This time I want to create a new ActionScript project. I can run it right away, but I can't add any Spark components. Am I going completely wrong?

       

      Thanks

        • 1. Re: ActionScript Project question
          Joan Llenas Level 1

          To target Flex components you have to create a Flex project as ActionScript projects don't have Flex libraries and basic infrastructure linked.

          If you want to add Flex components to an ActionScript application you should think on loading a sub-application but you'll need a separate Flex project for that anyway.

           

          What is the reasoning behind using an ActionScript only project?

           

          cheers

          • 2. Re: ActionScript Project question
            Zolotoj Level 3

            I am working on some sample code I got from the web, but I can't get it work. It looks like an ActionScript project, not sure though.

            Here is code:

            package InventoryApplication {
                import mx.core.Application;
                import flash.events.Event;
                import mx.controls.DataGrid;
                import mx.collections.*;
                import Data.*;

                public class HomeApplication extends Application {

                    public var inventoryGrid:DataGrid = new DataGrid();

                    public function InventoryApplication() {
                        super();
                        LoadInventory();
                    }

                    public function LoadInventory () : void {
                        var repository:InventoryRepository = new InventoryRepository ();
                        repository.GetInventory(function(data:Object) : void {
                            inventoryGrid.dataProvider = data;
                        });
                    }
                }
            }
            can't make any sense of it.
            • 3. Re: ActionScript Project question
              Joan Llenas Level 1

              That's a Flex < 4 project.

              The class extends mx.core.Application.

              It's knid of weir because normally you use mxml to declare you entry point class but it works in this way as well.

              You'll need to create a Flex project (3.x I would suggest) and add the provided files.

               

              cheers