Advertisement
Advertisement
| 03.22.2008 at 11:15AM PDT, ID: 23261680 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: |
// HowTo: Dynamically Create an Associative Array?
// The Static Way (Known)
var oBeatles:Object = new Object();
oBeatles["bass"] = "Paul McCartney";
trace("Hard Coded: " + oBeatles.bass);
// The Dynamic Way (???)
// 1.) I Create an Associative Array Object (globally, so both functions couold access it)
var oColl:Object = new Object();
// 2.) Created a function to add a key to the array
function addKey(oArray:Object, kName:String):String
// this function dynamically creates a Key in the Array
{
// a. create a new key for the object
oArray[kName] = kName; // adds a key called "name" to the array
var akSuccess:String = "Key added: " + oArray[kName];
return akSuccess;
}
// 3.) Create a function to add a value to the newly created key
function addKeyValue(oArray:Object,kValue:String):String
// this function dynamically adds ther value tot eh newly create key
{
oArray["kName"] = kValue;
// compile success message
var akvSuccess:String = "Key Value added: " + oArray["kName"];
return akvSuccess;
}
// I want this to display the VALUE (Paul McCartney) of the Bass Key
trace(addKeyValue("Dynamic: " + oColl.Bass));
|