topical media & game development
lib-flex-store-productsView-ProductCatalogThumbnail.mx
lib-flex-store-productsView-ProductCatalogThumbnail.mx
(swf
)
[ flash
]
flex
<?xml version="1.0" encoding="utf-8"?>
<!--
//////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2003-2006 Adobe Macromedia Software LLC and its licensors.
// All Rights Reserved.
// The following is Sample Code and is subject to all restrictions on such code
// as contained in the End User License Agreement accompanying this product.
// If you have received this file from a source other than Adobe,
// then your use, modification, or distribution of it requires
// the prior written permission of Adobe.
//
//////////////////////////////////////////////////////////////////////////
-->
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
width="{COL_WIDTH_4}" height="{COL_HEIGHT_4}"
borderStyle="solid"
borderColor="#FFFFFF"
horizontalScrollPolicy="off" verticalScrollPolicy="off"
rollOver="rollOverHandler(event)"
rollOut="rollOutHandler(event)"
mouseDown="mouseDownHandler(event)"
mouseMove="mouseMoveHandler(event)"
mouseUp="mouseUpHandler(event)"
click="clickHandler(event)"
currentState="4cols"
automationName="{product.name}"
dropShadowColor="#000000"
shadowDistance="2"
>
<mx:Metadata>
[Event(name="purchase", type="lib_flex_store_samples_flexstore_ProductThumbEvent")]
[Event(name="compare", type="lib_flex_store_samples_flexstore_ProductThumbEvent")]
[Event(name="details", type="lib_flex_store_samples_flexstore_ProductThumbEvent")]
</mx:Metadata>
<mx:Script>
<![CDATA[
import mx.events.*;
import mx.core.*;
//import samples.flexstore.Product;
//import samples.flexstore.ProductThumbEvent;
public static const COL_WIDTH_4:int = 162;
public static const COL_HEIGHT_4:int = 122;
public static const COL_WIDTH_3:int = 217;
public static const COL_HEIGHT_3:int = 165;
public static const COL_WIDTH_2:int = 327;
public static const COL_HEIGHT_2:int = 250;
public static const COMPARE_WIDTH:int = 162;
public static const HORIZONTAL_GAP:int = 2;
public static const VERTICAL_GAP:int = 3;
[Bindable]
public var product:lib_flex_store_samples_flexstore_Product;
private function rollOverHandler(event:MouseEvent):void
{
setStyle("borderColor", "#CCCCCC");
setStyle("dropShadowEnabled", true);
buttons.visible = true;
}
private function rollOutHandler(event:MouseEvent):void
{
setStyle("borderColor", "#FFFFFF");
setStyle("dropShadowEnabled", false);
buttons.visible = false;
}
private var dragStartPoint:Point;
public function mouseDownHandler(event:MouseEvent):void
{
if (event.target != purchase &&
event.target != compare &&
event.target != details)
{
dragStartPoint = new Point(event.stageX, event.stageY);
dragStartPoint = globalToLocal(dragStartPoint);
}
}
public function mouseMoveHandler(event:MouseEvent):void
{
if (dragStartPoint != null)
{
var dragEvent:DragEvent = new DragEvent(DragEvent.DRAG_START, true);
dragEvent.localX = dragStartPoint.x;
dragEvent.localY = dragStartPoint.y;
dragEvent.buttonDown = true;
dispatchEvent(dragEvent);
rollOutHandler(event);
dragStartPoint = null;
}
}
public function mouseUpHandler(event:MouseEvent):void
{
if (dragStartPoint != null)
{
dragStartPoint = null;
}
}
public function clickHandler(event:MouseEvent):void
{
if (event.target != purchase &&
event.target != compare &&
event.target != details)
{
dispatchEvent(new lib_flex_store_samples_flexstore_ProductThumbEvent(lib_flex_store_samples_flexstore_ProductThumbEvent.DETAILS, product));
}
}
]]>
</mx:Script>
<mx:CurrencyFormatter currencySymbol="
(C) Æliens
18/6/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.