?? recipeview.mxml
字號:
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:diet="diet.*"
creationComplete="init()" xmlns:activity="com.vo.activity.*"
borderStyle="solid" cornerRadius="10" borderColor="#888888" borderThickness="3"
backgroundColor="#565656" backgroundAlpha="0.75"
showCloseButton="true" close="this.parent.removeChild(this);"
fontFamily="瀹嬩綋" title="閫夋嫨椋熺墿" color="#ffffff">
<mx:Script>
<![CDATA[
import mx.effects.easing.Bounce;
import diet.vo.activity.Food;
import mx.controls.RadioButton;
import diet.vo.activity.Sport;
import diet.vo.activity.DietActivity;
import diet.util.ActivityType;
import mx.managers.PopUpManager;
import diet.model.DietModelLocator;
import mx.controls.CheckBox;
import mx.controls.Alert;
[Bindable]
public var model:DietModelLocator = DietModelLocator.getInstance();
[Bindable]
public var selectedArray:ArrayCollection = new ArrayCollection();
[Bindable]
public var selectedSport:Sport = new Sport();
[Bindable]
public var type:String;
[Bindable]
public var dataArray:ArrayCollection = new ArrayCollection();
[Bindable]
public var foodCalorieSum:Number = 0;
[Bindable]
public var sportCalorieSum:Number = 0;
public function init():void
{
//this.refreshView(type);
}
public function refreshView(type:String):void
{
//this.selectedArray.removeAll();
this.type = type;
if(type == ActivityType.SPORTS)
{
this.sportCalorieSum = selectedSport.caloriePerUnit*selectedSport.amount;
this.currentState = "sportState";
}
else
{
this.foodCalorieSum = getFoodCalorieSum();
this.currentState = "";
}
}
public function getFoodCalorieSum():Number
{
var sum:Number = 0;
for each(var item:Object in selectedArray)
{
sum += item.caloriePerUnit * item.amount;
}
return sum;
}
public function onClickHandler(cbFood:CheckBox, data:Object):void
{
if(!cbFood.selected)
{
this.selectedArray.removeItemAt(this.selectedArray.getItemIndex(data));
foodCalorieSum -= data.caloriePerUnit * data.amount;
cbFood.selected = false;
return;
}
else
{
this.selectedArray.addItem(data);
foodCalorieSum += data.caloriePerUnit * data.amount;
cbFood.selected = true;
return;
}
}
public function removeFoodItem(index:int):void
{
var food:Object = this.selectedArray.removeItemAt(index);
foodCalorieSum -= food.caloriePerUnit * food.amount;
}
public function onRadioButtonClickHandler(cbFood:RadioButton, data:Object):void
{
this.selectedSport.init(data.type,data.name,data.amount,data.caloriePerUnit);
sportCalorieSum = data.caloriePerUnit * data.amount;
}
]]>
</mx:Script>
<mx:Parallel id="fadeInEffect" target="{this}">
<mx:Move xFrom="{this.x-50}" xTo="{this.x}"/>
<mx:Fade alphaFrom="0" alphaTo="1"/>
</mx:Parallel>
<mx:Parallel id="fadeOutEffect" target="{this}"
effectEnd="PopUpManager.removePopUp(this);">
<mx:Move xFrom="{this.x}" xTo="{this.x-50}"/>
<mx:Fade alphaFrom="1" alphaTo="0"/>
</mx:Parallel>
<mx:ArrayCollection id="wugu">
<mx:Object name="鐧介キ1紕
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -