<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>absent design &#124; useful simple software &#187; actionscript</title>
	<atom:link href="http://blog.absentdesign.com/tag/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.absentdesign.com</link>
	<description>useful simple software</description>
	<lastBuildDate>Thu, 02 Feb 2012 02:54:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>An ActionScript developer with EXC_BAD_ACCESS? Just check your strings&#8230;</title>
		<link>http://blog.absentdesign.com/2010/10/an-actionscript-developer-with-exec_bad_access-first-just-check-your-strings/</link>
		<comments>http://blog.absentdesign.com/2010/10/an-actionscript-developer-with-exec_bad_access-first-just-check-your-strings/#comments</comments>
		<pubDate>Fri, 01 Oct 2010 05:33:19 +0000</pubDate>
		<dc:creator>Reuben</dc:creator>
				<category><![CDATA[objective-c]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[crash]]></category>
		<category><![CDATA[exec_bad_access]]></category>
		<category><![CDATA[memory management]]></category>

		<guid isPermaLink="false">http://blog.absentdesign.com/?p=313</guid>
		<description><![CDATA[Because ActionScript is an ECMA based language, strings are declared a literals using quotes: var string = "This is an ECMA string"; var anotherString = 'So is this'; Objective-C on the other hand, uses the class NSString for string access, and you declare a constant string using a convenience method by putting an @ in [...]]]></description>
			<content:encoded><![CDATA[<p>Because ActionScript is an ECMA based language, strings are declared a literals using quotes:
<pre>var string = "This is an ECMA string";
var anotherString = 'So is this';</pre>
Objective-C on the other hand, uses the class <em>NSString</em> for string access, and you declare a constant string using a convenience method by putting an @ in front of your quotes:
<pre>NSString *string = @"This is an NSString";</pre>
<strong>&#8220;Yeah&#8230;? So?&#8221;</strong></p>

<p>Well, I spent 2 hours yesterday tracking down a dreaded <em>EXC_BAD_ACCESS</em> somewhere in my app &#8211; being new to Objective-C I just assumed that I&#8217;d messed up my memory management somewhere and double-released, or used an <em>autorelease</em> where I shouldn&#8217;t have. But I checked and checked and <em>checked</em> and couldn&#8217;t figure it out. I finally managed to track the crash down to a particular message call to a method that took an <em>NSDictionary</em> as one of it&#8217;s arguments:
<pre>[self.flickrRequest callAPIMethodWithPOST:@"flickr.photos.search" arguments:
    [NSDictionary dictionaryWithObjectsAndKeys:OBJECTIVE_FLICKR_API_KEY, @"api_key",
    @"1",@"has_geo",lat,@"lat",lon,@"lon",@"5",@"radius",@"photos","media",nil]];</pre>
Whenever I sent this message, the program would crash. I checked for a memory leak in every object in my class, I even looked for memory leaks in the <a title="Objective Flickr" href="http://github.com/lukhnos/objectiveflickr">ObjectiveFlickr</a> framework&#8230; But <em>you</em> see the issue right? Look again:
<pre>... ,@"photos",<strong>"media"</strong>,nil]];</pre>
It looked right to me because I&#8217;ve been an ActionScript developer for so long that anything in quotes just looks valid. And in C it <em>is</em> a valid character string constant (so there was no compile-error).
But if you pass a C string (rather than an <em>NSString</em>) as they key in an <em>NSDictionary</em>, you get an <em>EXC_BAD_ACCESS</em>. And a lot of wasted time.
<pre>... ,@"photos",<strong>@"media"</strong>,nil]];</pre>
That&#8217;s better.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.absentdesign.com/2010/10/an-actionscript-developer-with-exec_bad_access-first-just-check-your-strings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress and AS3, a few notes</title>
		<link>http://blog.absentdesign.com/2009/03/wordpress-and-as3-a-few-notes/</link>
		<comments>http://blog.absentdesign.com/2009/03/wordpress-and-as3-a-few-notes/#comments</comments>
		<pubDate>Sat, 28 Mar 2009 07:49:09 +0000</pubDate>
		<dc:creator>Reuben</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.absentdesign.com/?p=12</guid>
		<description><![CDATA[I'm about halfway through developing my WordPress / AS3 library and I thought I'd note down a few things that have come up during development.]]></description>
			<content:encoded><![CDATA[<p>UPDATE: My <a href="http://blog.absentdesign.com/as3-library-for-the-wordpress-api/">WordPress AS3 API is now available</a>.</p>

<p>I&#8217;m about halfway through developing my WordPress / AS3 library and I thought I&#8217;d note down a few things that have come up during development.</p>

<h3>Does anyone know their blogId?</h3>

<p>The blogId parameter is required for most <code>wp</code>, <code>mt</code>, and <code>metaweblog</code> calls, yet there is no easy way for a user to find this out (you can&#8217;t get your blogId from the WordPress admin interface) &#8211; it seems the only way is through a call to <code>wp.getUsersBlogs</code>, using the data from the returned array to match up with the blog url that you are calling. I&#8217;ve simplified this process in my API so that whenever you make a webservice method call the api will check to see if a valid blogId is available, and if not, make the <code>wp.getUsersBlogs</code> call for you first.</p>

<h3>Inconstencies</h3>

<p>WordPress XML-RPC is inconsistent in the way it sends and retrieves some types of data. For example, categories are retrieved using <code>wp.getCategories</code> with the properties <code>categoryName</code> and <code>categoryId</code>, but if you use <code>wp.suggestCategories</code> you get <code>category_name</code> and <code>category_id </code>instead, meaning I have had to write duplicate parsing functions on a few occasions.</p>

<h3>Null values</h3>

<p><a href="http://code.google.com/p/as3-rpclib/">Ak33m&#8217;s XML-RPC library</a> (correctly, I assume) serializes <code>null</code> properties to strings with a value of <code>"null"</code>. This means  that when you send data to WordPress you can end up with &#8220;null&#8221; showing up everywhere &#8211; (A post with a category of &#8220;null&#8221; and a tag of &#8220;null&#8221;, a category with a slug of &#8220;null&#8221; etc). To avoid this I&#8217;ve had to create an IXMLRPC implementation for all of my WordPress structs that converts &#8220;<code>null" </code>to an empty string (<code>""</code>) before serialization.</p>

<h3>Multiple authors</h3>

<p>I haven&#8217;t worked out how to make <code>metaweblog.getRecentPosts</code> work with multiple authors. Because you have to authenticate using a username/password to make the call, you can only seem to retrieve posts by that particular author. I&#8217;m not sure how to get posts from multi-author blog without having to authenticate separately for each user, which is quite frustrating.</p>

<p>Apart from these minor issues, everything is going along smoothly though &#8211; I now have all post, category and page functions working correctly, options and comments to follow.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.absentdesign.com/2009/03/wordpress-and-as3-a-few-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple mxmlc compiling on a Mac</title>
		<link>http://blog.absentdesign.com/2009/03/simple-mxmlc-compiling-on-a-mac/</link>
		<comments>http://blog.absentdesign.com/2009/03/simple-mxmlc-compiling-on-a-mac/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 21:33:38 +0000</pubDate>
		<dc:creator>Reuben</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://absentdesign.wordpress.com/?p=7</guid>
		<description><![CDATA[The problem with being a flash developer from a traditional graphic design background is that there are some things that just don&#8217;t come naturally. One of these is working in a command-line environment. I&#8217;ve been using the Flash IDE as my development environment on the Mac since Flash 4. Around the time of Flash 5 [...]]]></description>
			<content:encoded><![CDATA[<p>The problem with being a flash developer from a traditional graphic design background is that there are some things that just don&#8217;t come naturally. One of these is working in a command-line environment.</p>

<p>I&#8217;ve been using the Flash IDE as my development environment on the Mac since Flash 4. Around the time of Flash 5 I started using BBEdit to edit external .as files, around MX I switched to TextMate for AS2 development, and now use TextMate exclusively for AS3 projects. But I&#8217;ve always used the IDE as my compiler, and there was always my designer&#8217;s preference to use the IDE to draw and layout objects rather than generate everything programatically. In developing my WordPress library I&#8217;ve been forced to bite the bullet and move to MXMLC, for the simple reason that the built in RPC libraries and Ak33m&#8217;s XML-RPC are only available for the Flex SDK.</p>

<p>I&#8217;m basically a total unix-command-line newbie, and there is a real dearth of information for people like me on how to command line compile in the mac environment. There is <a href="http://www.senocular.com/flash/tutorials/as3withmxmlc/">this tutorial by Senocular</a> for the PC, and there are plenty of tutorials out there about using MXML, integrating shell commands to use ANT etc etc, but all of these assume you <em>know what you are doing already</em>.</p>

<p>I <em>don&#8217;t know what I&#8217;m doing</em> though. All I want is to be able to integrate the Flex SDK classes without having to purchase and learn Flex and MXML &#8211; I&#8217;ve discovered  that this is of course not only <em>possible</em>, but <em>easy -</em> not that you&#8217;d know it by looking online.</p>

<h3>Here&#8217;s a way to do it</h3>

<h4>1. Download the Flex2 SDK from <a href="http://labs.adobe.com/technologies/flex/sdk/flex2sdk.html">Adobe Labs</a></h4>

<p>The Flex2 SDK is free! It includes the flex libraries and and the mxmlc compiler you will need to use the command line.</p>

<h4>2. Put the Flex2 SDK somewhere sensible</h4>

<blockquote>I put mine in <code>~/Documents/Library/Flex/flex2_sdk_hf1/</code></blockquote>

<h4>3. Open a terminal window</h4>

<blockquote>Usually <code>~/Applications/Utilities/Terminal.app</code></blockquote>

<h4>4. Navigate to your project folder, eg:</h4>

<blockquote><code>cd Documents/Projects/my_flash_project/Development/</code></blockquote>

<h4>5. Run fcsh</h4>

<p>Fcsh is the <em>Flex Compiler SHell</em>, a wrapper for MXMLC that makes compiling fast and easy. The simplest way to run this command is <strong>use the Finder to navigate to where you put the Flex SDK</strong>, find fcsh (in <code><strong>bin/fcsh</strong></code>) and <strong>drag and drop this file into your terminal window</strong>.</p>

<p>You should now see the following:</p>

<blockquote><code>Adobe Flex Compiler SHell (fcsh)
Version 2.0.1 build 159086
Copyright (c) 2004-2006 Adobe Systems, Inc. All rights reserved.</code>

<code> </code>

<code>(fcsh)</code></blockquote>

<h4>6. Compile your flash app using mxmlc</h4>

<p>The syntax to use is:</p>

<blockquote><code>mxmlc <span style="color:#00ccff;">path/to/MainFileForYourApplication.as</span> -sp <span style="color:#00ccff;">path/to/source/folder</span> -o <span style="color:#00ccff;">relative/path/to/output/filename.swf</span></code></blockquote>

<p>eg:</p>

<blockquote><code>mxmlc <span style="color:#00ccff;">src/com/reubenstanton/Main.as</span> -sp <span style="color:#800080;"><span style="color:#00ccff;">src/</span> </span>-o <span style="color:#00ccff;">../Deployment/main.swf</span></code></blockquote>

<p>The output will be something like:</p>

<blockquote><code>fcsh: Assigned 1 as the compile target id
Loading configuration file /Users/absent/Documents/Library/Flex/flex2_sdk_hf1/frameworks/flex-config.xml
../Deployment/main.swf (82769 bytes)</code></blockquote>

<p>You see that last line <code>../Deployment/main.swf</code>? If you navigate to this folder, you should see your swf sitting there! That&#8217;s it.</p>

<p>As you see above, fcsh <em>Assigned 1 as the compile target id</em>. This is just a shortcut to the compile command you just wrote &#8211; it means next time you want to compile you can just enter<span style="color:#993366;"> </span><code><span style="color:#00ccff;">mxmlc 1</span></code> instead of typing the whole command again.</p>

<h4>Now you can use Flex libraries in your flash projects without learning Flex and MXML.</h4>

<p>This took me hours to figure out, so I hope it helps some of you out there.</p>

<h4>Here are a few resources to help along the way:</h4>

<ul>
    <li><a href="http://labs.adobe.com/technologies/flex/sdk/flex2sdk.html">The Flex2 SDK</a> from Adobe Labs</li>
    <li><a href="http://labs.adobe.com/wiki/index.php/Flex_Compiler_Shell">The Flex Compiler Shell</a> from Adobe Labs</li>
    <li><a href="http://www.osxfaq.com/Tutorials/LearningCenter/">Using the terminal</a> from OSX Faq</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.absentdesign.com/2009/03/simple-mxmlc-compiling-on-a-mac/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WordPress and AS3 integration</title>
		<link>http://blog.absentdesign.com/2009/03/wordpress-and-as3-integration/</link>
		<comments>http://blog.absentdesign.com/2009/03/wordpress-and-as3-integration/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 19:55:48 +0000</pubDate>
		<dc:creator>Reuben</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://absentdesign.wordpress.com/?p=5</guid>
		<description><![CDATA[UPDATE: The AS3 Library for the WordPress API is now available. Recently I was searching around for an easy way to build a flash front-end for a WordPress managed website for a friend of mine. I was incredibly surprised to find that there doesn&#8217;t seem to be a properly integrated ActionScript library available for  WordPress XML-RPC, [...]]]></description>
			<content:encoded><![CDATA[<p>UPDATE: The <a href="http://blog.absentdesign.com/as3-library-for-the-wordpress-api/">AS3 Library for the WordPress API is now available</a>.</p>

<p>Recently I was searching around for an easy way to build a flash front-end for a WordPress managed website for a friend of mine. I was incredibly surprised to find that there doesn&#8217;t seem to be a properly integrated ActionScript library available for  <a href="http://codex.wordpress.org/XML-RPC_Support">WordPress XML-RPC</a>, or if one is available, Google and the Actionscript community don&#8217;t seem to know about it.</p>

<p><strong>So I&#8217;ve decided to build one.</strong></p>

<p>I&#8217;ve had a little experience building ActionScript API libraries before when I was testing the <a href="http://artbeatapi.absentdesign.com/">Artbeat API</a> with <a href="http://aqworks.com">AQ</a> &#8211; the Artbeat library has its flaws (not the least of which is no documentation of any kind), and I&#8217;ve learnt a lot from that experience.</p>

<p>My idea is single library that allows you to easily make all of the WordPress, MovableType, and Metaweblog API calls required to integrate flash with WordPress. I&#8217;m using <a href="http://ak33m.com/">Akeem Phillbert&#8217;s</a> <a href="http://code.google.com/p/as3-rpclib/">xml-rpc as3 library</a>, as a base for the XML-RPC calls.</p>

<p>I&#8217;ll be posting my progress here as the library develops.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.absentdesign.com/2009/03/wordpress-and-as3-integration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

