I have small application that allows the user to design their own sign.
One of the options is to load an animation from a combo box and preview it on the sign. The animation is loaded into a movie clip but does not constrain to the mc size when initially loaded.
If I click the button to create the sign (perform the drawSign function) the animations will load inside the mc to their constrained sizes.
I need to have this happen automatically as not to confuse the user.
**Frame Code:
**
// C// Constants
stageWidth = 550;
stageHeight = 400;
// Functions
function drawSign(){
mc_sign._width = width_txt.text*2;
mc_sign._height = height_txt.text*2;
message_txt.text = message_input_txt.text;
message_txt._height = height_txt.text*2;
message_txt._width = width_txt.text*2;
//Centers sign & message
mc_sign._x = (stageWidth / 2) - (mc_sign._width / 2);
mc_sign._y = (stageHeight / 2) - (mc_sign._height / 2);
message_txt._x = (stageWidth / 2) - (message_txt._width / 2);
message_txt._y = (stageHeight / 2) - (message_txt._height / 2);
}
import mx.controls.ComboBox;
import mx.transitions.Tween;
import mx.transitions.easing.*;
//create components in sence
createClassObject(ComboBox,"myCombo",this.getNextHighestDepth(),{_x:10,_y:10});
//init component and easing
myCombo.setSize(350);
myCombo.setStyle("openDuration",500);
//add comboBox item
links=new Array();
links.addItem({label:"Choose an Animation",data:""});
links.addItem({label:"July 4th",data:"july4.swf"});
links.addItem({label:"Thanksgiving",data:"thanksgiving.swf"});
//set listener
myListener=new Object();
myListener.change=function(){
var holder=_root.mc_sign;
holder.loadMovie(links[myCombo.selectedIndex].data);
}
myCombo.addEventListener("change",myListener);
myCombo.dataProvider=links;
// Main
drawSign();
Perform Function Button Code:
on(release){
drawSign();
}
You can see a working example of the application here:
http://www.tlxcommercial.com/new/sign.html
My .fla is available here:
http://www.tlxcommercial.com/new/sign.fla
Thanks for the help.