Hey everyone. I’m having some problems getting this to work exactly the way I want it to.
What I am wanting to do is generate a movieclip with a textField inside. These will each be created in a forLoop so that they will be created in accordance to a number of photos that I am loading. Each number (the movieclip with the textField inside) should then be able to be clicked on to change the currently loaded photo.
Here is what I have so far:
function setFormat(){
var format = new TextFormat();
format.bold = true;
format.color = 0x580028;
format.font = “_sans”;
pic_mc.curPic.autoSize = true;
pic_mc.curPic.selectable = false;
pic_mc.curPic.setTextFormat(format);
};
function loadNumbers(){
var pictures = my_xml.firstChild.childNodes;
for (var i = 0; i < pictures.length; i++){
var currentPicture = pictures*;
var pic_mc = _root.createEmptyMovieClip(“loader_mc” +i, i);
pic_mc._x = (i * spacing) + 40;
pic_mc._y = playPause._y;
pic_mc.createTextField(“curPic”, +i, 0, 0, 50, 50);
pic_mc.curPic.text = i + 1;
setFormat();
load_main = currentPicture.attributes.url
pic_mc.image = load_main;
loader.loadMovie(currentPicture.attributes.url);
pic_mc.onRelease = function(){
loader.loadMovie(this.image);
};
};
};
The problems I am having are:
- For some reason the setFormat() function isn’t being called.
- The movieClip with the textField inside has a huge hit area and I don’t understand why that is, and I want it to only be the size of the text field.
Thanks
Update - sorry quick update. When I move:
pic_mc.curPic.autoSize = true;
pic_mc.curPic.selectable = false;
inside the forLoop it fixes the problem I was having with the size of the hit box. I still can’t figure out why the I am unable to call the setFormat() function however.