currentStateChange and currentStateChanging do not fire in Flex - apache-flex

I wanted to use the currentStateChange event in my application but whatever code being called in this event was not executed so I thought may be there's something wrong with my code so I tried testing it on one of the examples in adobe live docs.
So I took this example
here
<mx:states>
<mx:State name="One">
<mx:SetProperty target="{p1}" name="x" value="110"/>
<mx:SetProperty target="{p1}" name="y" value="0"/>
<mx:SetProperty target="{p1}" name="width" value="200"/>
<mx:SetProperty target="{p1}" name="height" value="210"/>
<mx:SetProperty target="{p2}" name="x" value="0"/>
<mx:SetProperty target="{p2}" name="y" value="0"/>
<mx:SetProperty target="{p2}" name="width" value="100"/>
<mx:SetProperty target="{p2}" name="height" value="100"/>
<mx:SetProperty target="{p3}" name="x" value="0"/>
<mx:SetProperty target="{p3}" name="y" value="110"/>
<mx:SetProperty target="{p3}" name="width" value="100"/>
<mx:SetProperty target="{p3}" name="height" value="100"/>
</mx:State>
<mx:State name="Two">
<mx:SetProperty target="{p2}" name="x" value="110"/>
<mx:SetProperty target="{p2}" name="y" value="0"/>
<mx:SetProperty target="{p2}" name="width" value="200"/>
<mx:SetProperty target="{p2}" name="height" value="210"/>
<mx:SetProperty target="{p3}" name="x" value="0"/>
<mx:SetProperty target="{p3}" name="y" value="110"/>
<mx:SetProperty target="{p3}" name="width" value="100"/>
<mx:SetProperty target="{p3}" name="height" value="100"/>
</mx:State>
</mx:states>
<!-- Define Transition array with one Transition object.-->
<mx:transitions>
<!-- A transition for changing from any state to any state. -->
<mx:Transition id="myTransition" fromState="*" toState="*">
<!-- Define a Parallel effect as the top-level effect.-->
<mx:Parallel id="t1" targets="{[p1,p2,p3]}">
<!-- Define a Move and Resize effect.-->
<mx:Move duration="400"/>
<mx:Resize duration="400"/>
</mx:Parallel>
</mx:Transition>
</mx:transitions>
<!-- Define the Canvas container holding the three Panel containers.-->
<mx:Canvas id="pm" width="100%" height="100%" >
<mx:Panel id="p1" title="One"
x="0" y="0" width="100" height="100"
click="currentState='One'" currentStateChange="Alert.show('change')" currentStateChanging="Alert.show('changing')" >
<mx:Label fontSize="24" text="One"/>
</mx:Panel>
<mx:Panel id="p2" title="Two"
x="0" y="110" width="100" height="100"
click="currentState='Two'" >
<mx:Label fontSize="24" text="Two"/>
</mx:Panel>
<mx:Panel id="p3" title="Three"
x="110" y="0" width="200" height="210"
click="currentState=''" >
<mx:Label fontSize="24" text="Three"/>
</mx:Panel>
</mx:Canvas>
And all what I did is placing an alert in both events currentStateChange and currentStateChanging of panel One and I didn't get the alerts when clicking on the panel.
I also tried replacing the inline code with a call to a function that makes the alert also nothing happened.
What's wrong with what I am trying to do here?
Thanks

You are listening for state changes of p1, but you never change the state of that panel: p1.currentState stays the same. States are not automatically inherited or something like that.
If you want to see the state change, add the listener on the container you are setting the state of. In the example you are linking to that is on the Application tag.

Related

How to create 2 x 2 grid using NativeScript GridLayout

The Problem
I am trying to simply display images in 2 rows, 2 columns - equally centered all around.
I have tried all sorts of Layouts. Here are a couple of my failures:
My Ideal Layout
My XML
<Page loaded="pageLoaded" class="page"
xmlns="http://www.nativescript.org/tns.xsd">
<ActionBar class="action-bar customActionBar" >
<!--
Use the NavigationButton as a side-drawer button in Android
because ActionItems are shown on the right side of the ActionBar
-->
<NavigationButton ios:visibility="collapsed" icon="res://menu" tap="onDrawerButtonTap"></NavigationButton>
<!--
Use the ActionItem for IOS with position set to left. Using the
NavigationButton as a side-drawer button in iOS is not possible,
because its function is to always navigate back in the application.
-->
<ActionItem icon="res://navigation/menu"
android:visibility="collapsed"
tap="onDrawerButtonTap"
ios.position="left"></ActionItem>
<Label class="action-bar-title" text="Signup"></Label>
</ActionBar>
<DockLayout width="100%" height="100%" backgroundColor="lightgray" class="page-gradient"
stretchLastChild="false">
<Button class="submitButton h2 border" text="Next" height="60" dock="bottom"
tap="onSignupButtonTap" returnKeyType="next"/>
<!-- content -->
<StackLayout dock="top" width="100%" height="75" >
<!-- ><Label horizontalAlignment="center" text="Graphic - Step 1 thru 3 Here" />
-->
<Image class="" src="~/images/signup/step-1-on.png" stretch="fill" />
<Image style="margin-top: 15" src="~/images/signup/progress.png" stretch="fill" />
</StackLayout>
<WrapLayout orientation="horizontal" width="210" height="210" backgroundColor="lightgray">
<Label text="Label 1" width="70" height="70" backgroundColor="red"/>
<Label text="Label 2" width="70" height="70" backgroundColor="green"/>
<Label text="Label 3" width="70" height="70" backgroundColor="blue"/>
<Label text="Label 4" width="70" height="70" backgroundColor="yellow"/>
</WrapLayout>
<!-- end content -->
</DockLayout>
</Page>
Can you help me with this layout? It appears to be easy, but not for me.
Thank You.
Created a playground here.
GridLayout is the king.
<GridLayout columns="*, *" rows="*, *" width="230" height="230"
backgroundColor="lightgray">
<Label text="Label 1" row="0" col="0" backgroundColor="red" />
<Label text="Label 2" row="0" col="1" backgroundColor="green" />
<Label text="Label 3" row="1" col="0" backgroundColor="blue" />
<Label text="Label 4" row="1" col="1" backgroundColor="yellow" />
<Label text="Label 5" row="1" col="2" backgroundColor="orange" />
</GridLayout>

How set Stacked="true" column chart telerik

I have a column chart, so I would like to chart the values last columns show stacked values.
I am using the RadHtmlChart Telerik, but setting parameter tacked="true" in the last columns, but the result its wrong the chart is not stacked, if i set this attribute in the first line serie, the chart is stacked. This my code:
<telerik:RadHtmlChart ID="Chart" runat="server" Width="680" Height="500">
<PlotArea>
<XAxis>
<LabelsAppearance>
<TextStyle Color="white" FontFamily="Arial" FontSize="13" />
</LabelsAppearance>
</XAxis>
<YAxis Step="5000000" MinValue="0" >
<LabelsAppearance DataFormatString="${0:0,0}">
<TextStyle Color="white" FontFamily="Arial" FontSize="12" />
</LabelsAppearance>
</YAxis>
<Series>
<telerik:ColumnSeries Name="Garantías Vigentes">
<LabelsAppearance Position="Center" DataFormatString="${0:0,0}" >
<TextStyle Color="Black" FontFamily="Arial" Bold="True" FontSize="18" />
</LabelsAppearance>
<Appearance>
<FillStyle BackgroundColor="#87cb50"></FillStyle>
</Appearance>
<SeriesItems>
</SeriesItems>
</telerik:ColumnSeries>
<telerik:ColumnSeries Name="Saldo Vigente" Stacked="true">
<LabelsAppearance Position="Center" DataFormatString="${0:0,0}">
<TextStyle Color="Black" FontFamily="Arial" Bold="True" FontSize="18" />
</LabelsAppearance>
<Appearance>
<FillStyle BackgroundColor="#8DB4E2"></FillStyle>
</Appearance>
<SeriesItems>
</SeriesItems>
</telerik:ColumnSeries>
<telerik:ColumnSeries Name="" Stacked="true">
<LabelsAppearance Position="Center" DataFormatString="${0:0,0}">
<TextStyle Color="Black" FontFamily="Arial" Bold="True" FontSize="18" />
</LabelsAppearance>
<Appearance>
<FillStyle BackgroundColor="#8DB4E2"></FillStyle>
</Appearance>
<SeriesItems>
</SeriesItems>
</telerik:ColumnSeries>
</Series>
</PlotArea>
<Legend>
<Appearance Position="Bottom"><TextStyle Color="white" FontFamily="Arial" FontSize="20" Bold="True"/></Appearance>
</Legend>
</telerik:RadHtmlChart>
thanks for yours comments
Read this to see how to use the feature: http://www.telerik.com/help/aspnet-ajax/htmlchart-stacked-series.html.
Read this to see how to get a total in the last series: http://www.telerik.com/forums/need-to-display-grand-total-on-top-of-the-htmlchart-stacked-bars.
Finally I set the property stacked= true in the last column, my code:
<telerik:RadHtmlChart ID="Chart" runat="server" Width="680" Height="500">
<PlotArea>
<XAxis>
<LabelsAppearance>
<TextStyle Color="white" FontFamily="Arial" FontSize="13" />
</LabelsAppearance>
</XAxis>
<YAxis MinValue="0" >
<LabelsAppearance DataFormatString="${0:0,0}">
<TextStyle Color="white" FontFamily="Arial" FontSize="12" />
</LabelsAppearance>
</YAxis>
<Series>
<telerik:ColumnSeries Name="Garantías Vigentes" Stacked="true">
<LabelsAppearance Position="Center" DataFormatString="${0:0,0}">
<TextStyle Color="Black" FontFamily="Arial" Bold="True" FontSize="18" />
</LabelsAppearance>
<Appearance>
<FillStyle BackgroundColor="#87cb50"></FillStyle>
</Appearance>
<SeriesItems>
</SeriesItems>
</telerik:ColumnSeries>
</Series>
<Series>
<telerik:ColumnSeries Name="Saldo Vigente" Stacked="true">
<LabelsAppearance Position="Center" DataFormatString="${0:0,0}">
<TextStyle Color="Black" FontFamily="Arial" Bold="True" FontSize="18" />
</LabelsAppearance>
<Appearance>
<FillStyle BackgroundColor="#8DB4E2"></FillStyle>
</Appearance>
<SeriesItems>
<telerik:CategorySeriesItem Y="0"></telerik:CategorySeriesItem>
</SeriesItems>
</telerik:ColumnSeries>
<telerik:ColumnSeries Name="" >
<LabelsAppearance Position="Center" DataFormatString="${0:0,0}">
<TextStyle Color="Black" FontFamily="Arial" Bold="True" FontSize="0" />
</LabelsAppearance>
<Appearance>
<FillStyle BackgroundColor="#1B1A1A"></FillStyle>
</Appearance>
<SeriesItems>
<telerik:CategorySeriesItem Y="0"></telerik:CategorySeriesItem>
</SeriesItems>
</telerik:ColumnSeries>
</Series>
</PlotArea>
<Legend>
<Appearance Position="Bottom"><TextStyle Color="white" FontFamily="Arial" FontSize="20" Bold="True"/></Appearance>
</Legend>
</telerik:RadHtmlChart>
the part of code-behind:
Public Sub LoadChart()
Dim salesAuto As Double
Dim lessVig As Double
lessVig = LtlSaldoVigente.Text.ToDouble
salesAuto = CDbl(LtlLine.Text.ToDouble - lessVig * 1000000)
Chart.PlotArea.YAxis.MinorGridLines.Visible = False
Chart.PlotArea.XAxis.MinorGridLines.Visible = False
Dim ColumnSeries1 As ColumnSeries = TryCast(Chart.PlotArea.Series(0), ColumnSeries)
ColumnSeries1.SeriesItems.Add(y:=CDec(LtlValue.Text.ToDouble))
ColumnSeries1.SeriesItems.Add(y:=CDec(0))
Dim ColumnSeries2 As ColumnSeries = TryCast(Chart.PlotArea.Series(1), ColumnSeries)
ColumnSeries2.Stacked = True
ColumnSeries2.SeriesItems.Add(y:=CDec(LtlSaVig.Text.ToDouble * 1000000))
Dim ColumnSeries3 As ColumnSeries = TryCast(Chart.PlotArea.Series(2), ColumnSeries)
ColumnSeries3.SeriesItems.Add(y:=CDec(lessVig))
End Sub
the result:

How can i display my pieseries item name inside RADCHART

I have pieseries items as item1,item2,item3,item4 and item5.I had attached an image of the below code.How can i display my pieseries item name inside chart?
CODE:
<telerik:RadHtmlChart ID="RadHtmlChart1" runat="server">
<PlotArea>
<Series>
<telerik:PieSeries Name="PieSeries1" StartAngle="90">
<SeriesItems>
<telerik:PieSeriesItem Y="1" Name="item1" />
<telerik:PieSeriesItem Y="2" Name="item2" />
<telerik:PieSeriesItem Y="3" Name="item3" />
<telerik:PieSeriesItem Y="4" Name="item4" />
<telerik:PieSeriesItem Y="5" Name="item5" />
</SeriesItems>
<LabelsAppearance Visible="False" />
</telerik:PieSeries>
</Series>
</PlotArea>
</telerik:RadHtmlChart>
Snapshot:
You need to set your LabelsAppearance to Visible, and Position: Center
<telerik:PieSeries Name="PieSeries1" StartAngle="90">
<SeriesItems>
...
</SeriesItems>
<LabelsAppearance Visible="True">
<Position="Center"/>
</LabelsAppearance>
</telerik:PieSeries>
https://demos.telerik.com/aspnet-ajax/htmlchart/examples/charttypes/piechart/defaultcs.aspx

Flex Repeater Horizontal Scrollbar

In my application I'm using a canvas and repeater inside HBox it is Dynamic,..now I want to keep a horizontal scrollbar for the same, I may display more than 50 canvas addresses inside that Hbox and repeater.
Here is my code:
<mx:HBox id="addrBox" x="42" y="161" width="1000%" styleName="ContextPanel" resizeEffect="resize" horizontalGap="5" height="0" paddingLeft="15">
<mx:Repeater id="rpt" maxWidth="1000" dataProvider="{ customerAddress }" >
<mx:Canvas height="243" width="283" id="addressCanv" cornerRadius="0" styleName="ContextPanel">
<mx:Label id="seq" text="{rpt.currentIndex+1 }" x="99" y="0"/>
<mx:TextInput id="address1" maxChars="50" change="address1_changeHandler(event)" text="{ rpt.currentItem.addressOne}" x="99" y="60"/>
<mx:TextInput id="address2" maxChars="50" change="address2_changeHandler(event)" text="{ rpt.currentItem.addressTwo}" x="99" y="90"/>
<mx:TextInput id="address3" maxChars="50" change="address3_changeHandler(event)" text="{ rpt.currentItem.addressThree}" x="99" y="120"/>
<mx:TextInput id="postalCd" restrict="[0-9]" maxChars="6" change="postalCd_changeHandler(event)" text="{ rpt.currentItem.postalCode}" x="99" y="150" width="167"/>
<mx:ComboBox id="cntryCdCmb" prompt="Select" change="cntryCdCmb_changeHandler(event)" selectedIndex="{ StaticDataHolder.countryList.getItemIndex(ASUtil.getValue(StaticDataHolder.countryList,rpt.currentItem.countryCode))}" dataProvider="{ StaticDataHolder.countryList }" x="99" y="180" width="167"/>
<mx:CheckBox id="primaryFlag" label="isPrimary" selected="{ (rpt.currentItem.primaryFlag == 0)?true:false }" change="primaryFlag_changeHandler(event)" x="19" y="210"/>
<mx:Label x="10" y="0" text="Seq No"/>
<mx:Label x="10" y="62" text="Address 1"/>
<mx:Label x="10" y="92" text="Address 2"/>
<mx:Label x="10" y="122" text="Address 3"/>
<mx:Label x="10" y="152" text="Postal Code"/>
<mx:Label x="10" y="182" text="Country Code"/>
<mx:Label x="10" y="29" text="Address Type"/>
<mx:ComboBox x="99" y="29" width="167" prompt="Select" change="addTypeCmb_changeHandler(event)" id="addTypeCmb" selectedIndex="{ StaticDataHolder.addressTypes.getItemIndex(ASUtil.getValue(StaticDataHolder.addressTypes,rpt.currentItem.addressType))}" dataProvider="{ StaticDataHolder.addressTypes }"></mx:ComboBox>
<mx:Label x="235" y="210" text="{ rpt.currentItem.primaryFlag}"/>
<mx:Image id="delAddr" x="258" y="3" height="21" width="17" source="images/delete2.png" maintainAspectRatio="true" click="delAddr_clickHandler(event)"/>
</mx:Canvas>
</mx:Repeater>
</mx:HBox>
Kindly give some idea for getting horizontal scroll bar for the Repeater.
Add one more attribute to your HBox that is horizontalScrollPolicy
<mx:HBox id="addrBox" x="42" y="161" width="100%" styleName="ContextPanel"
resizeEffect="resize" horizontalGap="5" height="0" paddingLeft="15" horizontalScrollPolicy="on">
You can set the values on, off and auto. By using auto
HScrollBar will be visible if contents does not fit in the given space.
<mx:HBox id="addrBox" x="42" y="161" width="100%" styleName="ContextPanel"
resizeEffect="resize" horizontalGap="5" height="0" paddingLeft="15" horizontalScrollPolicy="auto">
horizontalScrollPolicy auto gives the best result if it reduces from 50.

Silverlight ASP.NET Transparent Background

I just started learning Silverlight and I failed to use a transparent background for my Silverlight app in my asp.net page. I have searched on the internet and found that these two lines should fix it:
<param name="background" value="Transparent" />
<param name="pluginbackground" value="Transparent" />
but unfortunately it didn't. Here is the way i embed the Silverlight app:
<form id="form1" runat="server" style="height:100%">
<div id="silverlightControlHost">
<object data="data:SilverlightApplication4," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="ClientBin/SilverlightApplication4.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="Transparent" />
<param name="pluginbackground" value="Transparent" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
</a>
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
</form>
and this is my Silverlight code:
<UserControl x:Class="SilverlightApplication4.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400" Loaded="UserControl_Loaded" BorderBrush="Transparent">
<StackPanel x:Name="LayoutRoot" Height="147" Width="226" Background="Transparent">
<StackPanel.Resources>
<Storyboard x:Name="FirstStoryBoard">
<DoubleAnimation Storyboard.TargetName="FirstEllipse"
Storyboard.TargetProperty="Width"
To="1" AutoReverse="True"
Duration="00:00:01" />
</Storyboard>
</StackPanel.Resources>
<TextBlock Text="Hello, World!" HorizontalAlignment="Center" Name="txtMessege" />
<Ellipse Name="FirstEllipse" Height="100" Width="200" Fill="SlateBlue" />
<Button Name="FirstButton" Width="100" Content="Click" Click="FirstButton_Click" />
</StackPanel>
</UserControl>
Try with these parameters:
<param name="background" value="Transparent" />
<param name="windowless" value="True" />
You might need to restart the browser too.

Resources