Posts Tagged ‘flash’

Error optimizing byte code

Frustration

Actually it will, but that is beside the point...

Or, why I would sometimes like to kill and maim in the world of virtual machines. Why can’t we just all program C++. Y U NO MEMORY LEFT?!!11

When you are like me, you are writing vast, bloated pieces of Flash because you keep thinking up ridiculous requirements for your games. Let’s take our new ANWB/TNO game for example (we’re still in the market for new names, apart from “CARamba!”)

Now the first problem is connecting over a thousand road pieces. Most of it by hand, since it is all quite intricate stuff. But when I reached about half the map, my script that tries to find out what directions the car should take exploded. Stack Overflow. Kablooie.

So I could build the map up unto 15 seconds of script execution time. Which was about half the map. Now Gnuif is brilliant but still took almost a week to rewrite the code in such a way that we were able to bring execution times back to under a second. Nice going.

Then I finally fixed the Map but flash exploded in my face with it’s mysterious 5005: end of bytecode.

So I was like WT-fucking-F?!

It appears that the Java virtual machine, Java being the language in which flash is written, has a memory buffer limit of 128MB. Also for compiling. Which basically means that if you try to compile BIG flash files it blows up in your face.

Of course there is a trick. There always is. They Write about it over here and Google is actually quite helpful

[...] To do that in Windows: right click on my computer -> properties -> advanced -> environment variables -> make a new variable:

JAVA_TOOL_OPTIONS

and add this value:

-Xmx1024M

Then log out or restart.

There was an issue when I opened Flash CS4 after the restart. I got the message:
“Error initializing Java Runtime Environment. You may need to reinstall Flash.”
I had to change the value from -Xmx1024M to -Xmx256M (or -Xmx128M). A value of -Xmx512M and higher causes every time the error “Error initializing JRE. You may need to reinstall Flash”.

After I set up the variable “JAVA_TOOL_OPTIONS” with value “-Xmx256M” everything started working fine.

Sigh. Ow Adobe, why are you making my life so much harder ?

Posted: April 5th, 2011
Categories: nerd, research, web, work
Tags: , , , , , ,
Comments: No Comments.

Teh Drafts I’ve been saving

“Have you ever noticed that other peoples stuff is shit and your shit is stuff?”
- George Carlin

I’ve been saving up an enormous amount of shit from the interwubz that I meant to publish here on the blog but never got around to. So I decided to publish all the rubbish in one go, and make some notes on what the hell you are looking at. This should actually have been published in 4 posts, but most is rather old allready, and to be totally honest its not funny or interesting enough to be published in parts, but together it makes a good read.

Leroy H. Vokes - Quote Wisely and Well

Leroy H. Vokes - Quote Wisely and Well

There is a meme going around on the interwubs  ( also on Facebook ) which lets you make your own band covers. It’s simple:

  1. Go to wikipedia and hit “random page“, this is your artist name
  2. Go to random quotations and pick the last 4 or 5 words from the last quote, this is your album name
  3. Go to Flickr and Explore the last 7 days, the third picture is your album art

Above is my humble first try. Leroy H. Vokes appears to be an American Indian War Veteran from the latter half of the 19th century. And “quoting wisely” and well sounds like good advice to me.

I hear VJ Void is stil trying to automate the process, I’ll let you know when he is finished ;)

Indoor Projection Mapping
by Vision Impossible

YouTube Preview Image

“Mapping”, is the art of using video projection on buildings, while using the architecture in your work. Usually this is done outside. But  Vision Impossible, probably the best VJ team on this planet, has found a way to do it inside. This video was taken in Berlin and is the first indoor mapping project I know of. Amazing stuff!

Procedural Progamming

Procedural programming is the idea that you use formula’s and seeding to generate random variations in existing objects; it’s quite powerful if you want to have infinite landscapes or cities. The latter example was done quite brilliantly in the following video:

YouTube Preview Image
Through A1EX.

Generative Images Through Actionscript and Processing
By Gwen Vanhee

More generated images and videos, in AS3 and processing this time, can be found on Vimeo. Eyecandy, instead of a cityscape. But beautiful eyecandy indeed:

http://www.vimeo.com/17693219 http://www.vimeo.com/14406099

More on the process here and a very handy dandy AS3-image saver class

Vanhee even manages to sell the imagery, to IBM even;
http://www.vimeo.com/10152534

Got the links through Sven.

Yahoo Smut Server

If you loose your job through budget cuts, what do you do. Well whine and bitch about it of course, or you can also re-route the image search of your employer to serve all the happy residents on the internet, disgusting and filthy images through cute thumbnails.

The puppy. Don't click on it

The puppy. Don't click on it

The Register has the whole story the picture was taken from the coverage of TechCrunch

Not so Anonymous

As you may have read earlier I’ve been strolling to the muddy servers that make up Anonymous. I wrote about the terrible software they use to do their fames dDos attacks. These “LOICS” don’t only pingflood Anonymous’ targets like Mastercard, but also reveal the IP-addresses of the 15-year olds that operate them. Sloppy work. Damn sloppy. But XKCD has this nailed in a cute comic, that says it all.

wikileaks

Taken from the amazing XKCD

Holy Shit

YouTube Preview Image

Holy shit indeed.

From Kick Ass To Jack-Ass in under 4 seconds

yes, this cracked me up

Are you scared of this man?

Are you scared of this man?

Real life superheroes, just when you though the world couldn’t get even more ridiculous, a CNN feed pops up telling the tale of daring people wearing spandex and patrolling the streets of American cities. No, this is not a comic, these people are for real. I so wished I was making this up

Fear and loathing at http://www.reallifesuperheroes.com/

More from the webz
http://www.wlwt.com/news/19305002/detail.html (video)
http://bloggingouttacontrol.com/2011/01/08/cnn-interviews-the-real-life-superheroes-of-seattle/ (video)
http://en.wikipedia.org/wiki/Real-life_superhero (wiki, check the references… O_o )

Breaking Flash references through serialization

Here is to Google: this article needs to be found by As3 Flash and Flex programmers on the keywords: serialization, JSON, encoding, decoding,  referencing, object referencing, breaking referencing and complicated objects, Resistance is futile. Programming, actionscript. Flash hack, and the final way to un-reference objects in flash.

So here is the git of it; when you want to break references in as3 for a copy or a clone you usually need to get the stuff out of an object and put it back in again; this is hard with complicated objects, but luckily this exactly the same as serialization! for instance through JSON, which is already available in the neatly packed library Casalib

So your copy can be written as:

var copyObject = JSON.decode(JSON.encode( originalObject ))

Well now. I intended to write this in such a way that everybody would be able to understand this, but after a few days of pondering, I’ve decided that that would never work. So I’ll try to keep it brief and interesting, but if you have no idea what as3 is, or referencing for that matter; I’m not sure you’ll get this. Still what I’m writing here is about sheer brilliance and beautiful insight AND I have a picture of the Alien Love Messiah:

(more…)

Posted: February 6th, 2011
Categories: general, media, nerd, research, technology, web, work
Tags: , , , , , , , , , ,
Comments: No Comments.

Scripted Interfaces

“What is information to some, is static to others” – attributed to Cloude Shannon

A question that has been maddening web- and interface designers for years is how interfaces are described. An interface consists, in short, in three basic elements. 1) the design, 2) the interaction 3) the functions So, a button can be red (design) change color when hovered over (interaction) and lead to another page (function). These three elements need to be unified into one language that describes all elements, or at least connects to another language that describes parts of the three main elements. Since the dawn of web design these different elements have been encoded into HTML.

<style>
a { color: red }
a:hover { color: yellow }
</style>
<a href="somedomain.com">button</a>

A red button, changes color on roll-over, leads to some domain when clicked.
Style, the design, has been separated, quite early, from the actual function (ie. where the link leads) using CSS, or cascading style sheets. Which is a good thing. But where does interaction go? (in this case, into the CSS) and the function? The actual function; the code that tells your browser to go and fetch an internet address and parsed it as HTML, is not there, that’s why we call HTML a Markup Language and not a programming language. Strictly speaking, the actual function is burrowed somewhere in your browser. If HTML does anything of the three interaction elements it’s simply connecting design (CSS) with interaction (in this case also in CSS) and function (int he browser)

In Flash one would write something like:

var someButton:SimpleButton = new Simplebutton()
someButton.addChild(overstate.png)
someButton.addChild(normalstate.png)
someButton.addEventListener(MouseEvent.RollOver, function(e) { // show overstate } )
someButton.addEventListener(MouseEvent.RollOut, function(e) { // show normalstate } )
someButton.addEventListener(MouseEvent.Click, function(e) { NavigateToURL( new URLRequest("someDomain.com") ) } )

Now this code wouldn’t parse, and strictly speaking “NavigateToURL” is also something of a shortcut, but as the Class of NavigateToURL is defined within the Flash virtual machine, we’ll accept that flash renders both design (overstate.png and normalstate.png are images), interaction (RollOver and RollOut) and the actual function (NavigateToURL).

The problem is that the first example can be understood, quite effortlessly by any graphic designer building a web page and the latter one cannot; it’s programming code and graphical designer get all icky when they get within ten feet of programming code.
To make things even worse, the actual programming of most websites is done on the server side of the web, giving the designer only generated HTML which has to be scripted in CSS. This works to a certain extend, but making CSS is tedious and rigorous work

Flash, even though it started out as an animation designer application, is mostly coding. To meet the current demands of frameworks and server side code Adobe has tried to bridge the coding and HTML gap with Flex, which looks a bit like:

<?xml version="1.0" ?>

<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
 <mx:HTTPService id="httpRSS" url="http://www.petefreitag.com/rss/" resultFormat="object" />
 <mx:Panel id="reader" title="Pete Freitag's Blog Reader" width="500">
  <mx:DataGrid id="entries" width="{reader.width-15}" dataProvider="{httpRSS.result.rss.channel.item}" cellPress="{body.htmlText=httpRSS.result.rss.channel.item[entries.selectedIndex].description}">
    <mx:columns>
      <mx:Array>
        <mx:DataGridColumn columnName="title" headerText="Title" />
        <mx:DataGridColumn columnName="pubDate" headerText="Date" />
      </mx:Array>
    </mx:columns>
  </mx:DataGrid>
  <mx:TextArea id="body" editable="false" width="{reader.width-15}" height="300" />
  <mx:Button label="Load Blog Entries" click="{httpRSS.send()}" /
 </mx:Panel>
</mx:Application>

Which is interesting, but it still doesn’t combine all three functions. What I especially dislike about it that it is Code, even the ‘Markup part’ of it, still reads like code, not like design. It just wants to implement to many features.
Now adobe had build a product, called Catalyst, which tries to render a photoshop document into this Flex-code, allowing the programmer to work on it, after it is designed, but this is till bulky, sluggish code at best.

So I’m a big fan of designing script and markup languages for content platforms, allowing the designer to work as free as possible, within a set framework. With readable markup. Now I tried this twice, and I failed the first time, and I got a bit further the second time.

The first script language describes Nltracks objects and looks something like this:

<relatedContent>
 <win winX='0' winY='0'/>

 <!-- graphical elements -->
 <!-- background -->

 <backgroundImages>
 <image name='topPic' url='_styling/elements/gerelateerd/video/weblink_bg_top.png' />
 <image name='middlePic' url='_styling/elements/gerelateerd/video/video_bg_middle_stretchme_V.png'/>
 <image name='bottomPic' url='_styling/elements/gerelateerd/video/video_bg_bottom.png'/>
 </backgroundImages>

 <!-- content -->
 <contentPlace contentPlaceX='0' contentPlaceY='0' />
 <listPlace listPlaceX='20' listPlaceY='65' />

 <icon iconX='30' iconY='2'/>

 <contentImages>
 <image name='button1_out' url='_styling/elements/gerelateerd/weblinks/button_bezoek.png'  />
 <image name='button1_over' url='_styling/elements/gerelateerd/weblinks/button_bezoek_mo.png' />

 <textField name='title' setX='85' setY='3' setW='130' setH='40' sharpness='10'/>
 <textField name='subTitle' setX='85' setY='3' setW='130' setH='30' sharpness='10'/>    <!-- let op, subtitle is nu related aan textheight van de 'title' -->
 </textFields> 

 <topTextContent>Weblinks bij:</topTextContent>

 <id_object>tags</id_object>
 <relatedURL>weblinks/related</relatedURL>

 <refreshTime>10000</refreshTime> <!-- microseconds -->
 <reverse>false</reverse>
 <maxItems>2</maxItems>

</relatedContent>

This describes a “content window” on a certain point on a infinite Canvas website and its jabberish, sluggy, big and non-transperant. This is clearly a poor languate. It even needs an extra CSS file for styling, splitting text and image design. But, truth be told, CSS is so ubiquitous nowadays that I really don’t see a way around it.

Next, I tried to make a more universal language to describe Canvas objects. I build a system called “blokkendoos”, which allowed more freedom and features an editor to build with.

blokkendooseditor

The editor allowed for editing a background, and adding elements like text, mailforms, images, links etc. unto them. Now as an editor this worked pretty nifty, but of course at the end of the day it still shits XML;

<canvasObject>
 <win winX="294" winY="301"/>
  <deeplink>#/custom/winacties 2</deeplink>

   <object width="1108">
   <backgroundImages>
    <image name="topPic" url="blokkendoos/images/header/1180_large_header.png"/>
    <image name="middlePic" url="blokkendoos/images/body/1108_large_body.png"/>
    <image name="bottomPic" url="blokkendoos/images/footer/1108_large_footer.png"/>
    </backgroundImages>

    <component type="Image" place="static" id="0">
      <settings targetWidth="1108">
       <position x="7" y="0" w="266" h="273"/>
       <source>http://data.nltracks.nl/live/blokkendoos/win_alain.png</source>
       <link enabled="true" target="_self">#/nieuws/19220/Winnen! Het nieuwe album van Alain Clark</link>
      </settings>
    </component>

    <component type="Image" place="static" id="1">
       <settings targetWidth="1108">
         <position x="7" y="1" w="266" h="273"/>
         <source>http://data.nltracks.nl/live/blokkendoos/winfrom.png</source>
         <link enabled="true" target="_self">http://www.nltracks.nl/#/custom/frommermann</link>
       </settings>
   </component>
 </object>

 <object/>

 <tags usetags="false"/>
</canvasObject>

Now this actually gets usefull; it describes something called “objects” and “components” and then it combines HTML like terms and positioning information.
still, it is quite rigorous about background positioning and has strict descriptions of certain types.

So, for Marduq, I’m building a menu-script that allows you to spawn marduq-objects into place. These are build with any object flash can handle, video audio, html, css and whatnot. It needs to position a DVD like menu, with buttons and text; and I’m thinking about something like:

So I came up with something like this:

scriptable

Which is described like this:

<marduq>

 <box 0="#0" y="#-1" width="500" height="500" bgColor="0xbb3333" alpha="0.4" >
        <image url="nltracks_radio_thumb.jpg" x="#0" y="#-0.6" scale="1"/>
 </box>

 <image url="couvsdsc01es2.jpg" x="#1" y="#0" scale="1">
     <image url="viva espana.jpg" x="#-1" y="#0" scale="0.3"/>
     <image url="nltracks_radio_thumb.jpg" x="#-1" y="#-1" scale="1">
          <image url="nltracks_radio_thumb.jpg" x="#-1" y="#0" scale="1"/>
          <image url="nltracks_radio_thumb.jpg" x="#-1" y="#1" scale="1"/>
     </image>
 </image>

 <button type="toggle" action="play_pause" x="500" y="500" width="250" height="250" bgColor="0x4455dd" alpha="0.5">
      <image name="normalState" url="videoplayer_fout_.png" x="#-1" y="#-1" scale="0.4"/>
      <image name="overState" url="videoplayer_fout_.png" x="#-1" y="#-1" scale="0.4"/>
      <image name="doneState" url="videoplayer_fout_.png" x="#-1" y="#-1" scale="0.4"/>
 </button>

</marduq>

(actual script is longer) What this script does is spawning certain things on a Canvas (infinite or regulare browser window). It then positions it and scales it. All the argumets are optional. If a node is spawned within another node it regards that parent as the ’screen’, which means that the position [0, 0] renders as the top left corner of the parent thing. Extra stuff can be given with a certain thing; for example a button is extended with three images. These define the different states. Also an ‘action’ is defined as an argument, allowing interaction with the platform.

Now the kinky part is that it utilizes 3 (three) different positioning engines, so you never have to worry about resolution anymore. The first one is actual pixels measured from the top left corner. so [100, 100] will place it nicely at a 100 pixel right and 100 pixel down position as measured from the top left corner of the parent object of ’screen’

Now the second one is made up in percentage, and is triggered by adding an %-sign in the location parameter like [ 50%, 50% ], which puts the top right corner of your exactly in the center of your parent object. To position it exacly in the center you will have to subtract half of the objects width and height.

The third one I have called ‘grid spacing’ and is triggers with an #-sign. In this system [ #0, #0 ] defines the absolute center of the parent object, without the need of subtracting width or height. [#-1, #-1] will place your object in the top left of the parent object, and [#1, #1] positions it at the bottom right. The object stays within the parent always. So if you want to position a menu to the right of the Canvas, simply locate it at [#1, #0] which centeres it at the rigth and middle place of the parent object.

Well, for everybody still reading…

I think that is just dandy!

:)

Posted: July 29th, 2010
Categories: media, nerd, research, site, technology, web, work
Tags: , , , , , , , ,
Comments: 2 Comments.

AS3 Bug of the Week (again? Yes, again)

URLDecoding is one of those things that makes life a little bit more of a pain.

the idea is that in a typical URL certain characters are not allowed; for instance an % or an $ or & are used for functions in URLs, and can thus not be used. Now that is a pain, since some URLs need them. For instance http://www.somedomain.com/track/salt&pepper needs to be escaped as the space and the ampersand cannot be used directly. This is done with a %26 sign; ( somedomain.com/track/salt%26pepper) Every decent programming language has a function called escape or URIdecode to do this for you.

Flash has it too, you can find it in the manual however, it escaped %23, %24 and %26 the %25 escape (the %-sign) is strangely missing and will throw an error.

Why?

Because the people at Adobe want to kill me. Or so I think. Why?! Why can’t I escape %-signs?!

The workaround is simple, and reads something like:

function escapeURL(someURL:String):String {
 someURL = someURL.split("%").join("P")
 someURL = URLDecode(someURL)
 return someURL
}

In the split I replace the % signs with P’s, cuz’ if i was to replace them with %25 it still crashes.

Why, Adobe?! WHY…

Posted: June 15th, 2010
Categories: nerd, technology, web, work
Tags: , , , , , , , ,
Comments: No Comments.

I can haz Audiomixer?

audioChannels

Ok.

So we are tinkering with this interactive video platform, Marduq, and I wanted to make an Mp3 player, to go with your video. Or slideshow. Or whatever. Like so. But you may notice that if you start fiddling with the volume, the system breaks. Crashes. Burns. Death. Agony.Wailing.

This is because in Marduq, we only have 1 channel of audio mixing, ie. the video-soundtrack. But as research of Surfinnetje showed over a year ago: Watching snowboarders in a half-pipe and choosing different mp3-files is fun. So we needed a way to track different soundtracks in the system. Both mp3, system sounds, ambient sounds, youtube sounds and video sounds. And of course a master.

Well. Here is the prototype.

* applaus *

* applaus *

This thing mixes a youtube channel and flash net video together with a couple of mp3 files. The mp3 even have balance dials The youtube and the master have balance dials, but they do nothing. Also. The video and youtube can not be paused in this prototype. The PlayheadController will take care of that.

And when you start-up, everything is ON . TOGETHER. Making NOISE!

And some props. On a side note. I can now also build twoyoutubevideosandafuckingcrossfader. Now if only I could get those youtube players to pitch… hmm…

Posted: April 29th, 2010
Categories: nerd, research, site, technology, web, work
Tags: , , , , , , , , ,
Comments: No Comments.

PsysiXX are cool

almost_alive

“It’s so… Alive ?”

Soo… I was tinkering with a project for a company called 9292. The problem was this; I needed to draw buttons (or dots actually) on a map of the Netherlands, only the coordinates are set per city, an not on the actual location. This can result in multiple dots in one place.
Now here is a problem because users need to be able to click on the different dots, which they can’t if dots overlap each other. Agony. Headache. Problem.

So this got me thinking; First, I thought, making some random variations to the x and y coordinates would solve it. Alas; even with random variations dots can still intersect and Overlap.
Then Gnuif pointed me to a system where every second dot in the same place is mapped in a spiral, thus never making them intersect. But although it seemed to work, I didn’t find it satisfactory. All those spirals gave weird and unnatural patterns on my map.

So I tried a different route, adding the dots to a Particle System where I gave all the dots a negative gravitation. With an inverted mass, the dots would repel one and other.
Now if a number of dots happen to be in the same place, they will repel each other until their boundaries stop touching.  Tada! Problem solved.

(more…)

Posted: April 20th, 2010
Categories: web, work
Tags: , , , , ,
Comments: 1 Comment.

Flash AS3 Bug of the Week

SecurityError: Error #2121:  Security sandbox violation: SoundMixer.computeSpectrum:
http://www.learningactionscript3.com/wp-content/uploads/mixer/Mixer.swf  
cannot access http://xangadix.marduq.tv/Smoov.swf.
This may be worked  around by calling Security.allowDomain.
at  flash.media::SoundMixer$/computeSpectrum()
at  app::Spectrum/onLoop()

So. I was tinkering with a ComputeSpectrum function in, Flash for Marduq, which basically gives you a music equalizer display. Little bars going up and down with music.. Nifty. So I build it in and started to get really weird security bugs. First I thought it my allowDomain(*) then my crossDomain.xml policy files. Then I asked Urias. Then Daniel. Then I started to scream and bitch and moan. Then I started drinking beer. Then, finally, I found this bug report: [#FP-147] which basically told me to write the fucking spectrum analyzer myself.

It’s these kind of bugs that makes me want to switch platform.

(sigh)

Posted: April 13th, 2010
Categories: nerd, research, site, technology, work
Tags: , , , , , , , , , , , ,
Comments: No Comments.

Multitasking is for the Rich

iphone-dial-retro

Yes, Steve? I want my money back

Ow that is just dandy, Steve;

11:38AM Q: Are you concerned about leaving out your older customer base (with the lack of features for older devices). A: (Steve) Well, a lot of these products that are out there are the most recent products. The old devices will get the update, but they’ll miss some of these features like multitasking. If that’s an incentive for them to upgrade to a new device… terrific.”

So I have to buy a new phone if I want to listen to music and check my mail at the same time. Well, I will buy an new phone, and it’s going to run on Android so I can download porn from the app store. Thank you very much.

11:00AM These ads are looking a lot more like apps. Almost totally separate apps that live inside apps. Is your mind blown yet?

As it turns out with OS4 the iPhone platform will soon run with better iAds than Apps. Go fucking stick it somewhere. Taking the world by the Balls here. And what is also not really to my liking is the fact that the whole printing industry is licking the iPad like crazy; they should; it’s there last resort, but still. I’m slowly thinking of spraying the lot at Apple with some vaporized drug that will make them think that they are fondled with, by catholic priest who have a special interest in the color of their testicles. They want to dig their way unto the balls themself. And they have cutlery ..!

#Update; Also a nice one for the macevangalists; When quizzed on why Apple wouldn’t allow unsigned apps on the iTunes App Store he was equally combative, claiming that:

“You know, there’s a porn store for Android. Anyone can download them. You can, your kids can. That’s just not a place we want to go.”

Ow? But that is exactly where I want to go. Is this idiot seriously claiming that I shouldn’t be watching porn on my own phone? Should we explain again why Video 2000 failed against VHS? Why Joost failed? tsk.

So the next phone will be nice and Android.

More through engadget

But my guess is that they have used it already. So. How do I make money from this?

(more…)

Posted: April 9th, 2010
Categories: media, nerd, research, web, work
Tags: , , , , , , , , , ,
Comments: 1 Comment.

Zoning out

Zoning out. Just zoning out. Turn on, tune in and drop out.

We’re finishing up the most complicated project untill now. To be honest it isn’t the most pretty code I’ve ever written but it’s neat.  If you like to check it out: NL tracks. It’s dutch only I’m afraid.

This one has really a potential to grow. Tonight we had a group session with some people from the target-audience, working with the site. It is really nice to see people working with a product that we made. It reminds me of Apenkooi; when the first guy actually completed the game in 17 seconds. Later he came up to me while I was veejaying and told us he was the guy. I told him to take the stage and play the game for us on the screens in the club and he amazed us by completing the course in 18 seconds. My personal record still is at 21 seconds Wink

In any case, after almost a year of research and programming we have come up with a beta that -I think- has great potential.Technical details include a completely XML-skinned application on a ‘canvas’ interface. It’s is like google maps, it can be dragged around. All interactive elements can talk to each other and the system tries to show relations with the ‘current’ content (a radio, a video, news) and the ‘other content’. We’re now applying it to light-news and music, but be fitted easily for an important news event (elections 2008? georgia crisis). The content is mostly ‘generated’ from other sources and used in the site.

I don’t say it a lot, but I’m kind of proud

Now it’s time to take a step back. To zone out a bit. focus on friends, family and more. This is XangadiX, zoning out.

Posted: September 23rd, 2008
Categories: vj, web, work
Tags: , , , , , , , , ,
Comments: No Comments.

I hate Flash (AS3 part 3)

We are the Borg. You will be assimilated. Resistance is futile. Your distinctiveness will be added to our own…

- Star Trek

We had a glitch in the CNR website; on a Macintosh (may God punish the users of Apple with lightning and fire) the small Flash application that scrolls the pictures was making errors. When loading the page and clicking outside the browser window would make the pictures go berserk. Now I blamed my intern for writing sloppy code and thought nothing of it. In the v2 of the side I rewrote the entire thing in AS3, thinking that would fix the problem. The original file had used a tween-animation and a masking movieclip to make the animation and the ‘reflection’, in the new AS3 application everything was done in code.

So imagine my surprise when I found out that the new version exhibit the exact same error as the original one. I searched the web for hours but couldn’t find this bug anywhere. I found that quite odd because it seemed so elementary to me. Until there where some vague references to it on Flashkit forums. Still I haven’t found any to fix it to my satisfaction; but it seems that on an Apple running OSX mouseclicks are still recorded, even when the browser window, let alone the Flash application, loses focus. So if I click left from the window flash will still receive a (negative) mouse coordinate. Sloppy work there at Apple. frustrating too. I am now making plans to get some niggers from the hood and get medieval on Steve Jobs ass. (apple bashing is now off)

update: Waxle and I have been tinkering with this last nigth, and it is as I expected, OSX gives back weird coordinates when clicking outside the browser window. But it doesn’t return a number relative to the 0, 0 coordinate in Flash, but a rather weird but static number. Consider the following script:

addEventListener(Event.ENTER_FRAME, update)
addEventListener(MouseEvent.CLICK, clickHandler)
var mX:Number
var mY:Number

function update(evtObj:Event) {
mX = mouseX
mY = mouseY
msg.text = mX + “, ” + mY
}

function clickHandler(evtObj:Event) {
msg2.text = “the mouse was clicked at: ” + mX +”, ” +mY
}

Paste it in frame one and create 2 textfields (msg and msg2). You will now trace the mouse coordinates on ENTER_FRAME and register clicks. This works fine within flash but on macintosh it returns the following when clicking outside the browser:

mousetrace

Click for larger image

107374143.5 -107374182.4 ?!! (which does google some results, but still). The workaround is of course to limit the mouseX input by something like if (mouseX > 0 and mouseX < stage.stageWidth) but still.

What can produce such an error? different assignment of the register in Moterola chips? The overlays with the ’sensitive corners’ in Mac OSX ? I really don’t know.

But still, here is the problem and a workaround, thanks to Waxle who tested this through on the mac. And with this file: mousetracer2.swf you can test it for yourself.

Posted: April 3rd, 2008
Categories: nerd, research, technology, work
Tags: , , , , ,
Comments: No Comments.

the beauty of AS3 (part 2)

We are the Borg. You will be assimilated. Resistance is futile. Your distinctiveness will be added to our own…

- Star Trek

Ow god, ow god why didn’t I jump on this train earlier? Actionscript 3 rules, not even because it has such a simple and powerful structure. Not because exchange of classes and knowledge has become so simple. Not because it’s so damned fast and supports full control of your sockets and HD video material; but simply because you can write a spectrum analyzer in under 10 lines of code. You don’t want to know how many faul tricks and hacks I’ve used to build a simple analyzer. And now, it’s just there. So simple. So elegant…

//spectrum analyzer codes

var byteArray:ByteArray = new ByteArray();

var byteArray2:ByteArray = new ByteArray();

function maakSpectrum(event:Event) {

SoundMixer.computeSpectrum(byteArray, true, 2); // FFD

SoundMixer.computeSpectrum(byteArray2, false, 1); // WAVE

graphics.clear(); //meterjes weghalen

for (var i:Number = 0; i < 512; i += 4) {//aantal “metertjes”

if (i<256) {

graphics.lineStyle(0, 0xff3333);

graphics.beginFill(0xff3333);

}else{

graphics.lineStyle(0, 0×33ff33);

graphics.beginFill(0×33ff33);

}

graphics.drawRect(i + 20 , 100, 2, byteArray2.readFloat() * 100);

if (i%16 == 0) {

frame = Math.round(    byteArray.readFloat() * 100 )

this["vu"+i].gotoAndStop(frame)

}

}

}

Such beauty (sigh)

Posted: March 24th, 2008
Categories: nerd, web, work
Tags: , , ,
Comments: No Comments.