Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* This is in the MC that has a bunch of children MCs which I want to attach events to */
- stop();
- /* Initially open & show the first item */
- photo1.gotoAndPlay('open');
- /* Set some defaults */
- var currOpen:Number = 1;
- var i:Number = 1;
- /* THe listener object */
- var jumpToPage:Object = new Object();
- jumpToPage.onMouseDown = function(obj:Object) {
- trace('Object: '+obj);
- };
- /* Populate the numbers for the pager and attach a click listener */
- for(i; i<6; i++)
- {
- var mc:MovieClip = this["photo"+i];
- mc.page.text = i;
- mc.addListener(jumpToPage);
- }
- /* Animate the item if needed */
- function animateOpen(id):Void
- {
- // If it's already open, don't do anything
- if(id == currOpen)
- {
- return;
- }
- if(currOpen !== 0)
- {
- var openMC:MovieClip = this[currOpen];
- openMC.gotoAndPlay('start_closing');
- }
- currOpen = id;
- var mc = this["photo"+id];
- mc.gotoAndPlay('start_opening');
- return;
- }
- ## Inside the child MCs
- /* This is inside the child MC */
- AsBroadcaster.initialize(this);
- /* On mouse down (i.e. when clicked) broadcast a message) */
- this.onMouseDown = function() {
- broadcastMessage('onMouseDown', this);
- }
Add Comment
Please, Sign In to add comment