Bug in photoflipcs_v_1_4_0 opening popup twice

Original photoflipcs code:
In the below code if you click on any frame, pop up will open twice.
You can trace this by adding trace(event.index); to below code.
//import event
import com.digicrafts.events.*;

//add click action to the photoflip
photoflip.addEventListener(ItemEvent.CLICK, iEventHandler);
photoflip.addEventListener(ItemEvent.CHANGE, iEventHandler);
/*
photoflip.addEventListener(ItemEvent.DOUBLE_CLICK, iEventHandler);
photoflip.addEventListener(ItemEvent.MOUSE_OVER, iEventHandler);
photoflip.addEventListener(ItemEvent.MOUSE_OUT, iEventHandler);
photoflip.addEventListener(ItemEvent.SELECT, iEventHandler);
*/

function iEventHandler(event:ItemEvent){
switch(event.type){
//Event when selection change
case ItemEvent.CHANGE:
//change the caption to filename
caption.htmlText = event.item.title;
//Event when click on the item
case ItemEvent.CLICK:
ExternalInterface.call(‘pathtoxmlfile’);

break;
default:
break;
}

}

Corrected code:

import com.digicrafts.events.*;
var currentcoverage:Object;
var selectedItemIndex:Number = 0;

//Event handler for the item

photoflip.load(this.root.loaderInfo.parameters[“xmlFile”]);

function mouseMoveHandler(event:ItemEvent):void
{

selectedItemIndex = Number(event.index);
caption.htmlText = event.item.title;
currentcoverage = event.item;
if(Number(event.index) == selectedItemIndex)
ExternalInterface.call(“function_name”,currentcoverage.title,xyz……….);

}
photoflip.addEventListener(ItemEvent.MOUSE_UP,mouseMoveHandler);

Advertisements

Tags:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: