I’m writing an image gallery and dynamically loading images and buttons. Almost everything is working out, but I’m having a problem: dynamically loaded buttons show their rollover actions just fine, but when when I use onLoadInit to attach an action to the button, the action works, but the button’s rollover quits working.
With this code, the button’s actions work:
// load a single main navigation button
function load_main_nav(clip_name,clip_url,clip_depth,clip_position,section_name) {
this.createEmptyMovieClip(clip_name, clip_depth);
var the_listener_name:Object = new Object();
the_listener_name.onLoadInit = function(target_mc:MovieClip) {
target_mc._x = 0 - 140;
target_mc._y = clip_position;
new mx.transitions.Tween(target_mc,"_x",mx.transitions.easing.Regular.easeOut,target_mc._x,0,2,true);
target_mc.onRelease = function() {
the_section = section_name;
trace(section_name);
}
}
var clip_loader:MovieClipLoader = new MovieClipLoader();
clip_loader.addListener(the_listener_name);
clip_loader.loadClip(clip_url,clip_name);
}
If I comment out the button action like this, the rollover works:
// load a single main navigation button
function load_main_nav(clip_name,clip_url,clip_depth,clip_position,section_name) {
this.createEmptyMovieClip(clip_name, clip_depth);
var the_listener_name:Object = new Object();
the_listener_name.onLoadInit = function(target_mc:MovieClip) {
target_mc._x = 0 - 140;
target_mc._y = clip_position;
new mx.transitions.Tween(target_mc,"_x",mx.transitions.easing.Regular.easeOut,target_mc._x,0,2,true);
// target_mc.onRelease = function() {
// the_section = section_name;
// trace(section_name);
// }
}
var clip_loader:MovieClipLoader = new MovieClipLoader();
clip_loader.addListener(the_listener_name);
clip_loader.loadClip(clip_url,clip_name);
}
I’m nearly done with this project, but I’m stumped on this one. Can anyone help?
Thanks in advance