1
我想写适用TextFormats他们属于TextField的功能应用的格式。 问题是,我没有管理它进入正确的“表格”(如果甚至有一个正确的形式)。AS3通过功能
我的功能看起来像这样的时刻
function applyFormat(TextFild:String,Format:String,EmbFont:String,NameInJson:String){
//
//example:applyFormat("myTextField","myTextFormat","myFont","TextStuff")
//
//myData=json object
//all textfields etc. already exist. Just anyone wants to ask if they've been already generated.
//at first i thought it could be as easy as this
this[Format].font=myData.NameInJson.Font //doesn't work obviously
//then I tried this method
this[Format].font=myData.this[NameInJson].Font //doesn't work either
//couldn't find a real solution for this on the internet...
//how it should turn out in the end: myTextFormat.font=myData.TextStuff.Font
}
的myData的相关部分看起来是这样的:
"TextStuff":
{
"Font":"Arial",
"Size" : "16",
"Bold" : "true",
"Color" : "0xFFFFFF"
}
,我需要改变我的JSON文件,使这个可能吗? 我忽略了一种处理这种变量/值的方法吗?
我打我的额头,当我哇阅读这个解决方案。 它就这么简单!为什么我没有想到这个?我觉得这么愚蠢现在... 无论如何,非常感谢您的解决方案,它帮助了我很多!(会给予好评,如果我有足够的声誉...) – 2013-03-07 09:40:03
不客气:) – 2013-03-07 13:52:01