Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should be able to create a package to accomplish this. The basic format is:</p> <pre><code>// folder specifies the relative folder of the package package myfolder { // whatever other classes you need import flash.display.*; import flash.events.*; // base this on whatever class you need (in this case MovieClip) public class myclass extends MovieClip { private var myvariable: String; // constructor public function myclass() { } // functions only for use within the class private function myprivatefunction() { } // functions for use by the rest of the world public function mypublicfunction() { } } } </code></pre> <p>The constructor is called when you create a new instance of the Class-- this is where you would do your initialization. Then, in your timeline, just add something like:</p> <pre><code>import myclass; var myclassinstance = new myclass(); myclassinstance.mypublicfunction(); // call a function in the class </code></pre> <p>See <a href="http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7f9e.html" rel="nofollow">adobe's help</a> for more details.</p> <p><hr> So I tried this:</p> <pre><code>package { import flash.display.*; public class Node { public var fX:Number; public var fY:Number; public var bmp:Bitmap; public function Node() { } } } </code></pre> <p>And put it in a file called Node.as (note I needed to add the flash.display import, and the <b>capital "N" in the filename</b>). In a FLA file in the same directory, I added this to the first frame script:</p> <pre><code>import Node; var node = new Node(); trace("node="+node); </code></pre> <p>It compiled and ran without error. There must be something else going on? What version of Flash and of ActionScript are you using?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload