Hi,
Every time I make a script using AS3, I get very confused on a number of issues for which I do not find any answer.
Here is the one I am struggling with today, I am doing some sort of thumbnail gallery application:
I have a main.as class and a class that ultimately contains an instance of the loader class (to display the image).
But I also have another class - loaded as well from main.as - that contains an instance of a class for each thumbnail. On click of one thumbnail, I want the loader of the other class to change its content something like this:
thumbnail.addEventListener(MouseEvent.MOUSE_UP, changeLoaderContent);
private function changeLoaderContent(e:MouseEvent):void {
// Code either to change the content of the loader instance or calling a function on the stage to change the contentof the loader like this loader.load(urlRequest).
}
What is the best and most logical way to do this: communicate between two classes created on the stage. Should I use an event dispatcher and a listener on the stage? If I do this, how do I pass values from the thumbnail - like the URL of the large image - to the stage and then the loader.
I have the feeling there should be something simple and straightforward to do this but I don’t know what is best.
Thank you,
didi