as3corelib 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. data/Gemfile +5 -0
  2. data/Gemfile.lock +28 -0
  3. data/README.textile +79 -0
  4. data/Rakefile +3 -0
  5. data/as3corelib.gemspec +23 -0
  6. data/build/build.properties +48 -0
  7. data/build/build.xml +104 -0
  8. data/examples/JSONExample/JSONExample.mxml +73 -0
  9. data/lib/as3corelib.rb +15 -0
  10. data/src/com/adobe/air/crypto/EncryptionKeyGenerator.as +313 -0
  11. data/src/com/adobe/air/filesystem/FileMonitor.as +245 -0
  12. data/src/com/adobe/air/filesystem/FileUtil.as +63 -0
  13. data/src/com/adobe/air/filesystem/VolumeMonitor.as +184 -0
  14. data/src/com/adobe/air/filesystem/events/FileMonitorEvent.as +61 -0
  15. data/src/com/adobe/air/logging/FileTarget.as +95 -0
  16. data/src/com/adobe/air/net/ResourceCache.as +165 -0
  17. data/src/com/adobe/air/net/events/ResourceCacheEvent.as +70 -0
  18. data/src/com/adobe/crypto/HMAC.as +127 -0
  19. data/src/com/adobe/crypto/MD5.as +281 -0
  20. data/src/com/adobe/crypto/MD5Stream.as +402 -0
  21. data/src/com/adobe/crypto/SHA1.as +289 -0
  22. data/src/com/adobe/crypto/SHA224.as +257 -0
  23. data/src/com/adobe/crypto/SHA256.as +261 -0
  24. data/src/com/adobe/crypto/WSSEUsernameToken.as +114 -0
  25. data/src/com/adobe/errors/IllegalStateError.as +63 -0
  26. data/src/com/adobe/fileformats/vcard/Address.as +47 -0
  27. data/src/com/adobe/fileformats/vcard/Email.as +39 -0
  28. data/src/com/adobe/fileformats/vcard/Phone.as +39 -0
  29. data/src/com/adobe/fileformats/vcard/VCard.as +54 -0
  30. data/src/com/adobe/fileformats/vcard/VCardParser.as +246 -0
  31. data/src/com/adobe/images/BitString.as +39 -0
  32. data/src/com/adobe/images/JPGEncoder.as +648 -0
  33. data/src/com/adobe/images/PNGEncoder.as +141 -0
  34. data/src/com/adobe/net/DynamicURLLoader.as +55 -0
  35. data/src/com/adobe/net/IURIResolver.as +76 -0
  36. data/src/com/adobe/net/MimeTypeMap.as +200 -0
  37. data/src/com/adobe/net/URI.as +2466 -0
  38. data/src/com/adobe/net/URIEncodingBitmap.as +139 -0
  39. data/src/com/adobe/net/proxies/RFC2817Socket.as +198 -0
  40. data/src/com/adobe/protocols/dict/Database.as +66 -0
  41. data/src/com/adobe/protocols/dict/Definition.as +71 -0
  42. data/src/com/adobe/protocols/dict/Dict.as +360 -0
  43. data/src/com/adobe/protocols/dict/DictionaryServer.as +60 -0
  44. data/src/com/adobe/protocols/dict/MatchStrategy.as +66 -0
  45. data/src/com/adobe/protocols/dict/Response.as +71 -0
  46. data/src/com/adobe/protocols/dict/events/ConnectedEvent.as +53 -0
  47. data/src/com/adobe/protocols/dict/events/DatabaseEvent.as +67 -0
  48. data/src/com/adobe/protocols/dict/events/DefinitionEvent.as +70 -0
  49. data/src/com/adobe/protocols/dict/events/DefinitionHeaderEvent.as +69 -0
  50. data/src/com/adobe/protocols/dict/events/DictionaryServerEvent.as +69 -0
  51. data/src/com/adobe/protocols/dict/events/DisconnectedEvent.as +55 -0
  52. data/src/com/adobe/protocols/dict/events/ErrorEvent.as +80 -0
  53. data/src/com/adobe/protocols/dict/events/MatchEvent.as +67 -0
  54. data/src/com/adobe/protocols/dict/events/MatchStrategiesEvent.as +70 -0
  55. data/src/com/adobe/protocols/dict/events/NoMatchEvent.as +54 -0
  56. data/src/com/adobe/protocols/dict/util/CompleteResponseEvent.as +68 -0
  57. data/src/com/adobe/protocols/dict/util/SocketHelper.as +81 -0
  58. data/src/com/adobe/serialization/json/JSON.as +86 -0
  59. data/src/com/adobe/serialization/json/JSONDecoder.as +327 -0
  60. data/src/com/adobe/serialization/json/JSONEncoder.as +312 -0
  61. data/src/com/adobe/serialization/json/JSONParseError.as +87 -0
  62. data/src/com/adobe/serialization/json/JSONToken.as +104 -0
  63. data/src/com/adobe/serialization/json/JSONTokenType.as +69 -0
  64. data/src/com/adobe/serialization/json/JSONTokenizer.as +702 -0
  65. data/src/com/adobe/utils/ArrayUtil.as +187 -0
  66. data/src/com/adobe/utils/DateUtil.as +701 -0
  67. data/src/com/adobe/utils/DictionaryUtil.as +87 -0
  68. data/src/com/adobe/utils/IntUtil.as +99 -0
  69. data/src/com/adobe/utils/NumberFormatter.as +74 -0
  70. data/src/com/adobe/utils/StringUtil.as +239 -0
  71. data/src/com/adobe/utils/XMLUtil.as +168 -0
  72. data/src/com/adobe/webapis/ServiceBase.as +48 -0
  73. data/src/com/adobe/webapis/URLLoaderBase.as +108 -0
  74. data/src/com/adobe/webapis/events/ServiceEvent.as +82 -0
  75. data/tests/src/CoreLibTestRunner-app.xml +135 -0
  76. data/tests/src/CoreLibTestRunner.as +138 -0
  77. data/tests/src/CoreLibTestRunner.mxml +46 -0
  78. data/tests/src/com/adobe/air/crypto/EncryptionKeyGeneratorTest.as +176 -0
  79. data/tests/src/com/adobe/air/filesystem/FileMonitorTest.as +63 -0
  80. data/tests/src/com/adobe/air/filesystem/VolumeMonitorTest.as +57 -0
  81. data/tests/src/com/adobe/air/filesystem/events/FileMonitorEventTest.as +59 -0
  82. data/tests/src/com/adobe/air/net/events/ResourceCacheEventTest.as +72 -0
  83. data/tests/src/com/adobe/crypto/HMACMD5Test.as +134 -0
  84. data/tests/src/com/adobe/crypto/HMACSHA1Test.as +138 -0
  85. data/tests/src/com/adobe/crypto/MD5Test.as +82 -0
  86. data/tests/src/com/adobe/crypto/SHA1Test.as +151 -0
  87. data/tests/src/com/adobe/crypto/SHA224Test.as +104 -0
  88. data/tests/src/com/adobe/crypto/SHA256Test.as +116 -0
  89. data/tests/src/com/adobe/crypto/WSSEUsernameTokenTest.as +87 -0
  90. data/tests/src/com/adobe/images/JPGEncoderTest.as +54 -0
  91. data/tests/src/com/adobe/images/PNGEncoderTest.as +54 -0
  92. data/tests/src/com/adobe/net/URITest.as +589 -0
  93. data/tests/src/com/adobe/protocols/events/ConnectedEventTest.as +59 -0
  94. data/tests/src/com/adobe/protocols/events/DatabaseEventTest.as +62 -0
  95. data/tests/src/com/adobe/protocols/events/DefinitionEventTest.as +61 -0
  96. data/tests/src/com/adobe/protocols/events/DefinitionHeaderEventTest.as +61 -0
  97. data/tests/src/com/adobe/protocols/events/DictionaryServerEventTest.as +61 -0
  98. data/tests/src/com/adobe/protocols/events/DisconnectedEventTest.as +59 -0
  99. data/tests/src/com/adobe/protocols/events/ErrorEventTest.as +63 -0
  100. data/tests/src/com/adobe/protocols/events/MatchEventTest.as +61 -0
  101. data/tests/src/com/adobe/protocols/events/MatchStrategiesEventTest.as +61 -0
  102. data/tests/src/com/adobe/protocols/events/NoMatchEventTest.as +58 -0
  103. data/tests/src/com/adobe/protocols/util/CompletedResponseEventTest.as +60 -0
  104. data/tests/src/com/adobe/serialization/json/JSONTest.as +522 -0
  105. data/tests/src/com/adobe/serialization/json/SimpleClass.as +85 -0
  106. data/tests/src/com/adobe/utils/ArrayUtilTest.as +173 -0
  107. data/tests/src/com/adobe/utils/DateUtilTest.as +436 -0
  108. data/tests/src/com/adobe/utils/DictionaryUtilTest.as +93 -0
  109. data/tests/src/com/adobe/utils/IntUtilTest.as +73 -0
  110. data/tests/src/com/adobe/utils/NumberFormatterTest.as +70 -0
  111. data/tests/src/com/adobe/utils/StringUtilTest.as +304 -0
  112. data/tests/src/com/adobe/utils/XMLUtilTest.as +101 -0
  113. data/tests/src/com/adobe/webapis/events/ServiceEventTest.as +66 -0
  114. metadata +196 -0
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem 'sprout', '>= 1.0.26.pre'
data/Gemfile.lock ADDED
@@ -0,0 +1,28 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ as3corelib (0.1.0)
5
+ sprout (>= 1.0.26.pre)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ archive-tar-minitar (0.5.2)
11
+ open4 (1.0.1)
12
+ rake (0.8.7)
13
+ rdoc (2.5.11)
14
+ rubyzip (0.9.4)
15
+ sprout (1.0.26.pre)
16
+ archive-tar-minitar (= 0.5.2)
17
+ bundler (>= 0.9.19)
18
+ open4 (>= 0.9.6)
19
+ rake (>= 0.8.7)
20
+ rdoc (>= 2.5.8)
21
+ rubyzip (= 0.9.4)
22
+
23
+ PLATFORMS
24
+ ruby
25
+
26
+ DEPENDENCIES
27
+ as3corelib!
28
+ sprout (>= 1.0.26.pre)
data/README.textile ADDED
@@ -0,0 +1,79 @@
1
+
2
+ h1. The AS3CoreLib Sprout Gem
3
+
4
+ h4. requires sprout, v >= 1.0.26.pre
5
+
6
+ AS3Corelib ActionScript 3 source wrapped in a Sprout::Specification for implementation into a sprout project and Gem::Specification for distribution as a gem.
7
+
8
+ This sprout gem includes the AS3Corelib source code forked from github.com/mikechambers/as3corelib. As a sprout, the source code will be copied to lib/as3corelib of your sprout project.
9
+
10
+ h3. Installation
11
+
12
+ Intended for use with a project using Project Sprouts.
13
+
14
+ See information concerning Project Sprouts here:
15
+ * "http://github.com/lukebayes/project-sprouts" http://github.com/lukebayes/project-sprouts
16
+ * "http://github.com/lukebayes/sprout-flashsdk" http://github.com/lukebayes/sprout-flashsdk
17
+
18
+ Add the AS3Corelib gem to your Gemfile:
19
+
20
+ <pre><code>gem "as3corelib"</code></pre>
21
+
22
+ Add the AS3Corelib library dependency to your Rakefile:
23
+
24
+ <pre><code>library :as3corelib</code></pre>
25
+
26
+ Enter this shell command to resolve gem dependency:
27
+
28
+ <pre><code>bundle install</code></pre>
29
+
30
+ h3. Ruby Gem
31
+
32
+ The gem can be installed independently of a project entering this command:
33
+
34
+ <pre><code>gem install as3corelib</code></pre>
35
+
36
+ h3. Additional links
37
+
38
+ * "AS3CoreLib on GitHub":http://github.com/mikechambers/as3corelib
39
+ * "Sprouts Site":http://projectsprouts.org
40
+ * "Sprouts on Github":http://github.com/lukebayes/project-sprouts
41
+ * "flashsdk sprout on Github":http://github.com/lukebayes/sprout-flashsdk
42
+ * "Sprouts Community":http://groups.google.com/group/projectsprouts
43
+
44
+ h3. AS3CoreLib README
45
+
46
+ An ActionScript 3 Library that contains a number of classes and utilities for working with ActionScript? 3. These include classes for MD5 and SHA 1 hashing, Image encoders, and JSON serialization as well as general String, Number and Date APIs.
47
+
48
+ Code is released under a BSD License:
49
+ http://www.opensource.org/licenses/bsd-license.php
50
+
51
+ Copyright (c) 2008, Adobe Systems Incorporated
52
+ All rights reserved.
53
+
54
+ Redistribution and use in source and binary forms, with or without
55
+ modification, are permitted provided that the following conditions are
56
+ met:
57
+
58
+ * Redistributions of source code must retain the above copyright notice,
59
+ this list of conditions and the following disclaimer.
60
+
61
+ * Redistributions in binary form must reproduce the above copyright
62
+ notice, this list of conditions and the following disclaimer in the
63
+ documentation and/or other materials provided with the distribution.
64
+
65
+ * Neither the name of Adobe Systems Incorporated nor the names of its
66
+ contributors may be used to endorse or promote products derived from
67
+ this software without specific prior written permission.
68
+
69
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
70
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
71
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
72
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
73
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
74
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
75
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
76
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
77
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
78
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
79
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/Rakefile ADDED
@@ -0,0 +1,3 @@
1
+ require 'bundler'
2
+ require 'lib/as3corelib'
3
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'lib/as3corelib'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = AS3Corelib::NAME
6
+ s.version = AS3Corelib::VERSION
7
+ # s.platform = Gem::Platform::RUBY
8
+ # s.authors = ["TODO: Write your name"]
9
+ s.email = ["amoslanka@gmail.com"]
10
+ s.homepage = "http://www.github.com/amoslanka/sprout-as3corelib"
11
+ s.summary = %q{AS3Corelib ActionScript 3 source wrapped in a Sprout::Specification for implementation into a sprout project and Gem::Specification for distribution as a gem.}
12
+ # s.description = %q{TODO: Write a gem description}
13
+
14
+ # s.files = `git ls-files`.split("\n")
15
+ # s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ # s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ["lib"]
18
+
19
+ s.files = FileList['lib/**/*.rb', 'bin/*', 'build/*', 'examples/**/*', 'src/**/*', '[A-Za-z0-9]*', 'tests/**/*'].to_a
20
+
21
+ s.add_dependency 'sprout', '>= 1.0.26.pre'
22
+
23
+ end
@@ -0,0 +1,48 @@
1
+ # -----------------------------------------------------------------
2
+ # User-Defined Paths
3
+ #
4
+ # Modify these path values to reflect paths on your system
5
+ # -----------------------------------------------------------------
6
+
7
+ # The path to the flexunit.swc -- Required when trying to build/run unit
8
+ # tests for this library. The below path assumes there's an "as3flexunitlib"
9
+ # folder along side of this library's root folder, with the .swc file in the
10
+ # bin subdirectory.
11
+ flexunit.swc = ${basedir}/../as3flexunitlib/bin/as3flexunitlib.swc
12
+
13
+ # The location of the Flex 2 SDK on your sytem.
14
+ flex2sdk.bin.dir = C:/Program Files/Adobe/Flex Builder 2 Plug-in/Flex SDK 2/bin
15
+ flex2sdk.lib.dir = C:/Program Files/Adobe/Flex Builder 2 Plug-in/Flex SDK 2/frameworks/libs
16
+
17
+ # Note that the locale dir uses the {locale} token at the end to specify the directory
18
+ # of language-specific files. This is replaced by the compiler with the locale defined
19
+ # by the locale property below.
20
+ flex2sdk.locale = en_US
21
+ flex2sdk.locale.dir = C:/Program Files/Adobe/Flex Builder 2 Plug-in/Flex SDK 2/frameworks/locale/{locale}
22
+
23
+ #note we have to use aasdoc since the library not includes some AIR files.
24
+ asdoc.exe = aasdoc
25
+ compc.exe = ${flex2sdk.bin.dir}/compc.exe
26
+ mxmlc.exe = ${flex2sdk.bin.dir}/mxmlc.exe
27
+
28
+ # The debug player is necessary here because it writes trace statements to a flashlog.txt
29
+ # file. This allows us to examine the .txt file and determine the status of unit tests
30
+ # in an automated fashion.
31
+ flashDebugPlayer.exe = C:/Program Files/Adobe/Flex Builder 2 Plug-in/Player/debug/SAFlashPlayer.exe
32
+
33
+ # -----------------------------------------------------------------
34
+ # File Names - DO NOT MODIFY
35
+ # -----------------------------------------------------------------
36
+ testRunner.dir = .
37
+ testRunner.name = CoreLibTestRunner
38
+
39
+ library.name = corelib
40
+
41
+ # -----------------------------------------------------------------
42
+ # Project Paths - DO NOT MODIFY
43
+ # -----------------------------------------------------------------
44
+ build.dir = ${basedir}/build
45
+ src.dir = ${basedir}/src
46
+ tests.dir = ${basedir}/tests
47
+ bin.dir = ${basedir}/bin
48
+ docs.dir = ${basedir}/docs
data/build/build.xml ADDED
@@ -0,0 +1,104 @@
1
+ <?xml version="1.0"?>
2
+ <project name="as3corelib" basedir="../" default="lib">
3
+
4
+ <!-- Define variables/paths used in this build script -->
5
+ <property file="./build/build.properties" />
6
+
7
+ <!--
8
+ Have you edit the properties file to make sure the paths are right oo your system?
9
+ -->
10
+ <target name="properties">
11
+ <fail unless="asdoc.exe">The "asdoc.exe" property must be set in ${build.dir}/build.properties.</fail>
12
+ <fail unless="compc.exe">The "compc.exe" property must be set in ${build.dir}/build.properties.</fail>
13
+ <fail unless="mxmlc.exe">The "mxmlc.exe" property must be set in ${build.dir}/build.properties.</fail>
14
+ </target>
15
+
16
+ <!--
17
+ Compile the unit tests for the library, placing the test runner .swf file
18
+ in the bin directory.
19
+ -->
20
+ <target name="compileTests" depends="properties">
21
+ <exec executable="${mxmlc.exe}" dir="${basedir}">
22
+ <!-- Point to the main test runner's application mxml file -->
23
+ <arg line="'${tests.dir}/${testRunner.dir}/${testRunner.name}.mxml'" />
24
+
25
+ <!-- Use AIR configuration file -->
26
+ <arg line="-load-config '${flex2sdk.lib.dir}/../air-config.xml'" />
27
+
28
+ <!-- Place the built .swf file in the "bin" directory -->
29
+ <arg line="-o '${bin.dir}/${testRunner.name}.swf'" />
30
+
31
+ <!-- Define source directories for "src" and "tests" -->
32
+ <arg line="-sp ${src.dir}" />
33
+ <arg line="-sp ${tests.dir}/src" />
34
+
35
+ <!-- Include the necessary framework libraries in the class path -->
36
+ <arg line="-l '${flex2sdk.lib.dir}'" />
37
+
38
+ <!-- Include in the flexunit.swc in the class path -->
39
+ <arg line="-l ${flexunit.swc}" />
40
+
41
+ <!-- Include locale-specific items in the path -->
42
+ <arg line="-locale ${flex2sdk.locale}" />
43
+ <arg line="-l '${flex2sdk.locale.dir}'" />
44
+ </exec>
45
+ </target>
46
+
47
+ <!--
48
+ Runs the unit tests for the library in the stand-alone Flash Player
49
+ -->
50
+ <target name="test" depends="compileTests">
51
+ <!--
52
+ If/When we add support for determinig the status of unit tests
53
+ as part of the ANT build process, we need to change the spawn to
54
+ "no" so that ANT waits until the test runner closes before
55
+ proceeding.
56
+ -->
57
+ <exec executable="${flashDebugPlayer.exe}" spawn="yes">
58
+ <arg line="${bin.dir}/${testRunner.name}.swf" />
59
+ </exec>
60
+ </target>
61
+
62
+ <!--
63
+ Compile all of the classes under the "src" tree into a .swc file
64
+ -->
65
+ <target name="lib" depends="properties">
66
+ <exec executable="${compc.exe}" dir="${basedir}">
67
+ <!-- Specify the name of the output file -->
68
+ <arg line="-o '${bin.dir}/${library.name}.swc'" />
69
+
70
+ <!-- Specify the main source path as "src" -->
71
+ <arg line="-sp ${src.dir}" />
72
+
73
+ <!-- Include all of the classes in the "src" tree -->
74
+ <arg line="-is ${src.dir}" />
75
+ </exec>
76
+ </target>
77
+
78
+ <!--
79
+ Generate ASDoc output for the library
80
+ -->
81
+ <target name="docs" depends="properties">
82
+ <!-- Clean out the contents of the doc directory, without delete "docs" -->
83
+ <!--
84
+ <delete includeemptydirs="true">
85
+ <fileset dir="${docs.dir}" includes="**/*" />
86
+ </delete>
87
+ -->
88
+
89
+ <exec executable="${asdoc.exe}" spawn="no">
90
+ <!-- Place the documentation in the "docs" directory -->
91
+ <arg line="-o ${docs.dir}" />
92
+
93
+ <!-- Specify the main source path as "src" -->
94
+ <arg line="-sp ${src.dir}" />
95
+
96
+ <!-- Document all of the classes in the "src" tree -->
97
+ <arg line="-ds ${src.dir} " />
98
+
99
+ <!-- Include the library name in the window title -->
100
+ <arg line="-window-title 'Adobe ActionScript 3.0 Core Library - ${library.name}' "/>
101
+ </exec>
102
+ </target>
103
+
104
+ </project>
@@ -0,0 +1,73 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+
3
+ <!--
4
+ Adobe Systems Incorporated(r) Source Code License Agreement
5
+ Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved.
6
+
7
+ Please read this Source Code License Agreement carefully before using
8
+ the source code.
9
+
10
+ Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive,
11
+ no-charge, royalty-free, irrevocable copyright license, to reproduce,
12
+ prepare derivative works of, publicly display, publicly perform, and
13
+ distribute this source code and such derivative works in source or
14
+ object code form without any attribution requirements.
15
+
16
+ The name "Adobe Systems Incorporated" must not be used to endorse or promote products
17
+ derived from the source code without prior written permission.
18
+
19
+ You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and
20
+ against any loss, damage, claims or lawsuits, including attorney's
21
+ fees that arise or result from your use or distribution of the source
22
+ code.
23
+
24
+ THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT
25
+ ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
26
+ BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27
+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF
28
+ NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA
29
+ OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
32
+ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF
35
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
+ -->
37
+
38
+ <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*"
39
+ layout="absolute"
40
+ creationComplete="service.send()" viewSourceURL="srcview/index.html">
41
+
42
+ <mx:Script>
43
+ <![CDATA[
44
+ import mx.collections.ArrayCollection;
45
+ import mx.rpc.events.ResultEvent;
46
+ import com.adobe.serialization.json.JSON;
47
+
48
+ private function onJSONLoad(event:ResultEvent):void
49
+ {
50
+ var rawData:String = String(event.result);
51
+ var arr:Array = (JSON.decode(rawData) as Array);
52
+
53
+ var dp:ArrayCollection = new ArrayCollection(arr);
54
+
55
+ grid.dataProvider = dp;
56
+ }
57
+ ]]>
58
+ </mx:Script>
59
+
60
+ <mx:HTTPService
61
+ id="service"
62
+ resultFormat="text"
63
+ url="http://weblogs.macromedia.com/mesh/mashedpotato.json"
64
+ result="onJSONLoad(event)" />
65
+
66
+ <mx:DataGrid id="grid" right="10" left="10" top="10" bottom="10">
67
+ <mx:columns>
68
+ <mx:DataGridColumn headerText="Service" dataField="src"/>
69
+ <mx:DataGridColumn headerText="Title" dataField="title"/>
70
+ </mx:columns>
71
+ </mx:DataGrid>
72
+
73
+ </mx:Application>
data/lib/as3corelib.rb ADDED
@@ -0,0 +1,15 @@
1
+ require 'sprout'
2
+
3
+ module AS3Corelib
4
+ NAME = "as3corelib"
5
+ VERSION = "0.1.0"
6
+ end
7
+
8
+ Sprout::Specification.new do |s|
9
+ s.name = AS3Corelib::NAME
10
+ s.version = AS3Corelib::VERSION
11
+ s.add_file_target do |t|
12
+ t.platform = :universal
13
+ t.add_library :src, "../src"
14
+ end
15
+ end