This content has been marked as final. Show 4 replies
I don't know what's up with that either, I have to put the code to import the file(s) on the same frame as where I used them. I use the Tween class frequently and it's kind of an annoyance to have to put them on the same frame all the time.
I thought maybe it would be possible to create a global function and call them that way but that didn't work either...
¿ Confused ¿
Because that is how it works.
Remember, import doesn't actually "import" anything. It is just a shortcut so you don't have to type the whole package name every time you use the coded in your example.
It is actually kind of nice when you come back to code later or if you open somebody else's code (that you have to update or change) and to see at the top, "Oh, this bit of code has a reliance on class blah.blah.Yadda." In a way it kind of helps enforce a bit of good coding practice.
imjustabeginner - there are probably a lot of ways to avoid this. One of the easiest, but probably not the best. Is to make a layer above (or below) your actionscript layer and call it functions. Then make a reusable function so that you can just send that function your instances and some params and it will handle applying the Tween class for you.
That works. I was trying to break it apart into 3 layers.
3. All other conditional business logic
But by ensuring that you only have the use of the class in the function you can combine 1 and 2 above and 3 can be used to make the calls to the functions.