• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 131
  • Last Modified:

how do I import packages

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

1 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 MatrixExample.as

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

var myME:MatrixExample = new MatrixExample();
petersegoAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Tackle projects and never again get stuck behind a technical roadblock.
Join Now