topical media & game development
springgraph-sample-RoamerDemo-XMLItemView.mx
springgraph-sample-RoamerDemo-XMLItemView.mx
(swf
)
[ flash
]
flex
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
backgroundColor="0x999999"
backgroundAlpha="{(app().roamer.dataProvider as Graph).numLinks(data as Item) > 1 ? 1.0 : 0.3}"
filters="{calcFilters(app().roamer.currentItem, data as Item)}">
<!--
//////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2006 Adobe Macromedia Software LLC and its licensors.
// All Rights Reserved. The following is Source Code and is subject to all
// restrictions on such code as contained in the End User License Agreement
// accompanying this product.
//
//////////////////////////////////////////////////////////////////////////
-->
<!-- XMLItemView.mxml is the item renderer component for one XML item. We simply display the 'prop'
attribute of the XML item in a colored box. -->
<
mx:Text fontSize="13" text="{data.data.@prop}" color="#ffffff" width="65" selectable="false"/>
<
mx:Script>
<![CDATA[
import
mx.effects.Glow;
import com.adobe.flex.extras.controls.springgraph.Graph;
import com.adobe.flex.extras.controls.springgraph.Item;
import
mx.core.Application;
public function doubleClick(event:
Event): void {
app().itemDoubleClick(event);
}
private function app():
springgraph_sample_RoamerDemo {
return Application.application as
springgraph_sample_RoamerDemo;
}
/* This function gets called whenever the graph's current item changes,
* or when our data changes, to calculate the borderthickness.
*/
private function calcFilters(currentItem: Item, item: Item): Array {
if(app().roamer.currentItem == item) {
return [new GlowFilter(0xFFFF00, 0.5, 8, 8, 2, 1)];
} else if(app().roamer.hasBeenCurrentItem(item)) {
return [new GlowFilter(0x0000FF, 0.3, 6, 6, 2, 1)];
} else {
return null;
}
}
/* This function gets called whenever the graph's current item changes,
* or when our data changes, to calculate a color based on our distance
* from the current item.
*/
/* backgroundColor="{calcColor(app().roamer.currentItem, data as Item)}"
private function calcColor(currentItem: Item, item: Item): int {
switch (app().roamer.distance(currentItem, item)) {
case 0:
return 0x5555ee;
//default:
case 1:
return 0x7777bb;
default:
return 0x999999;
}
}
*/
]]>
</mx:
Script>
</mx:VBox>
(C) Æliens
20/2/2008
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.