Flash & Actionscript


23
Apr 10
by
Jos

I am a God

nice, Ralph!


25
Aug 09
by
Jos

actionscript 3 programmeer tips

Hier, krijg je een aantal tips van me waarmee je wellicht je actionscript 3 programmeerkunsten ietwat kunt verbeteren. Deze post is niet bedoeld voor geavanceerde actionscript 3 programmeurs, maar voor de beginners en overstappers van actionscript 2.

Continue reading →


16
Apr 09
by
Jos

Actionscript3 banner template (no more _root.clickTag!)

Steeds meer banners worden tegenwoordig ook in actionscript 3 geprogrammeerd. En dat is voor veel bannerkoninkjes het begin van een hoop ellende, want er bestaat geen _root.clickTag meer (en getURL ook niet)!

Geen paniek jongens en meisjes! Hieronder kun je een actionscript 3 template downloaden waarmee je automatisch de clickTag weer gebruikt die als flashvar wordt meegegeven.

update: werkt ook op deze manier: [ link ]

[ download as3 banner template ]

Voor de copy-&-pasters onder jullie: Maak een hitBut op de stage en gooi deze code erbij. Recipe for succes.

var clickTagUrl:String;

try
{
 var keyStr:String;
 var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
 for (keyStr in paramObj)
 {
 if (keyStr == 'clickTag' || keyStr == 'clickTAG')
      clickTagUrl = String(paramObj[keyStr]);
 }
}
catch (error:Error)
{
 trace( error.toString() );
}
if (clickTagUrl == null)
{
  trace('!! no clickTag found !!');
}

hitBut.addEventListener(MouseEvent.CLICK, jumpToUrl);

function jumpToUrl(e:MouseEvent):void
{
  trace(clickTagUrl);

  try
  {
   navigateToURL(new URLRequest(clickTagUrl), '_self');
  }
  catch (error:Error)
  {
   trace("error: "+error.toString());
  }
}

6
Mar 09
by
Jos

Actionscript 3 singleton pattern template for FDT 3 (Eclipse)

“What? The singleton pattern is gone in FDT3 actionscript 3?” No it’s not! You just have to alter a bit of code to get it to work. FDT didn’t include this template in their version 3. I got the pattern from “Actionscript 3 with Design Patterns“. Here’s the template code to have the CTRL-space-singleton action back again :)

Open FDT preferences, goto templates, then add a new one for AS3 (see pic below)

package ${enclosing_package}
{
	/**
	 * @author ${user}
	 */
	public class ${enclosing_type}
	{
		private static var __instance:${enclosing_type};

		public function ${enclosing_type}(enforcer:SingletonEnforcer) {}

		public static function getInstance():${enclosing_type}
		{
			if (${enclosing_type}.__instance == null)
				__instance	= new ${enclosing_type}( new SingletonEnforcer() );

			return __instance;
		}
	}
}
class SingletonEnforcer {}

6-3-2009-15-27-20


20
Feb 09
by
Hans

Sommige sites…

Soms kom je van die sites tegen op het wereldwijde web waaraan je ziet dat iemand (of meerdere mensen) er met liefde aan doorgeploeterd heeft.

Nachten werk, liters energy drinks en koffie, misschien een aantal pakjes sigaretten en flessen whisky. Uiteindelijk werkt het allemaal, je hebt alles gecheckt, in elk detail heb je al je concentratie en aandacht gestopt die je op kon brengen.

Dan mag je heel trots zijn als het over deze website ging.


11
Feb 09
by
Jos

Actionscript 3 particle foam emitter

Another dream of actionscript. Although this time a daydream ;-)

Here’s the source


9
Feb 09
by
Jos

Automated PNG crop tool in AIR

As a flash programmer or designer, you must run into this as wel. You have a big pile of png’s with transparency. You want to crop them to have as minimum transparency as possible (while maintaining the 1px transparent border).

Now here’s a tool for ya, which I created in AIR with Flex. Select a dir with PNG’s, then an output dir and off you go. It even outputs the crop positions (left, top, right, bottom) for you in a textfile.

This has no error handling yet, I’m just too lazy to build that. Here’s the full code. All up to you from here ;-) Oh, you need the as3corelib from Adobe for PNG encoding purpose.

update: Here’s the compiled air file for direct install (you’ll need to have AIR installed)

9-2-2009-12-32-43


4
Feb 09
by
Jos

Fun with webcam and isometric perspective

Remember the old days, with that toy full of spikes? Where you could put your hand on, or face, and it would follow your shape? Man, I’ve put some funny things in there :-)

So, for all you perverts, and the rest for that matter, here’s the chance to do it all over again. But then in a digital manner..

4-2-2009-16-30-44

check: www.nrg3.nl/lab/IsoCamFun

Alrighty then, here’s the source files.


3
Feb 09
by
Jos

Actionscript in 2020?

Being human beings, it’s in our nature to wonder about the things to come in the near future. It’s one of the reasons we’re inventing and innovating as we stride along the yellow brick road.

Hence, as an actionscript programmer, I wonder what the future will hold for actionscript. I’m deliberately pointing the arrow at actionscript instead of Flash, for actionscript has undoubtedly outgrown it’s mothers womb. Among the output formats today are not only swf, but also AIRborne, mobile and native desktop applications on multiple operating systems.

So the question is: where will actionscript be in.. say.. 2020? Will it still exist? And in what form? Will we have actionscript 4? Or even 5? Or is 3 robust and professional enough to withstand a decade of innovation?

I for one cannot go past the thought that it will absolutely still be alive (and kicking, for that matter). I think it even might still be actionscript 3. The flash players will continue to have amazing new features with every new major build, but my guess would be that actionscript 3 is powerfull and fast enough to cope with these options. But.. I might very well be wrong.

Now, since all you actionscript developers out there must have these same wonderings, I hereby invite you to comment on this article and share your thougts. I’m very curious for your replies!


13
Nov 08
by
Jos

normalize, interpolate, map

Zie hier drie briljant kleine functies om het leven van een programmeur wat aangenamer te maken: normalize, interpolate en map. Ideaal voor het maken van scrollbars, sliders of andere ellende waarbij je de properties van twee objecten met verschillend bereik met elkaar laat communiceren.

normalize geeft je een value tussen 0 en 1 terug op basis van de meegegeven value en bereik. Interpolate doet precies het tegenovergestelde. Deze geeft je de waarde terug van een genormalizede waarde binnen het meegegeven bereik. Map is de geniale combinatie van deze twee functies.

public static function normalize(value:Number, minimum:Number, maximum:Number):Number
{
return (value - minimum) / (maximum - minimum);
}

public static function interpolate(normValue:Number, minimum:Number, maximum:Number):Number
{
return minimum + (maximum - minimum) * normValue;
}

public static function map(value:Number, min1:Number, max1:Number, min2:Number, max2:Number):Number
{
return interpolate( normalize(value, min1, max1), min2, max2);
}

Je hebt ‘m nog niet? Ok. Stel je hebt een slider gemaakt en links en rechts de waarden 1kg en 500kg gezet. Je slider loopt van xpos = 50 t/m xpos = 250. Je wilt na het sliden van de user weten welke waarde in kg ie heeft gekozen.

Je normalized eerst de xpos door vNorm = normalize(xpos, 50, 250) te doen. Je weet nu waar je zit op de slider tussen 0 en 1. Deze waarde geef je door aan de interpolate: vInt = interpolate(vNorm, 1, 500) en deze geeft je dan het exacte aantal kg terug. En dat kan dan in één keer met val = map(xpos, 50, 250, 1, 500)!


10
Nov 08
by
Jos

Realtime flash filter explorer

Handy dandy tool to view the realtime results of the ConvolutionFilter and ColorMatrixFilter. It also gives a copy-paste output of the code to use.


28
Oct 08
by
Jos

Lekker online door kledingrekjes scrubben

Kleding op internet kopen is voor mij als jonge vader een uitkomst. Maar online ga je niet zo makkelijk even door alle shirtjes met je vingers.. In een winkel zie ik zo in een paar tellen of er wat tussen zit. Online moet ik het met platte plaatjes doen.

Dat kan toch ook anders? Hier een snelle frutsel van een tijdje terug. Inmiddels heb ik al van een betere versie gedroomd, met nog realistischere vervorming ;-)

klik voor the real thing


27
Oct 08
by
Jos

Flash on the beach 2009 Miami

Het was een feestje in Brighton. Maar volgend jaar is ie ook in Miami! Wij zijn alvast aan het sparen :-)


13
Oct 08
by
Jos

Simpele actionscript 2 carrousel met oneindig veel items

Zie hier een voorbeeld van een simpele carrousel in actionscript 2. Het aantal items is variabel, dus makkelijk aan te passen. Er wordt geen currentItem bijgehouden. Op het moment van animatie wordt er gekeken naar de voorganger om de nieuwe index te bepalen.

carrousel.jpg
(klik na de klik op linker of rechter item om de carrousel te laten bewegen)

Hier zijn de sources.

Er zit genoeg commentaar bij om je te helpen.
Succes!


28
Jul 08
by
Jos

De evolutie van Flash

Interessante presentatie van Peter Elst over de evolutie van Flash.