<?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>DEVELICIOUS</title>
	<atom:link href="http://www.develicious.nl/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.develicious.nl/blog</link>
	<description>Developing jummy new media!</description>
	<lastBuildDate>Thu, 24 Mar 2011 10:46:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Hyves OpenSocial &#8211; Swf can&#8217;t connect with javascript</title>
		<link>http://www.develicious.nl/blog/hyves-opensocial-swf-cant-connect-with-javascript/</link>
		<comments>http://www.develicious.nl/blog/hyves-opensocial-swf-cant-connect-with-javascript/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 10:44:23 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[Digging]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Hyves]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[OpenSocial]]></category>

		<guid isPermaLink="false">http://www.develicious.nl/?p=8</guid>
		<description><![CDATA[Okay, so I&#8217;m starting a project soon where the OpenSocial standard comes into play. To give it a little test-run, I&#8217;ve created a little gadget for hyves, which does nothing more than display a flash-animation while showing the thumbnails of my 10 last active friends over it. Just a little test to see if I [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, so I&#8217;m starting a project soon where the OpenSocial standard comes into play. To give it a little test-run, I&#8217;ve created a little gadget for hyves, which does nothing more than display a flash-animation while showing the thumbnails of my 10 last active friends over it. Just a little test to see if I understand the concept of creating a gadget.</p>
<p>So, an OpenSocial swf gadget sort of consists of 3 layers&#8230; at least, those are the ones I&#8217;m interested in. Swf &lt;&#8211;&gt; javascript &lt;&#8211;&gt; OpenSocial. In the Swf you use the ExternalInterface to communicate with Javascript, and Javascript makes the calls to OpenSocial. Retreiving data from a javascript is of course a piece of cake. The problem I ran into was when asynchronous calls came in play. For some reason the javascript couldn&#8217;t communicate the data back to my Swf, whatever I did&#8230; after a bit of digging, it turned out the problem was that, since my Swf gadget is hosted on my own domain instead of on the Hyves domain, I needed to add:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">Security.<span style="color: #0066CC;">allowDomain</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;*&quot;</span><span style="color: #66cc66;">&#41;</span>;
Security.<span style="color: #0066CC;">allowInsecureDomain</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;*&quot;</span><span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>After that, things worked like a charm <img src='http://www.develicious.nl/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>AS3 ExternalInterface code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">external</span>.<span style="color: #006600;">ExternalInterface</span>;
&nbsp;
ExternalInterface.<span style="color: #006600;">addCallback</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;loadDataResponse&quot;</span>, loadDataResponse<span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> r:<span style="color: #0066CC;">Object</span> = ExternalInterface.<span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;loadData&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> loadDataResponse<span style="color: #66cc66;">&#40;</span>xmlString:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> myxml:<span style="color: #0066CC;">XML</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">XML</span><span style="color: #66cc66;">&#40;</span>xmlString<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #808080; font-style: italic;">// Do whatever you want with the xml</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>The Hyves OpenSocial gadget / Javascript code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ModulePrefs</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;Develicious Hyves TestGadget&quot;</span> <span style="color: #000066;">summary</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">author</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">author_email</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">thumbnail</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">screenshot</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;260&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Require</span> <span style="color: #000066;">feature</span>=<span style="color: #ff0000;">&quot;opensocial-0.7&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Require</span> <span style="color: #000066;">feature</span>=<span style="color: #ff0000;">&quot;flash&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ModulePrefs<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Content</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;html&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #339933;">&lt;![CDATA[</span>
<span style="color: #339933;">	&lt;style&gt;</span>
<span style="color: #339933;">	html, body {</span>
<span style="color: #339933;">		margin: 0; /* set the iframed page margin to zero */</span>
<span style="color: #339933;">		background-color: transparent; /* set the gadget background to transparent */</span>
<span style="color: #339933;">	}</span>
<span style="color: #339933;">	&lt;/style&gt;</span>
<span style="color: #339933;">	&lt;div id=&quot;flashcontent&quot; name=&quot;EvenTesten&quot;&gt;</span>
<span style="color: #339933;">	&lt;/div&gt;</span>
&nbsp;
<span style="color: #339933;">	&lt;script type=&quot;text/javascript&quot;&gt;</span>
<span style="color: #339933;">		var swfVer = &quot;10&quot;;</span>
<span style="color: #339933;">		var flashVersion = gadgets.flash.getMajorVersion();</span>
<span style="color: #339933;">		var swfUrl = &quot;http://www.develicious.nl/projects/opensocial/testgadget/develicious_testgadget.swf&quot;;</span>
&nbsp;
<span style="color: #339933;">		function getFlashMovie(movieName) { </span>
<span style="color: #339933;">			var isIE = navigator.appName.indexOf(&quot;Microsoft&quot;) != -1;</span>
<span style="color: #339933;">			return (isIE) ? window[movieName] : document[movieName];</span>
<span style="color: #339933;">		}</span>
&nbsp;
<span style="color: #339933;">		function loadData() {</span>
<span style="color: #339933;">			var req = opensocial.newDataRequest();</span>
<span style="color: #339933;">			req.add(req.newFetchPersonRequest('VIEWER'), 'viewer');</span>
<span style="color: #339933;">			req.add(req.newFetchPersonRequest('OWNER'), 'owner');</span>
&nbsp;
<span style="color: #339933;">			var params = {};</span>
<span style="color: #339933;">			params[opensocial.DataRequest.PeopleRequestFields.FIRST] = 0;</span>
<span style="color: #339933;">			params[opensocial.DataRequest.PeopleRequestFields.MAX] = 10;</span>
<span style="color: #339933;">			params[opensocial.DataRequest.PeopleRequestFields.SORT_ORDER] = opensocial.DataRequest.SortOrder.TOP_FRIENDS;</span>
&nbsp;
<span style="color: #339933;">			// disabled example on how to filter your result on people who have the app installed</span>
<span style="color: #339933;">			//params[opensocial.DataRequest.PeopleRequestFields.FILTER] = opensocial.DataRequest.FilterType.HAS_APP;</span>
&nbsp;
<span style="color: #339933;">			// disabled example with multiple userid's        </span>
<span style="color: #339933;">			//var hyverIds = [&quot;XXXXXXXXX&quot;,&quot;YYYYYYYYYYY&quot;];</span>
<span style="color: #339933;">			//req.add(req.newFetchPeopleRequest(hyverIds, params), 'hyvers');</span>
&nbsp;
<span style="color: #339933;">			// example owner_friends</span>
<span style="color: #339933;">			req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.OWNER_FRIENDS, params), 'ownerfriends');</span>
&nbsp;
<span style="color: #339933;">			// example viewer_friends</span>
<span style="color: #339933;">			req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.VIEWER_FRIENDS, params), 'viewerfriends');</span>
&nbsp;
<span style="color: #339933;">			req.send(onLoadData);</span>
<span style="color: #339933;">		}</span>
&nbsp;
<span style="color: #339933;">		function onLoadData(data) {</span>
<span style="color: #339933;">			//var viewer = data.get('viewer').getData();</span>
<span style="color: #339933;">			//var owner = data.get('owner').getData();</span>
<span style="color: #339933;">			//var ownerfriends = data.get('ownerfriends').getData();</span>
<span style="color: #339933;">			//var viewerfriends = data.get('viewerfriends').getData();</span>
&nbsp;
<span style="color: #339933;">			//var viewerId = viewer.getField(opensocial.Person.Field.ID);</span>
<span style="color: #339933;">			//var ownerId = owner.getField(opensocial.Person.Field.ID);</span>
<span style="color: #339933;">			//var sViewerThumbnail = viewer.getField(Hyves.Person.Field.THUMBNAIL_URL_SQUARE_LARGE);</span>
<span style="color: #339933;">			//var sOwnerThumbnail = owner.getField(Hyves.Person.Field.THUMBNAIL_URL_SQUARE_LARGE);</span>
&nbsp;
&nbsp;
<span style="color: #339933;">			//ownerfriends.each(function(person) {</span>
&nbsp;
<span style="color: #339933;">			var rXml = &quot;&lt;hyvesdata&gt;&quot;;</span>
&nbsp;
<span style="color: #339933;">			var person =  data.get('owner').getData();</span>
<span style="color: #339933;">			rXml += &quot;&lt;owner&gt;&quot;;</span>
<span style="color: #339933;">			rXml += &quot;&lt;id&gt;&quot; + person.getId() + &quot;&lt;/id&gt;&quot;;</span>
<span style="color: #339933;">			rXml += &quot;&lt;gname&gt;&quot; + person.getField(opensocial.Person.Field.NAME).getField(opensocial.Name.Field.GIVEN_NAME) + &quot;&lt;/gname&gt;&quot;;</span>
<span style="color: #339933;">			rXml += &quot;&lt;fname&gt;&quot; + person.getField(opensocial.Person.Field.NAME).getField(opensocial.Name.Field.FAMILY_NAME) + &quot;&lt;/fname&gt;&quot;;</span>
<span style="color: #339933;">			rXml += &quot;&lt;uname&gt;&quot; + person.getField(opensocial.Person.Field.NAME).getField(opensocial.Name.Field.UNSTRUCTURED) + &quot;&lt;/uname&gt;&quot;;</span>
<span style="color: #339933;">			var gender = person.getField(opensocial.Person.Field.GENDER);</span>
<span style="color: #339933;">			rXml += &quot;&lt;gender&gt;&quot; + (gender ? gender.getDisplayValue() : 'unknown') + &quot;&lt;/gender&gt;&quot;;</span>
<span style="color: #339933;">			rXml += &quot;&lt;dname&gt;&quot; + person.getDisplayName() + &quot;&lt;/dname&gt;&quot;;</span>
<span style="color: #339933;">			rXml += &quot;&lt;nname&gt;&quot; + person.getField(opensocial.Person.Field.NICKNAME) + &quot;&lt;/nname&gt;&quot;;</span>
<span style="color: #339933;">			var firstAddress = person.getField(opensocial.Person.Field.ADDRESSES)[0];</span>
<span style="color: #339933;">			rXml += &quot;&lt;addresstype&gt;&quot; + firstAddress.getField(opensocial.Address.Field.TYPE) + &quot;&lt;/addresstype&gt;&quot;;</span>
<span style="color: #339933;">			rXml += &quot;&lt;uaddress&gt;&quot; + firstAddress.getField(opensocial.Address.Field.UNSTRUCTURED_ADDRESS) + &quot;&lt;/uaddress&gt;&quot;;</span>
<span style="color: #339933;">			rXml += &quot;&lt;addresslocality&gt;&quot; + firstAddress.getField(opensocial.Address.Field.LOCALITY) + &quot;&lt;/addresslocality&gt;&quot;;</span>
<span style="color: #339933;">			rXml += &quot;&lt;country&gt;&quot; + firstAddress.getField(opensocial.Address.Field.COUNTRY) + &quot;&lt;/country&gt;&quot;;</span>
<span style="color: #339933;">			rXml += &quot;&lt;birthdate&gt;&quot; + person.getField(opensocial.Person.Field.DATE_OF_BIRTH) + &quot;&lt;/birthdate&gt;&quot;;</span>
<span style="color: #339933;">			rXml += &quot;&lt;profileurl&gt;&quot; + person.getField(opensocial.Person.Field.PROFILE_URL) + &quot;&lt;/profileurl&gt;&quot;;</span>
<span style="color: #339933;">			rXml += &quot;&lt;thumbnail&gt;&quot; + person.getField(Hyves.Person.Field.THUMBNAIL_URL_SQUARE_LARGE) + &quot;&lt;/thumbnail&gt;&quot;;</span>
<span style="color: #339933;">			rXml += &quot;&lt;/owner&gt;&quot;;</span>
&nbsp;
<span style="color: #339933;">			var ownerfriends = data.get('ownerfriends').getData();</span>
&nbsp;
<span style="color: #339933;">			rXml += &quot;&lt;friends&gt;&quot;;</span>
<span style="color: #339933;">			ownerfriends.each(function(person) {</span>
<span style="color: #339933;">					rXml += &quot;&lt;friend&gt;&quot;;</span>
<span style="color: #339933;">					rXml += &quot;&lt;dname&gt;&quot; + person.getDisplayName() + &quot;&lt;/dname&gt;&quot;;</span>
<span style="color: #339933;">					rXml += &quot;&lt;nname&gt;&quot; + person.getField(opensocial.Person.Field.NICKNAME) + &quot;&lt;/nname&gt;&quot;;</span>
<span style="color: #339933;">					rXml += &quot;&lt;thumbnail&gt;&quot; + person.getField(Hyves.Person.Field.THUMBNAIL_URL_SQUARE_LARGE) + &quot;&lt;/thumbnail&gt;&quot;;</span>
<span style="color: #339933;">					rXml += &quot;&lt;/friend&gt;&quot;;</span>
<span style="color: #339933;">			});  </span>
<span style="color: #339933;">			rXml += &quot;&lt;/friends&gt;&quot;;</span>
&nbsp;
<span style="color: #339933;">			rXml += &quot;&lt;/hyvesdata&gt;&quot;;</span>
&nbsp;
<span style="color: #339933;">			var fm = getFlashMovie(&quot;swfgadget&quot;);</span>
<span style="color: #339933;">			fm.loadDataResponse(rXml);</span>
<span style="color: #339933;">		}</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #339933;">		function init() {</span>
<span style="color: #339933;">			// use the embedCachedFlash function with the wmode set to transparent so you flashmovie does not fall behind the Hyves presencebar in the footer and behind the main menu items of the Hyves website</span>
<span style="color: #339933;">			// if you don't want your flashmovie to be proxied you should use gadgets.flash.embedFlash()</span>
&nbsp;
<span style="color: #339933;">			if (flashVersion &gt;= swfVer) {</span>
<span style="color: #339933;">				gadgets.flash.embedFlash(swfUrl, &quot;flashcontent&quot;, swfVer, {base: document.location.host, id: 'swfgadget', width: '100%', height: '260', allowScriptAccess: 'always', wmode: 'transparent', flashVars: ''});</span>
&nbsp;
<span style="color: #339933;">				//gadgets.flash.embedCachedFlash(swfUrl, &quot;flashcontent&quot;, swfVer, {base: document.location.host, id: 'swfgadget', width: '100%', height: '380', allowScriptAccess: 'always', wmode: 'transparent', flashVars: ''});</span>
<span style="color: #339933;">			} else {</span>
<span style="color: #339933;">				//link to the latest flash player, if required</span>
<span style="color: #339933;">				document.getElementById(&quot;flashcontent&quot;).innerHTML = 'Get the latest Adobe Flash player &lt;a href=&quot;http://get.adobe.com/flashplayer/&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt; to see this content.';</span>
<span style="color: #339933;">			}</span>
<span style="color: #339933;">			//gadgets.window.adjustHeight();</span>
&nbsp;
<span style="color: #339933;">		}</span>
<span style="color: #339933;">		gadgets.util.registerOnLoadHandler(init);</span>
<span style="color: #339933;">	&lt;/script&gt;</span>
&nbsp;
<span style="color: #339933;">]]&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Content<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.develicious.nl/blog/hyves-opensocial-swf-cant-connect-with-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>All your base are belong to us!</title>
		<link>http://www.develicious.nl/blog/all-your-base-are-belong-to-us/</link>
		<comments>http://www.develicious.nl/blog/all-your-base-are-belong-to-us/#comments</comments>
		<pubDate>Mon, 21 Mar 2011 16:07:41 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[Rambling]]></category>

		<guid isPermaLink="false">http://www.develicious.nl/?p=6</guid>
		<description><![CDATA[Well, &#8220;Hello world!&#8221; just doesn&#8217;t do the trick anymore, and since I can&#8217;t come up with a normal title for this first post, I guess something nerdy will always do the trick So, why this website? Firstly, I haven&#8217;t got anything else to put up here, the last 2 years my website consisted of nothing [...]]]></description>
			<content:encoded><![CDATA[<p>Well, &#8220;Hello world!&#8221; just doesn&#8217;t do the trick anymore, and since I can&#8217;t come up with a normal title for this first post, I guess something nerdy will always do the trick <img src='http://www.develicious.nl/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>So, why this website?</p>
<p>Firstly, I haven&#8217;t got anything else to put up here, the last 2 years my website consisted of nothing more than a (in my &#8216;coding&#8217; eyes) pretty okay attempt at typography and design&#8230; or, more clearly said&#8230; the word &#8216;Develicious&#8217; and a half eaten strawberry (see <a title="The old frontpage... err... website" href="http://www.develicious.nl/index_old.html" target="_blank">exhibit A</a>).</p>
<p>Secondly, and probably the more important and valid reason, during my programming I sometimes run into problems, but I always manage to find the solution. Sometimes fast, after using my good friend google and finding what I need instantly&#8230; sometimes it takes me a few hours, when I have to start digging myself because I can&#8217;t find anything on google. So the idea is to save other people the trouble of doing the same digging as me <img src='http://www.develicious.nl/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.develicious.nl/blog/all-your-base-are-belong-to-us/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

