how do I import packages

Posted on 2009-12-16
Last Modified: 2013-11-11
I simply cant seem to import packages like in the .as-file below.
It is placed in the same folder as my .fla-file that is totally empty.
I have been told that I do not have to do anything if the package havent got a name.
The package is an example from the help-menu that should show something, but what should I do in the .fla-file to have it show me the example...
package {

    import flash.geom.Matrix;

    import flash.display.Sprite;

    import flash.display.GradientType;

    public class MatrixExample extends Sprite {

        public function MatrixExample() {

            var myMatrix:Matrix = new Matrix();

            trace(myMatrix.toString());    // (a=1, b=0, c=0, d=1, tx=0, ty=0)

            myMatrix.createGradientBox(200, 200, 0, 50, 50);

            trace(myMatrix.toString());    // (a=0.1220703125, b=0, c=0, d=0.1220703125, tx=150, ty=150)

            var colors:Array = [0xFF0000, 0x0000FF];

            var alphas:Array = [100, 100];

            var ratios:Array = [0, 0xFF];

            graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, myMatrix);

            graphics.lineTo(0, 300);

            graphics.lineTo(300, 300);

            graphics.lineTo(300, 0);

            graphics.lineTo(0, 0);




Open in new window

Question by:petersego
    LVL 19

    Accepted Solution

    you don't need to use any imports if that .as file is in the same directory as your fla.  it must be named

    to instantiate an instance of the class, you'd simply use:

    var myME:MatrixExample = new MatrixExample();

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
    Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
    The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
    The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now