<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" applicationComplete="{init()}"
width="460" height="450">
<mx:ColumnChart id="championsChart" dataProvider="{champions}">
<mx:horizontalAxis>
<mx:CategoryAxis id="horAxis" dataProvider="{champions}"
categoryField="Team"/>
</mx:horizontalAxis>
<mx:series>
<mx:ColumnSeries xField="Team" yField="Count"
displayName="Team">
<mx:fill>
<mx:SolidColor color="0xc02314"/>
</mx:fill>
</mx:ColumnSeries>
</mx:series>
<mx:horizontalAxisRenderers>
<mx:AxisRenderer axis="{horAxis}">
<mx:labelRenderer>
<mx:Component>
<mx:VBox horizontalAlign="center">
<mx:HBox>
<mx:Image source="@Embed('../assets/f1logo.png')"/>
<mx:Label id="newLabel"/>
</mx:HBox>
<mx:Button label="EDIT" click="{outerDocument.onClick(event)}"/>
<mx:Script><![CDATA[
override public function set data(value:Object):void
{
if(value == null)
{
return;
}
newLabel.text = value.text;
}
]]></mx:Script>
</mx:VBox>
</mx:Component>
</mx:labelRenderer>
</mx:AxisRenderer>
</mx:horizontalAxisRenderers>
</mx:ColumnChart>
<mx:Script><![CDATA[
import mx.containers.*;
import mx.controls.Button;
import mx.controls.TextInput;
import mx.collections.ArrayCollection;
import mx.managers.PopUpManager;
private var titleWindow:TitleWindow;
private var countTextInput:TextInput;
private var saveButton:Button;
private var cancelButton:Button;
private var index:int;
[Bindable]
public var champions:ArrayCollection = new ArrayCollection
([
{Team:"Ferrari", Count:15},
{Team:"Williams", Count:9},
{Team:"McLaren", Count:8}
]);
public function onClick(e:Event):void
{
index = searchName(e.target.parent.newLabel.text);
titleWindow.title = e.target.parent.newLabel.text + " championships number";
PopUpManager.addPopUp(titleWindow,this,true);
PopUpManager.centerPopUp(titleWindow);
}
private function init():void
{
var vbox:VBox = new VBox();
var hbox:HBox = new HBox();
titleWindow = new TitleWindow();
countTextInput = new TextInput();
saveButton = new Button();
cancelButton = new Button()
cancelButton.addEventListener(MouseEvent.CLICK, onCancel);
saveButton.addEventListener(MouseEvent.CLICK, onSave);
saveButton.label = "SAVE";
cancelButton.label = "CANCEL";
hbox.addChild(saveButton);
hbox.addChild(cancelButton);
vbox.addChild(countTextInput);
vbox.addChild(hbox);
titleWindow.addChild(vbox);
}
private function onCancel(e:Event):void
{
PopUpManager.removePopUp(titleWindow);
countTextInput.text = "";
}
private function onSave(e:Event):void
{
champions.getItemAt(index).Count = (countTextInput.text == "") ? 10 : int(countTextInput.text);
PopUpManager.removePopUp(titleWindow);
countTextInput.text = "";
championsChart.dataProvider = champions;
}
private function searchName(name:String):int
{
for(var i:int = 0; i < champions.length; i++)
{
if(champions.getItemAt(i).Team == name)
{
return i;
}
}
return -1;
}
]]></mx:Script>
</mx:Application>
Configure Visual Studio to use x64 version of IIS Express
-
When IIS Express loads an assembly which is not matching with iis process
platform you might get errror like this... [BadImageFormatException: Could
not lo...
7 years ago
No comments:
Post a Comment