Tuesday, March 18, 2008

Dynamic buttons with dynamic text in Flash


After wasting time to build button with text that I can change I finally found a solution
1. Draw shape and convert it to button
2. Draw dynamic text field and convert it to movie clip
3. Provide both objects with IDs and linkage information
4. Position objects as you need, select both, and combine in a movie clip - with a proper linkage id 5. Add some dynamics like
for (star=0; star{
sb[star] = StarMap.attachMovie("StarSym", "star"+star, StarMap.getNextHighestDepth());
for (attr in stars[star].attributes) {
if (attr == "x") { this.sttrace(sb[star]._x); sb[star]._x = stars[star].attributes[attr]; }
if (attr == "y") { sb[star]._y = stars[star].attributes[attr]; }
if (attr == "name") { sb[star].starName.label.text = stars[star].attributes[attr]; }
}
}

No comments: