As2 functions in as3 – some examples

July 8th, 2009

Had a student ask me how to add a movieclip from the library to the stage,

pre-as3 this was easily done via the excellent attachMovie function, it was a simple yet powerful function which did the job properly good,

Unfortunately like many function which were properly good yet quite were based on analogies which were IDE specific these were removed in as3, and those wishing to replicate their functionality were left in a ditch on fire to read adobe’s frankly awful documentation, or buy one of the many as3 bibles which have become essiessenal reading in this post-as2 age.

So basically i give you the simple attachMovie function (for were you are working with libraries object which are not in child swfs):

Read the rest of this entry »

Processing.js==cool

July 7th, 2009

Been playing with processing js it’s very very cool, but i can’t help thinking that flashblock just went out of date, how long before we start to get canvas based adverts coming in…

experiments all rip offs of my favourate processing experimentor http://www.complexification.net/

http://zapper.hodgers.com/files/javascript/processing_test/index_bin.html

http://zapper.hodgers.com/files/javascript/processing_test/index_angel.html

http://zapper.hodgers.com/files/javascript/processing_test/index_candy_light.html

of course my similar flash experiments were much much faster, but it shows that this new fangled js maybe onto something…

Binary Ring Studies
http://zapper.hodgers.com/files/binary_ring.html

http://zapper.hodgers.com/files/blurry_binary_ring.html

More info about processingjs here

check it out, it could be the future as soon as IE get their canvas support sorted, it maybe does vml stuff but since i went mac i care less and less about obslete browsers while on hoilday :)

Zapper

ps FireUnit and Code Burner are fab install them into your Firebug today!

Sometime you feel so proud, sage stats now support flash

June 16th, 2009

Had an issue in VR look what got added :)

http://st.sageanalyst.net/crossdomain.xml

http://su.sageanalyst.net/crossdomain.xml

cross domain files especially with socket servers are quickly becoming the bane of my life, grrr

setting JAVA_HOME in windows

June 4th, 2009

Answered this for someone, maybe it will be of use for someone else

1) How do I really set the JAVA_HOME variable so that windows recognises it?

You can set is as an environment variable or manually as part of a bat file

BAT file
1. Create a text file in Notepad

2. Type =>

REM This will
set JAVA_HOME = C:\Program Files\Java\jdk1.6.0_14\bin

echo Hello – java path is %JAVA_HOME%

jar cvf newfile.jar *
jar cvf newfile.jar c:\very\long\file\path\*

echo – world
<= Type

3. Save file as jar_doer.bat

4. Double click jar_doer.bat

Note this prosumes java is installed in C:\Program Files\Java\jdk1.6.0_14\

environment variable
1. Right click “my computer” click properties
2. Click advanced tab
3. Click environment variables
4. In user variables box, hit new
5. enter variable name = “JAVA_HOME”, variable value = “C:\Program Files\Java\jdk1.6.0_14\bin”
6. restart machine

JAVA_HOME should be set for any commandline stuff

Cheers

Zap

Runtime Customisible Functions -> Flash/Flex

June 4th, 2009

I was doing a code review for my more recent project visualising radio, and saw what I thought was a bug,

dataLoader.addEventListener(Event.COMPLETE, onXMLComplete(rssTitle));

i was about to go into one of my trade mark, “now what you’ve done is great, but…. actually it doesn’t work” when to my surprise the code was working fine, i had a look further down and saw the following genius

private function onXMLComplete(t):Function {
return function( e:Event ) {parseXML(t, e);}
}

This was fantastic, this wee programming trick (while perhaps creating a possible memory leak around the function scope) is amazing!

All of a sudden using this trick all sorts of fun, customisable functions are possible (if not advisable)

eg

function event_callback(data_object_for_callback:Object):Function{

return function( e:Event ){

// some code involving “e” and “data_object_for_callback”

// doing cool stuff

}

}

anyway i thought the technique was cool enough to blog about, when i get a copy of flash installed i’ll post a flex/flash example

Zap

Ps sorry for the lack of a flash example, my work machine currently doesn’t even have it installed… though because of my current projects all being flex it doesn’t matter too much, and the designers are much happier without me optomising there graphics ;)

of htaccess and query strings…

May 20th, 2009

Oh how the months go by when your having fun, working hard, and being a manager…

ahhh

Anyway I had to fix this issue recently when one of the software engineers on the top-secret project I can’t talk about hit a problem,

Basically the htaccess documentation is a bit naff

see these links

http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#RewriteCond
which clearly states that the query string isn’t passed through to rewriterule …. ah yes really obvious… but after 2-3 mins of inspection it was obvious this was the correct place to check query string parameters which are stripped and put into a parameter
http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#RewriteRule
the core function of the standard apache htaccess file
So the basic query string modifications are done as follows
Stage 1 – isolate information in the query string using the power of regex
# so say your query string is ?cat=hello
# this should make the variable %1 equal to hello
RewriteCond %{QUERY_STRING} ^cat=(.*)$
Stage 2 – add this query string information into the rewrite
# so say your query string is ?cat=hello
# this should make the variable %1 equal to hello
RewriteCond %{QUERY_STRING} ^cat=(.*)$
# this should take the person to http://www.bbc.co.uk/hello/
RewriteRule .* http://www.bbc.co.uk/%1/
See example
http://zapper.hodgers.com/files/javascript/htaccess_verus_querystring/?cat=podcasts
(content of the .htaccess file)
http://zapper.hodgers.com/files/javascript/htaccess_verus_querystring/htaccess.txt
hope this helps someone as i know it confused the hell out of the poor SE, also note the final htacces was rather alot more complex, than the wee sample above,
cheers
Zap
(while I’m here I’d like to apolognise to the poor author of sifr who i cornered in a pub recently and shouted at a bit, sorry i’ve been hanging out with a html/css crowd recently and they really don’t like what you’ve done to them, something about designers bullying them, like i was saying soooorrrrie…)

Zapper’s Joining the Real World 2-3 years late

March 24th, 2009

After 2-3 years of delaying, shouting, ranting and raving.

I’ve finally accepted that I’m going to have to use flex, not that bloated flex builder, but the flex commandline compiler.

It seriously feels like I’ve went back 4 years, back at uni, using javac and gcc, using emacs, build scripts. How 90’s, how ugly, how unintuitive, how lacking in grace,

Kinda feels like a step back from the warmth of the Flash IDE’s womb, boy what an ide that was, how ground breaking, but that’s products done, no more, inappriorate, obselete now, onto the next…

I’m sorry flash, I simply can’t justify us developing together anymore,

Bye bye Flash, thanks for all the Iru bru, it’s been good times,

remember winning “dare to be digital”, winning against the odds with those 4 damn artists and just you and me to do the code,

and “colin and cumberland” missing out on that bafta by a hair’s width that was a fun introduction to working life,

all those games we made for CBBC’s, that damn balamory karaoke, lip syncing all those songs for days on end, what about Raven, Bitesize, Webwise, and a hundred and one widgets and gadgets,

into the hole of jam, the year that never was,

and the laments and trials of the many video players application me and you made over the years, alas their brother iPlayer ate them all,

but I’m now sleeping with your sister Flex because not I don’t love you anymore it’s because she’s Cooler than you, and that way everyone looks at me when were together,

hope you understand,

love

Ant

So I present with much joy and the happiness of the first new thing i’ve learnt in ages my first flex compile, hacked from the AS3Flex2b3StarterFiles I found on an trek of the internet-> prepare to be amazed, source

Ant

Bat Script Retrostylee

March 19th, 2009

Hi guys haven’t posted for a while, thought I’d post this wee little script I did yesterday afternoon for a site

It’s basically a proxy cache-ish system, using wget + ftp + a bat script to tie it all together

So basically tada – it’s a script which every X secs downloads a file, then uploads said file automatically, without user intervention

There’s two different version, one for those lucky enough to be on a raw internet connection, and one for those who your unluck enough to have to access the internet through a proxy server/and a ftp proxy server, which configures wget/ftp appriorately,

NonProxy & Proxy Server Version

Script BAT –

:: wget needs to be explicitly told where the bbc proxy is
set http_proxy=HTTP_PROXY_LOCATION

:: echo off

:: Repeat until end
::==============
:repeat_command

:: delete old file / download new file / upload new file
:: =============
echo “UPDATING FILE”
del rss.xml
wget.exe INSERT_URL_LOCATION_HERE –output-document=rss.xml
ftp -s:proxy_command_list.txt

:: wait 1 seconds then repeat
::==============
ping 1.1.1.1 -n 1 -w 100000 >NUL
GOTO repeat_command

Script Niggle details –

  1. Requires wget.exe (included in zip above) in the same folder
  2. FTP.exe on the commandline

Changes maybe needed in “XXX_command_list.txt”

  • The proxy version may need to be changes to your proxies unique login settings
  • The ftp server like wise may require the authorisation in a different order

I would recommend ftp-ing on the commandline once by hand, then coping these settings into the file

Adobe Alchemy – Eg Swf Compiler for C++

November 24th, 2008
More easy to understand and appriorate documentation from our friends at Adobe

More easy to understand and appriorate documentation from our friends at Adobe

The above is attempt my 1st to get alchemy working, for those that don’t know Alchemy is an rather interesting project done by Adobe labs, basically it’s a swf compiler for C++ and C to flash byte code.

Potientally it could open up all those lovely C++ projects on encryption, audio/video decoding and encoding, etc etc

More programming languages are also build in C++ so these could also be compiled as perl vm swfs and such, so perl code written side by side with your actionscript could be possible with hopefully minial effort,

Anyways it’s late, tried to get it working, unfortunately all the documentation links lead to internal wiki links which give the rude message above, adobe really should try to be less rude with it’s 200 messages, it’s infact rather made me want to catch up on sleep than try to attempt compiling vlc over…

Ant out… zzzz

For those interested adobe’s standard 200 message

For those who may have Adobe network access any chance i could nab a wee gander at this page

http://labs.stage.adobe.com/wiki/index.php/Alchemy

However that rather negative 200 message aside, alchemy really is a amazing bit of kit, it could just win this whole “Silverlight vs Flash” war that is heating up, and could even kick-start a proper “C++ vs Air” war

I’m really looking forward to what happens on this front

Zapper

Live Webcam Chroma Keying in Flash

November 24th, 2008
A example of why people use green screens when doing chroma keying

A example of why people use green screens when doing chroma keying

Hi guys had a friend ask me today if Flash can do chroma keying for a webcam,

i said it could and gave instruction to the various functions and processes required, however 15 mins later decided this was a jolly fun thing to attempt to do, several hours and much playful tinkering later…

Got the working demo here

As always (or at least where I feel I can without compromising projects) here’s the full source

(ps tried to keep the code as simple as possible, so should be fairly easy to reuse)

Ant