Note that there are some explanatory texts on larger screens.

plurals
  1. POcustom imports/non-local classes in as3
    text
    copied!<p>I was attempting to use <a href="http://www.adobe.com/devnet/actionscript/learning/as3-fundamentals/packages.html" rel="nofollow">this</a> and <a href="http://www.kirupa.com/forum/showthread.php?316549-AS3-How-to-import-and-use-my-custom-class" rel="nofollow">this</a> to figure out how to set up some math classes (the sin/cos functions I use for anything top down.) but I have it set to import package.class (the names of course.) but It said that "defintion package:Class not found". This confuses me and I am going to assume I have to do something with folders. However I'm not sure what folders to put it in/what to do to enter things specifically in a folder.</p> <pre><code>//import sthreets.CustomFuncs; private function Movement() { if(LEFT==true) { rotation=rotation-6; } if(RIGHT==true) { rotation=rotation+6; } if(UP==true) { //x=x+CustomFuncs.TopDownMove("x", rotation, 0); //y=y+CustomFuncs.TopDownMove("y", rotation, 0); } if(DOWN==true) { //x=x-CustomFuncs.TopDownMove("x", rotation, 0); //y=y-CustomFuncs.TopDownMove("y", rotation, 0); } } </code></pre> <p>Commented out stuff was giving me errors, here's the CustomFuncs code.</p> <pre><code>package sthreets { public class CustomFuncs { public function CustomFuncs() { } public function TopDownMove(xy:String, rot:Number, offSet:Number):Number { if(xy=="x") { return cos(DegreesToRadions(rot)+offSet) } if(xy=="y") { return sin(DegreesToRadions(rot)+offSet) } } public function DegreesToRadions(rot:Number):Number { return rot*Math.PI/180; } } } </code></pre>
 

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