开发者

Referencing Flashbuilder Views by their string name

开发者 https://www.devze.com 2023-03-17 05:17 出处:网络
I have a TabbedViewNavigator application with a navigatory bar which opens view just fine.In each view there is a ButtonBar that will open a new view related to the parent view. I have a single handle

I have a TabbedViewNavigator application with a navigatory bar which opens view just fine. In each view there is a ButtonBar that will open a new view related to the parent view. I have a single handler which decodes the name of the button and can build a string with the name of the view to be opened. I am looking for some way of referencing the view from this string, in a similar fashion to this["someName"] or getDefinitionByName("someName"). In my code, 'this' refers to the current view and the views 开发者_高级运维that I need to find are not child elements. I don't know where getDefinitionByName() is looking, but it can't find the view either.

I have solved it temporarily with a switch statement, but this is not a good solution. Is there a view collection; if so, who is the owner of the collection or am I not going about this in the correct way.

Thanks for reading this far.


If the view is in a package/folder, you need to supply the full package to getDefinitionByName:

var viewClass : Class = getDefinitionByName("com.us.project.AwesomeView");

var view : DisplayObject = new viewClass();
0

精彩评论

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