This is an automated email from the ASF dual-hosted git repository. aharui pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 3e37deabac300cb78343cb77ebb08ecc6bda3d52 Author: Alex Harui <[email protected]> AuthorDate: Fri Oct 18 22:41:22 2019 -0700 simple test for local sharedobject --- examples/mxroyale/SharedObjectTest/build.xml | 55 ++++++++++++++++ .../src/main/royale/SharedObjectTest.mxml | 73 ++++++++++++++++++++++ 2 files changed, 128 insertions(+) diff --git a/examples/mxroyale/SharedObjectTest/build.xml b/examples/mxroyale/SharedObjectTest/build.xml new file mode 100644 index 0000000..43d90b9 --- /dev/null +++ b/examples/mxroyale/SharedObjectTest/build.xml @@ -0,0 +1,55 @@ +<?xml version="1.0"?> +<!-- + + 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. + +--> + + +<project name="sharedobjectest" default="main" basedir="."> + <property name="ROYALE_HOME" location="../../.."/> + <property name="example" value="SharedObjectTest" /> + + <property file="${ROYALE_HOME}/env.properties"/> + <property environment="env"/> + <property file="${ROYALE_HOME}/build.properties"/> + <property name="ROYALE_HOME" value="${ROYALE_HOME}"/> + <property name="config_arg" value="flex"/> + + <include file="${basedir}/../../build_example.xml" /> + + <target name="main" depends="clean,build_example.compile" description="Clean build of ${example}"> + </target> + + <target name="clean"> + <delete dir="${basedir}/bin" failonerror="false" /> + <delete dir="${basedir}/bin-debug" failonerror="false" /> + <delete dir="${basedir}/bin-release" failonerror="false" /> + <delete dir="${basedir}/target" failonerror="false" /> + </target> + + <target name="examine" depends="build_example.get.browser"> + <property name="which" value="debug" /> + <echo message="Make sure label appears."/> + <exec executable="${browser}" dir="${basedir}/bin-${which}" failonerror="true"> + <arg value="${basedir}/bin-${which}/${example}.html"/> + </exec> + <exec executable="${browser}" dir="${basedir}/bin/js-${which}" failonerror="true"> + <arg value="${basedir}/bin/js-${which}/index.html"/> + </exec> + </target> + +</project> diff --git a/examples/mxroyale/SharedObjectTest/src/main/royale/SharedObjectTest.mxml b/examples/mxroyale/SharedObjectTest/src/main/royale/SharedObjectTest.mxml new file mode 100644 index 0000000..61dc501 --- /dev/null +++ b/examples/mxroyale/SharedObjectTest/src/main/royale/SharedObjectTest.mxml @@ -0,0 +1,73 @@ +<?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. + +--> +<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:mx="library://ns.apache.org/royale/mx" + width="600" height="400" > + <!-- to do: layout="absolute" minWidth="955" minHeight="600" --> + <fx:Style> + @namespace mx "library://ns.apache.org/royale/mx"; + + /* set position:absolute to make the (x,y) properties work */ + mx|Label { + position: absolute; + } + + </fx:Style> + <fx:Script> + <![CDATA[ + import mx.net.SharedObject; + private var so:SharedObject; + + private function saveIt():void + { + if (!so) + so = SharedObject.getLocal("foo"); + + so.data[key.text] = value.text; + so.flush(); + } + + private function showIt():void + { + if (!so) + so = SharedObject.getLocal("foo"); + + value.text = so.data[key.text]; + } + + private function deleteIt():void + { + if (!so) + so = SharedObject.getLocal("foo"); + + delete so.data[key.text]; + so.flush(); + } + ]]> + </fx:Script> + <mx:Label text="Enter a key" x="20" y="20" /> + <mx:TextInput id="key" x="20" y="40" /> + <mx:Label text="Enter a value" x="20" y="70" /> + <mx:TextInput id="value" x="20" y="90" /> + <mx:Button label="Save" x="20" y="120" click="saveIt()"/> + <mx:Button label="Show" x="120" y="120" click="showIt()" /> + <mx:Button label="Delete" x="220" y="120" click="deleteIt()" /> + +</mx:Application> \ No newline at end of file
