A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Help with component loader

  1. #1
    Junior Member
    Join Date
    Nov 2002
    Location
    Canada
    Posts
    13

    Help with component loader

    Ok I just got Flash MX 2004.....but need some help with the loader component.

    I am using the loader component to load an external image, I would like to create an event listener for this image I have loaded.

    I have tried numerous ways to add a listener for the component but cant get anything to work. I used the examples that came with Flash as a reference for my code. There examples refer to buttons, so I am assuming that the code structure is pretty much the same no matter what type of component it is.....button etc....

    The only way I can get the loader component to work is with the following code...

    image1.onRelease = function(){
    trace("test");
    }
    When I use this code the image is clickable....when I try an event listener the image is not clickable...I have tried calling a function from the following code.....

    image1.addEventListener("click", myfunction)

    nothing happens....

    If anyone can help it would be much appreciated any sample code would be nice to...

  2. #2
    Tai'shar Manetheren! skierbit's Avatar
    Join Date
    Dec 2000
    Location
    Provo, Utah
    Posts
    407
    addEventListener generally only aplies to components. Where you are just assigning it to a movieclip, use the first way you tried that worked.

    BTW when you add a listener to an object, the part where you put myFunction, actually needs to be a call to an object that has a click function assigned to it

  3. #3
    Junior Member
    Join Date
    Nov 2002
    Location
    Canada
    Posts
    13
    Thanx dude......makes perfect sense now....I didnt know that the loader component was actually a movie clip....thanx.....

  4. #4
    Tai'shar Manetheren! skierbit's Avatar
    Join Date
    Dec 2000
    Location
    Provo, Utah
    Posts
    407
    ummm, sorta, the loader component is a component, but what you load in, ISNT a component... does that make sense? You can target the loader component, but generally it is bad form. Because lets say you load in a movie clip that has mutliple "buttons". Hope that helps. Enjoy

  5. #5
    Junior Member
    Join Date
    Nov 2002
    Location
    Canada
    Posts
    13
    Makes perfect sense...thanx for all your input...by the way checked out your page awesome job on the image gallery....Thats what I am currently workin on....


    Thanx...

  6. #6
    Tai'shar Manetheren! skierbit's Avatar
    Join Date
    Dec 2000
    Location
    Provo, Utah
    Posts
    407
    cool! let me know how it goes!

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