|
-
[RESOLVED] What am I missing (onRelease problem)?
Here is my function that I am using to generate images across the top of my photo slideshow. For some reason or another I cannot get the thumbnail images to have an active onRelease functionality or anything else for that matter. I know it's probably stupid but what am I missing here?
The images show up fine, so that's not an issue. Only the clicking functions.
PHP Code:
var mc_imagebar:MovieClip = _root.createEmptyMovieClip("mc_imagebar", _root.getNextHighestDepth());
function load_images(xml) {
var _node:XML = xml.firstChild;
mc_imagebar._x = 0;
mc_imagebar._y = mc_slidebar._y;
total_images = _node.childNodes.length;
for(var i = 0; i < total_images; i++) {
// Store image data into arrays
image_small.push(String(_node.childNodes[i].childNodes[0].firstChild.nodeValue));
image_large.push(String(_node.childNodes[i].childNodes[1].firstChild.nodeValue));
image_description.push(String(_node.childNodes[i].childNodes[2].firstChild.nodeValue));
// Create image thumbnails
var new_thumb:MovieClip = mc_imagebar.attachMovie("mc_thumb", "thumb_"+i, mc_imagebar.getNextHighestDepth());
var new_preloader:MovieClip = mc_imagebar.attachMovie("mc_preloader", "mc_preloader_thumb_"+i, mc_imagebar.getNextHighestDepth());
loadIntoClip(image_small[i], new_thumb, new_preloader);
new_thumb.onRelease = function() {
trace(this);
};
new_thumb._x = next_x;
new_thumb._y = 20;
new_preloader._x = next_x;
new_preloader._y = 60;
(i > 0) ? new_thumb._alpha = fade : new_thumb._alpha = full;
new_thumb._id = i;
next_x += 110;
}
mc_slidebar.txt_imgcount.text = image_number + "/" + (total_images-1);
// Load the first image automatically
loadIntoClip(image_large[0], mc_image, main_preloader);
};
-
Banned
what happens when the trace is trigerred? do you get undefined in output panel?? or is your output panel showing up blank(nothing in it)? or is your output panel not even opening?
Just try this,
Code:
_root[new_thumb].onRelease = function() {
trace("clicked"+this._name);
};
tel me what you get in output panel
-
you will need to yet create another mc inside the thumbs where you'll load the jpgs. As it it now, the loaded images overwrite your AS when replacing the mcs as they load.
gparis
-
The issue is that when I mouseover the thumbnails the mouse is not active like it has a hitarea to click on. I am leaning towards a depth problem but I have went over this thing about 100 times and I can't find it.
Here is my debug trace:
PHP Code:
new_preloader >> _level0.mc_imagebar.mc_preloader_thumb_0
new_preloader depth >> 0
new_thumb >> _level0.mc_imagebar.thumb_0
new_thumb depth >> 1
new_preloader >> _level0.mc_imagebar.mc_preloader_thumb_1
new_preloader depth >> 2
new_thumb >> _level0.mc_imagebar.thumb_1
new_thumb depth >> 3
new_preloader >> _level0.mc_imagebar.mc_preloader_thumb_2
new_preloader depth >> 4
new_thumb >> _level0.mc_imagebar.thumb_2
new_thumb depth >> 5
new_preloader >> _level0.mc_imagebar.mc_preloader_thumb_3
new_preloader depth >> 6
new_thumb >> _level0.mc_imagebar.thumb_3
new_thumb depth >> 7
new_preloader >> _level0.mc_imagebar.mc_preloader_thumb_4
new_preloader depth >> 8
new_thumb >> _level0.mc_imagebar.thumb_4
new_thumb depth >> 9
new_preloader >> _level0.mc_imagebar.mc_preloader_thumb_5
new_preloader depth >> 10
new_thumb >> _level0.mc_imagebar.thumb_5
new_thumb depth >> 11
new_preloader >> _level0.mc_imagebar.mc_preloader_thumb_6
new_preloader depth >> 12
new_thumb >> _level0.mc_imagebar.thumb_6
new_thumb depth >> 13
new_preloader >> _level0.mc_imagebar.mc_preloader_thumb_7
new_preloader depth >> 14
new_thumb >> _level0.mc_imagebar.thumb_7
new_thumb depth >> 15
new_preloader >> _level0.mc_imagebar.mc_preloader_thumb_8
new_preloader depth >> 16
new_thumb >> _level0.mc_imagebar.thumb_8
new_thumb depth >> 17
mc_imagebar >> _level0.mc_imagebar
mc_imagebar depth >> 9877
mc_slidebar >> _level0.mc_slidebar
mc_slidebar depth >> -16381
As well as this code which I believe gparis was suggesting, didnt work 
PHP Code:
// Create image thumbnails
var new_preloader:MovieClip = mc_imagebar.attachMovie("mc_preloader", "mc_preloader_thumb_"+i, mc_imagebar.getNextHighestDepth());
var new_thumb:MovieClip = mc_imagebar.attachMovie("mc_thumb", "thumb_"+i, mc_imagebar.getNextHighestDepth());
var thumb:MovieClip = new_thumb.createEmptyMovieClip("thumb_test_"+i, new_thumb.getNextHighestDepth());
thumb.onRelease = function() {
trace(this);
};
I also tried:
_root[new_thumb].onRelease = function() {
trace("clicked"+this._name);
};
Which of coarse wont work, because for some reason it appears there is no hit area.
-
it should be: new_thumb.onRelease
you did the same mistake, an onRelease on a mc that you load image into.
gparis
-
-
Ah thank you so much gparis. My issue is resolved!
Last edited by sstalder; 01-14-2008 at 02:00 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|