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]; }
}
}

Monday, March 17, 2008

Don't do this

While coding Acion script try to specify targets precisely. This also refers to getNextHighestDepth(), otherwise it may not work. Dont waste you time :-)

Macromedia help suggests - this.attachMovie("circle", "circle1_mc", this.getNextHighestDepth()); - just don't be stupid and use something like -

StarMap.attachMovie("star", "star"+ starId, StarMap.getNextHighestDepth());