Components in Flash Player 6

I have been developing ActionScript 2.0 classes and components for awhile now but until recently I have never tired publishing those components to run on Flash Player 6.

The problem I had was related to setter methods. I was using the [Insepectable] meta tag to add them to my component propeties panel. However, the setter methods were not getting called at run-time and my live preview was broken.

But I did find a solution…

In order for your classes to be compatable with Flash Player 6 and 7 you must implement the follow code into your class.

[as] class Test { private var clipParameters:Object = {parameter:1}; function Test() { initFromClipParameters(); } private function initFromClipParameters():Void { var key:String, found:Boolean = false; for(key in clipParameters) { if(this.hasOwnProperty(key)) { found = true; this[“def_” + key] = this[key]; delete this[key]; } } if(found) { for(key in clipParameters) { var v = this[“def_” + key]; if(v != undefined) { this[key] = v; } } } } } [/as]*The initFromClipParameters method was taken from the mx.core.UIObject class.

Leave a Reply

Your email address will not be published. Required fields are marked *