开发者

Flex databinding function (non-getter)

I've got a flex application that is dependent on a class that slightly abstracts flex's resourceManager. The (pure AS3) class I'm using extends EventDispatcher, and deals with runtime loading of localization information as well as returning the translated tokens. I can't use the base resourceManager, as I don't want it to return null if the token is not found.

/endexposition

My problem comes when I attempt to make my getString function bindable.

[Bindable(event="bundleLoaded")]
public function getString...

The "bundleLoaded" event is dispatched appropriately. This function works cor开发者_开发问答rectly in 90% of the applications I'm involved in the development of. However, for ONE application, I get the following obfuscated error:

1084: Syntax error: expecting rightbrace before s. Resource=(ProjectName) Path=(null) Location=line 301

The application compiles and works (minus the bindings, obviously) before I add the [Bindable...] line, but after I add that line it refuses to compile correctly. There is nothing even mildly interesting located on line 301 of any of the application or support classes.

Any tips? Anyone have a similar experience?


Well, after searching through the generated code, I found an issue (which wiiiiill be bug reported to the flex sdk).

My code bound a text property to a resource (for localization).

That property used a ternary operation. Once I created this binding, the generated code stripped out the ":" and "?" from my ternary operation, and caused an error.

    myResourceManager.getString('bundle','token',[numDays, numDays != 1 ? 's' : ''])

The compiler turned that into...

    new mx.binding.FunctionReturnWatcher("getString", target, 
        function():Array 
        { return [ "bundle", "token", [target.numDays, target.numDays != 1"s"""] ]; }

Leaving me with a nice, ambiguous compiler error. Thanks for looking, guys! This one's fixed.

EDIT: If anyone's interested: https://bugs.adobe.com/jira/browse/SDK-30937

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜