At 9/10/07 07:07 PM, The-Super-Flash-Bros wrote:
Hmm, best I can think of is this:
import flash.events.TimerEvent;
import flash.utils.Timer;
mc.gotoAndStop(2);
var t:Timer = new Timer(1, 1);
t.addEventListener(TimerEvent.TIMER, function(){mc.mc2.alpha = 0.1;});
t.start();
Here I'm setting the alpha of mc2 which resides in the second frame only of mc. Annoying and roundabout, but it looks like it might be needed :(
Tom-
hmm interesting solution. Damn it that's annoying though.
Too bad flash doesn't support overloading of operators or functions though it would make it a lot easier to just override gotoAndPlay().
Speaking of which, AS3 attempts to bring flash closer to lower level languages like c++ and the such, however it's missing a lot of things that would make it even better and I think I'll just list a few right here that I REALLY wish flash had (not including anything involving hardware like graphics cards or direct speaker output etc).
1. Operator Overloading- Making a custom math class would be SO MUCH easier if I could use + instead of class.add(stuff). It would also make resulting codes much more readable.
2. Function Overloading- Along the same lines, being able to overload a constructor would make a class much more manageable.
3. Memory Management- If I send a value to a function in flash, I should be able to specify if I'm sending a copy of the data or a reference to the data. That way I can avoid accidental modification of variables and such.
4. Proper Scoping- If I declare a variable in a loop, the variable should be deleted after the loop is over. having multiple for loops that all use i as the looper thing get annoying when I get 50 errors about "redefining variables".
5. Inline Functions- Ever have a repeated block of code that you wish you could put in a function, however putting it in a function would require passing 50 variables to it? With inline functions you could just specify that the function blah() simply tells the compiler to replace blah() with the contents of the function. It's a compile-time function and not a run time function, so therefore you get a speed increase too. It seems like such a basic command I wonder why adobe didn't bother implementing it.
Also, a nuisance I have is the variable declaration.
var thingy:Number = 5
seriously, why? The code could easily be shorter, as most lower level languages do have it shorter.
in c++:
float thingy = 5
along those lines, we have int, how about float? Number is a nuisance to type out cause of the capital.
If AS3 is meant to be closer to a low level language, they should have gone a little farther. These basic functions wouldn't have changed flash too much, just added expanded features which most languages already support.
Also, I love flash's multi type expandable arrays. But the option for a more traditional single-type constant size array should still be included for speed purposes.
Anyway enough bickering, AS3 is great but they failed to fix some of the main issues that AS2 had.