Code Snippet - using as3Signals to delay function call by a frame   no comments

Posted at 7:12 pm in Flash/Flex

Sometimes there’s a need to delay a function call by a frame (normally to insure a rendering phase has been completed). Easily done with Signals:


import org.osflash.signals.natives.NativeSignal;

var delayFrameSignal:NativeSignal = new NativeSignal(this, Event.ENTER_FRAME, Event);

delayFrameSignal.addOnce(delayFrameCall);

function delayFrameCall(e:Event):void
{
trace("called");
}

Written by paddy on May 20th, 2010

FCSS - Loading/merging external css files and loading external fonts (with source)   no comments

Posted at 6:35 pm in Flash/Flex

Here is a proof of concept for using FCSS to load and merge css files externally for multilingual support. It could easily be integrated into a MVC(S) application but unfortunately I can’t share that code at this time. If you haven’t used FCSS take a look as it has some really handy features http://fcss.flashartofwar.com/. The demo may not look like much but don’t let that put you off how it can be used.

The basic process:

1. Load a default css file
2. Load a locale specific css file (could come from a flashVar or configuration setting)
3. Merger the 2 css files (FCSS handles this)
4. Get a list of used fontNames (with an optional rule to only return ones that have embedFonts:true)
5. Load font swfs ( this could easily be enhanced to work with a fontmapping configuration)
6. Use FCSS’s API for getting CSS textFormatting into a TextField (you could extend TextField to CSSTextField or the likes for real world applications)
7. Optionally use the css to set custom properties to manipulate positioning/layout of assets etc

Known issues:

· The CSS for fonts can only be; font, fontFace or font-face (FCSS hasn’t implemented font-family yet)
· The value of the font must not have quote “|’ around it i.e These will NOT work; font:”Arial”, font:’Arial’. This WILL work font:Arial (Need to log a bug with FCSS on this one)

Demo:
http://www.darklump.co.uk/experiments/fcss/loading-and-merging/

Source: (flash builder project)
http://www.darklump.co.uk/experiments/fcss/loading-and-merging/srcview/

Happy Days…

Written by paddy on May 20th, 2010

Ant Build scripts - java.lang.OutOfMemoryError   6 comments

Posted at 9:26 am in Flash/Flex

I seem to find getting a ‘java.lang.OutOfMemoryError’ a fairly common occurance when using ANT to build my flash projects ;( There’s not much docmentations out there and none of the solutions I found on the web fixed the issue for me ;( the code example below did…


<!– IMPORTANT added folk=’true’ to help avoid java.lang.OutOfMemoryError –>
<mxmlc file=”${module.class}”
output=”${module.target}”
keep-generated-actionscript=”${module.generateActionscript}”
debug=”${module.debug}”
actionscript-file-encoding=”UTF-8″
optimize=”true”
fork=”true”
compiler.show-binding-warnings=”false” incremental=”false” strict=”true” headless-server=”${flex.compile.headlessServer}”>
<!– IMPORTANT we need to give process more memory to avoid java.lang.OutOfMemoryError –>
<jvmarg line=”-Xms512m -Xmx700m -XX:MaxPermSize=700m -XX:PermSize=512m” />

Written by paddy on September 14th, 2009

Twitter   no comments

Posted at 7:46 pm in Uncategorized

Seeing as I never seem to find the time to write decent blog posts at the moment anyone who’s interested can follow me on twitter http://twitter.com/paddy_keane

Blogged with the Flock Browser

Written by paddy on September 3rd, 2009

Bit Masking 600% faster than modulus operator   2 comments

Posted at 9:12 am in Flash/Flex

Nuget of wisdom learned today - according to Lee Brimelow using Bit Masking to find odd/even numbers is 600% faster than modulus operator! it’s a pretty common task to need this when working with lists so every other row can have a different style.

Bit Masking

for (var i:uint=0; i<100; i++)
{
   if(i & 1)
   {
      row.color = 0xFF0000; // i is odd
   }
   else
   {
      row.color = 0x000000; // i is even
   }
}

Modulus Operator:

for (var i:uint=0; i<100; i++)
{
   if(i % 2 == 0)
   {
      row.color = 0xFF0000; // i is even
   }
   else
   {
      row.color = 0x000000; // i is odd
   }
}

Thanks Lee ;)

Written by paddy on June 10th, 2009

Tagged with

How to resist Flex ListBase components scrolling on mouseWheel if html page also scrolls   1 comment

Posted at 4:42 pm in Flash/Flex

Senario:

A Flex app is part of an html page that has a scrollBar. The Mouse is over a List component and the mouseWheel is used,  browsers (PC firefox) will sometimes scroll both the html page and the List. As far as I know there isn’t any easy way to disable Flex ListBase Classes interacting with mouseWheel? I’ve seen a few posts on forums asking how to overcome this problem.

A Solution:

For anyone that wants a fix here you go (click Button under List to change options):

http://www.darklump.co.uk/examples/flex/3/flash_and_browser_double_scroll/

(right click for source)

hope it helps, anyone got a better way?…

Written by paddy on May 14th, 2009

From Flex app to realworld prototypes with Nokia headset comp   no comments

Posted at 6:26 pm in Flash/Flex

Last year I helped built a flex site for a Nokia headset design competition. It was a great success with 10 times more entrance that forecast (hence the gallery navigation needing a bit of a overhaul). The winning designs where created last month and they look amazing. It’s wonderful to see designs come to life. There were some really impressive submissions. more images & details here:

http://www.creativereview.co.uk/crblog/nokia-headset-comp-winners/

The making of…

http://www.thrillerheadphones.blogspot.com/

nokia5-500x333johnnylighthands1nokia4

Written by paddy on April 7th, 2009

Away3D - Horizontal Spiral navigation (with source)   9 comments

Posted at 2:07 pm in Flash/Flex

Last November I had the pleasure of attending a great 2 day course on Away3D. Rob Bateman, who is a great teacher, helped explain tons about 3D development in flash. I’d highly recommend doing a course if you get the chance! Anyway, after the course I mocked up the below as a test. The codes been sitting around gathering dust so without further ado:

Demo:
http://www.darklump.co.uk/experiments/away3d/spiral-navigation/

Source: (you’ll prob need to compile it in flex builder)
http://www.darklump.co.uk/experiments/away3d/spiral-navigation/Spiral3D.zip

spiral3d

Written by paddy on March 16th, 2009

Quest to extradite harmless hacker, Gary McKinnon   2 comments

Posted at 12:33 pm in Thoughts

I’ve been following this case since the beginning, The London Mayor, ‘Blonde Borris’ has a pretty good summation of where it’s at. I wonder how much news coverage this gets in USA?

 

http://www.boris-johnson.com/2009/01/27/quest-to-extradite-harmless-hacker-gary-mckinnon/

 

http://freegary.org.uk/

 

http://search.bbc.co.uk/search?uri=%2F&scope=all&go=toolbar&q=Gary+McKinnon

 

 

Written by paddy on January 28th, 2009

Skill Matters - Free evening sessions, London   no comments

Posted at 4:03 pm in Flash/Flex

if anyones interested, I’ve just signed up to attend some evening session on; webservices, cloud computing, agile methods…. there are other free events too.

http://skillsmatter.com/event/ajax-ria/yahoo-developer-network-php-oauth-web-services

 

http://skillsmatter.com/event/cloud-grid/cloud-computing-101-an-intro-to-cloud-computing-281

 

http://skillsmatter.com/event/agile-scrum/agile-methods

Written by paddy on January 27th, 2009