nwebb

Flex, Flash, AIR

Archive for May, 2007

Modulo – a couple of nice uses

Modulo is one of those extremely useful operators which I should probably use far more often than I do; to be honest I think many programmers would say the same. I got myself in to the habit of utilising it for certain scenarios (such as the examples below), but then I simply overlook it most other times.

Please feel free to post a comment and leave any examples if you've seen modulo being used in a particularly clever/useful way.

Scenario 1: Applying one collection of values to another (in a cyclical fashion, regardless of the length of either loop):

Actionscript:
  1. //declared at top of class:
  2. private var _colArr:Array = ["RED", "GREEN", "BLUE"];
  3.  
  4. //In some method:
  5. for(var i=0; i<10; i++){
  6.    trace("Apply " + _colArr[ i % _colArr.length] + " to object[" + i + "]");
  7. }

Scenario 2: Keeping a value within a specified range:

Actionscript:
  1. private function onEnterFrame(event:Event):void{
  2.    _angle++;
  3.    _angle %= 360;
  4.    trace(_angle);
  5. }

5 comments

FlexBuilder, FireFox and NPSWF32.dll (part 2)

It looks like a patch for the problem mentioned in my last post, is included in the Flex 2.0.1 Hotfix 2 which was released today.
How's that for service :]

p.s. The patch is also available separately here (thanks Matt)

1 comment

FlexBuilder, FireFox and NPSWF32.dll

The other day I installed the latest version of the Flash Debug Player in an attempt to resolve an issue with a 3rd party Flash application.

When I next fired up FlexBuilder I received a warning message from Firefox informing me that NPSWF32.dll could not be found in:
C:\Program Files\Mozilla Firefox\plugins
The dialogue let me choose to use my "existing player" and my content ran without any problems. However, this dialogue box appeared every time I tried to publish my content from FlexBuilder.

It appears NPSWF32.dll was installed here:
C:\WINDOWS\system32\Macromed\Flash
so I copied the .dll over to the correct Firefox plugins directory. - an easy fix in this case. I have also read about other problems with installation of the .dll on both Mac and Windows (see comments).

11 comments

Next Page »

Bad Behavior has blocked 399 access attempts in the last 7 days.