blob: cdc8409b3a2042452e21f6a73195ad2a0fb93c92 [file] [log] [blame]
<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="Paging and Snapping" actionBarVisible="true" xmlns:components="comps.*" >
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:State name="portrait"/>
<s:State name="landscape"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.core.FlexGlobals;
import mx.events.FlexEvent;
import mx.events.TouchInteractionEvent;
import spark.components.Image;
protected function radiobutton1_clickHandler(event:MouseEvent):void
{
imageScroller.pageScrollingEnabled=true;
}
protected function radiobutton2_clickHandler(event:MouseEvent):void
{
imageScroller.pageScrollingEnabled=false;
}
protected function radiobutton3_clickHandler(event:MouseEvent):void
{
imageScroller.scrollSnappingMode="none"
}
protected function radiobutton4_clickHandler(event:MouseEvent):void
{
imageScroller.scrollSnappingMode="center"
}
protected function radiobutton5_clickHandler(event:MouseEvent):void
{
imageScroller.scrollSnappingMode="leadingEdge"
}
protected function radiobutton6_clickHandler(event:MouseEvent):void
{
imageScroller.scrollSnappingMode="trailingEdge"
}
protected function imageScroller_touchInteractionEndHandler(event:TouchInteractionEvent):void
{
trace("Item Snapped");
}
protected function button1_clickHandler(event:MouseEvent):void
{
navigator.popView();
}
protected function view1_creationCompleteHandler(event:FlexEvent):void
{
currentState = data.toString();
}
]]>
</fx:Script>
<s:states>
<s:State name="ios"/>
<s:State name="android"/>
<s:State name="playbook"/>
</s:states>
<s:navigationContent>
<s:Button label="Back" includeIn="ios,playbook" click="button1_clickHandler(event)"/>
</s:navigationContent>
<s:actionContent>
<s:RadioButton groupName="pagingGroup" label="disabled" click="radiobutton2_clickHandler(event)"/>
<s:RadioButton groupName="pagingGroup" x="-2" width="163" height="47" label="enabled"
click="radiobutton1_clickHandler(event)"/>
</s:actionContent>
<s:HGroup x="10" y="10" width="460" height="43">
<s:RadioButton groupName="snappingGroup" width="25%" height="100%" label="None" click="radiobutton3_clickHandler(event)" fontSize="13"/>
<s:RadioButton groupName="snappingGroup" width="25%" height="100%" label="Center" click="radiobutton4_clickHandler(event)" fontSize="13"/>
<s:RadioButton groupName="snappingGroup" width="25%" height="100%" label="Leading" click="radiobutton5_clickHandler(event)" fontSize="13"/>
<s:RadioButton groupName="snappingGroup" width="25%" height="100%" label="Trailing" click="radiobutton6_clickHandler(event)" fontSize="13"/>
</s:HGroup>
<s:Scroller id="imageScroller" top="61" width="100%" height="100%" horizontalScrollPolicy="on" pageScrollingEnabled="true"
verticalScrollPolicy="off" touchInteractionEnd="imageScroller_touchInteractionEndHandler(event)">
<!-- <components:myHGroup id="imageGroup" height="100%" width="100%" clipAndEnableScrolling="true" gap="0" verticalAlign="middle"/>
--> <s:HGroup id="imageGroup" width="100%" clipAndEnableScrolling="true" gap="0">
<s:Image width="100%" height="100%" verticalAlign="middle" horizontalAlign="center"
source="@Embed('../../../../../../Assets/Images/smallbluerect.jpg')"/>
<s:Image width="{imageGroup.width/2}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg" />
<s:Image width="{imageGroup.width/2}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg"/>
<s:Image width="{imageGroup.width/5}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg" />
<s:Image width="{imageGroup.width/2}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg"/>
<s:Image width="{imageGroup.width/2}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg" />
<s:Image width="{imageGroup.width/4}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg"/>
<s:Image width="{imageGroup.width/2}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg" />
<s:Image width="{imageGroup.width/2}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg"/>
<s:Image width="{imageGroup.width/5}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg" />
<s:Image width="{imageGroup.width/2}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg"/>
<s:Image width="{imageGroup.width/2}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg" />
<s:Image width="{imageGroup.width/2}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg"/>
<s:Image width="{imageGroup.width/4}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg" />
<s:Image width="{imageGroup.width/2}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg"/>
<s:Image width="{imageGroup.width/2}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg" />
<s:Image width="{imageGroup.width/2}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg" />
<s:Image width="{imageGroup.width/2}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg" />
<s:Image width="{imageGroup.width/2}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg" />
<s:Image width="{imageGroup.width/2}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg" />
<s:Image width="{imageGroup.width/4}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg" />
<s:Image width="{imageGroup.width/2}" height="100%" verticalAlign="middle" horizontalAlign="center"
source="../../../../../../Assets/Images/smallbluerect.jpg" />
</s:HGroup>
</s:Scroller>
</s:View>