Well, few people knows about the logic operator “||=”. I’ll try to explain a little more about it.
In the adobe documentation, this operator is described like: “Assigns expression1 the value of expression1 || expression2″. Just to remember, the sintaxe to logic operator is “expression1 operator expression2“.
Compile error? Runtime Error? Nothing. The trace result is "Name: Bruno Sales". The variable was created even if the code inside the IF was never executed.
Thats happens because ActionScript has just 2 types of scope: Global and Local; remembering that Local is everything inside a function.
However, I suggest never using something like this in your development process. Your code logic will be very confusing and will cause problem to maintenance and debug.
Some time ago, I wrote a small introduction about 3D effects from Flash Player 10. Moving on with my studies and understanding better how FP10 works, I did this component that, even being commun to 3D framework users, works good as native and consequently low weight.
The component can receive any DisplayObject, letting the interactivity works fine.
The follow demo shows the component and some of its properties:
You can see here the source code.
(Don't forget it is a FP10 project. To make it works go to Project Properties > Flex compiler > Require Flash Player and fill with 10.0.0).