Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 128
  • 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

0
petersego
Asked:
petersego
1 Solution
 
moagriusCommented:
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();
0
 
petersegoAuthor Commented:
Thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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