ActionScript

From WidgetAvenue Wiki

Jump to: navigation, search

Using ActionScript (AS3), it is possible to access the Javascript waJS library. This is particularly interesting for contextual functions.


Contents

Triggering waJS functions

waJS functions can be triggered from AS3 using the following method:

ret = ExternalInterface.call([Name Of waJS function]);

Getting the ldWidgetUid_ prefix

Standard functions in the waJS library are prefixed with "ldWidgetUid_", which is replaced by a unique id at runtime. The value of this prefix is sent as a FlashVar, so you can use the following approach if you need to trigger a function with a "ldWidgetUid_" prefix (for example ldWidgetUid_getPref):

var ldWidgetUid:String = LoaderInfo(this.root.loaderInfo).parameters.uid;
ret = ExternalInterface.call(ldWidgetUid+"_getWidgetPref",prefname);

Using a callback

waJS functions are sometimes asynchronous, so you will need to use the ldWidgetUid_flashCallback function in waJS.

waJS Library

Personal tools