|
From: Alias <ali...@gm...> - 2006-01-22 13:45:51
|
Hi Luke,
> - Before you go too far, you should make absolutely certain that compilin=
g
> with "trace" turned off, actually omits objects (other than string
> primitives) that were referenced in trace statements from the SWF. I susp=
ect
> that the only way to remove trace statements is to perform the removal
> "after" the source has been tokenized. I could certainly be wrong about
> this, but it is possible that the compiler does not re-run dependency
> analysis after trace removal. If this is the case, wrapping these referen=
ces
> in trace statements probably would not work.
I've done some cursory tests - it seems that a singleton class,
wrapped in a trace statement *does* get removed by the compiler if it
is only referenced by the trace statements. My test code below:
//class
class com.proalias.SomeSingleton {
=09
=09private static var $instance : SomeSingleton;
=09
=09private function SomeSingleton() {
=09=09
=09}
=09
=09public function helloWorld() : String {
=09=09return ("hello world");=09
=09}
=09
=09/**
=09 * @return singleton instance of SomeSingleton
=09 */
=09public static function get instance() : SomeSingleton {
=09=09if ($instance =3D=3D null)
=09=09=09$instance =3D new SomeSingleton();
=09=09return $instance;
=09}
}
//in .fla
import com.proalias.SomeSingleton;
trace("someSingleton:"+SomeSingleton.instance.helloWorld());
Does anyone see any potential problems with this approach?
Let me know,
Alias
|