Hi all!

I have a problem with sending data between two SWF's.

Basically I have the parent SWF that loads in a child SWF. On the child SWF
there are several pictures that are clickable.

Now let's say the user clicks picture 2. I need the child SWF to tell the
main SWF that a picture was clicked, and also what picture it was from say
picture 1 to 10. The main SWF will then do something with that information.

So far all I have been able to find is something like this, in the child SWF
create add a "dispatchEvent(new Event("jumpToImage", true));" to each
picture on click. Then in the main SWF add an event listener to the child
SWF.

Now the problem is, when I click on a picture the main SWF's listener
event.target equals the child SWF's document class ([object Child]), not the
image Movieclip instance name.

I don't really want to add a different dispatchEvent to every image:

dispatchEvent(new Event("jumpToImage1", true));
dispatchEvent(new Event("jumpToImage2", true));
....
dispatchEvent(new Event("jumpToImage10", true));

cause this seems wasteful, instead I would rather do this:

Child:
dispatchEvent(new Event("jumpToImage", true));

Main:
private function jumpToImage(event:Event):void
{
        switch (event.target.name)
        {
                case "picture1":
                        // do something with picture 1
                break;
                case "picture2":
                        // do something with picture 2
                break;
                ...
                case "picture10":
                        // do something with picture 10
                break;
        }
}

Any ideas?

Thanks,
Dav

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to