-
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...
-
Tai'shar Manetheren!
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
-
Thanx dude......makes perfect sense now....I didnt know that the loader component was actually a movie clip....thanx.....
-
Tai'shar Manetheren!
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
-
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...
-
Tai'shar Manetheren!
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|