A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [RESOLVED] What am I missing (onRelease problem)?

  1. #1
    AS3 Mod
    Join Date
    Sep 2007
    Location
    O-H-I-O
    Posts
    2,385

    resolved [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 
    0total_imagesi++) {
            
    // 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_"+imc_imagebar.getNextHighestDepth());        
            var 
    new_preloader:MovieClip mc_imagebar.attachMovie("mc_preloader""mc_preloader_thumb_"+imc_imagebar.getNextHighestDepth());
            
    loadIntoClip(image_small[i], new_thumbnew_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;
            (
    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_imagemain_preloader);
    }; 

  2. #2
    Banned deepakflash's Avatar
    Join Date
    Aug 2007
    Location
    [Object not found]
    Posts
    1,160
    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

  3. #3
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    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

  4. #4
    AS3 Mod
    Join Date
    Sep 2007
    Location
    O-H-I-O
    Posts
    2,385
    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_"+imc_imagebar.getNextHighestDepth());
            var 
    new_thumb:MovieClip mc_imagebar.attachMovie("mc_thumb""thumb_"+imc_imagebar.getNextHighestDepth());        
            var 
    thumb:MovieClip new_thumb.createEmptyMovieClip("thumb_test_"+inew_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.

  5. #5
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    it should be: new_thumb.onRelease

    you did the same mistake, an onRelease on a mc that you load image into.

    gparis

  6. #6
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141

  7. #7
    AS3 Mod
    Join Date
    Sep 2007
    Location
    O-H-I-O
    Posts
    2,385
    Ah thank you so much gparis. My issue is resolved!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center