Find text char under cursor using getCharIndexAtPoint()

March 28th, 2008 by Adrian Parr

I have just stumbled across g.wygonik’s blog post about finding which character is currently under the cursor. This is something that I have needed to do on numerous occasions back in the AS1 and AS2 days. Adobe did give us TextSnapshot, but that only worked on static textfields, not dynamic or input ones. Now you can use the getCharIndexAtPoint() method of the TextField class.

This demo is a slightly modified version of g.wygonik’s.

You can download the AS3 source from here.

Adobe LiveDocs documentation

Posted in ActionScript 3.0, Flash, Sample Code | 2 Comments »

Crash Flash CS3 in just two lines

March 28th, 2008 by Adrian Parr

I’ve just discovered two lines of code that can crash Flash CS3 on both Mac and PC.

Save any other work (FLAs) you may have open before proceeding!

  1. Create a new Flash File (ActionScript 3.0)
  2. Put the following two lines of code on the first frame.
  3. Test Movie
var ts:TextSnapshot = new TextSnapshot();
var c:int = ts.charCount;

Bingo!

Adobe Flash CS3 has encountered a problem and needs to close.

You can download the FLA from here.

UPDATE 14/08/09: It doesn’t crash in Flash CS4, instead it gives you the following error message …

ArgumentError: Error #2012: TextSnapshot class cannot be instantiated.
at Untitled_fla::MainTimeline/frame1()

Posted in ActionScript 3.0, Flash | 5 Comments »

AS3 Particles - Part 1

March 28th, 2008 by Adrian Parr

I’ve just been having a play around with some particle effect, inspired by Seb Lee-Delisle, who I saw speak on the subject at Flash on the Beach 2007.

You can download the AS3 source code here.

Posted in ActionScript 3.0, Sample Code | No Comments »

Setting the stage scaleMode in AS3

March 28th, 2008 by Adrian Parr

Ok, following on from yesterday’s post about setting the stage quality in AS3, this is how to set the scaleMode, so that you can control how your flash movie scales when the user resizes the Flash Player window or HTML page (if size in HTML is set to percentages).

In AS1 and AS2 we would have used …

Stage.scaleMode = "noScale";

And the four different values you could have given it are the strings “showAll”, “exactFit”, “noBorder” and “noScale”.

In AS3 it has changed slightly to …

stage.scaleMode = StageScaleMode.NO_SCALE;

And the four different constant values available are SHOW_ALL, EXACT_FIT, NO_BORDER and NO_SCALE.

Notice that stage is now all lowercase, and you should use the constant values instead of the string literals.

If you are doing this from within a class then you will need to import the ‘StageScaleMode’ class that lives in the ‘flash.display’ package.

import flash.display.StageScaleMode;

Posted in ActionScript 3.0, Flash, Sample Code | 1 Comment »

Setting the stage quality in AS3

March 27th, 2008 by Adrian Parr

This is how you set the stage quality using ActionScript 3.0

Old AS1 & AS2 code was …

_quality = "LOW";

New AS3 code is …

stage.quality = StageQuality.LOW;

The setting options are BEST, HIGH, MEDIUM & LOW.

If you are using this inside a class, you will also have to import the ‘StageQuality’ class from within the ‘flash.display’ package…

import flash.display.StageQuality;

Posted in ActionScript 3.0, Flash, Sample Code | 2 Comments »

Flash, Flex, AIR and RIA Conferences 2008

March 27th, 2008 by Adrian Parr

Just thought I’d put together a list of all the Adobe Flash, Flex and AIR conferences I know of that are going on around the world this year (plus a couple of others that are related, ie. SXSW and MIX). If you know of any other ones that I have missed then let me know and I’ll add it to the list.

January 2008

none

February 2008

TOCA ME
TOCA ME

February 23rd, 2008
Munich, German

FITC
FITC Amsterdam 2008

February 25th - 26th, 2008
Amsterdam, Netherlands

360|Flex
360|Flex Atlanta

February 25th - 27th, 2008
Atlanta, US

March 2008

MIX08
MIX08

March 5th-7th, 2008
Las Vegas, US

SXSW
South by Southwest (SXSW)

March 7th - 11th, 2008
Austin, US

Adobe Developer Week
Adobe Developer Week 2008

March 27th - 28th, 2008
Online

April 2008

360|Flex
360|Flex Europe

April 7th - 9th, 2008
Milan, Italy

Scotch on AIR
Scotch on AIR
April 11th, 2008
Dublin, Ireland

NAB Show
NAB Show 2008

April 11th - 17th, 2008
Las Vegas, US

FITC
FITC Toronto 2008

April 20th - 22nd, 2008
Toronto, Canada

May 2008

flashconference 2008
10th flashconference 2008

May 8th, 2008
Stuttgart, Germany

OFFF
OFFF

May 8th - 10th, 2008
Lisbon, Portugal

WebManiacs
WebManiacs 2008

May 19th - 23rd, 2008
Washington DC, US

FFK08
Flashforum Konferenz 2008

May 21st - 24th, 2008
Cologne, Germany

Multi-Mania
Multi-Mania

May 23rd, 2008
Kortrijk, Belgium

Web Flash Festival
Web Flash Festival

May 23rd - 25th, 2008
Paris, France

June 2008

Scotch on the Rocks
Scotch on the Rocks ‘08

June 4th - 6th, 2008
Edinburgh, Scotland

flashbelt
flashbelt

June 10th - 13th, 2008
Minneapolis, US

webDU
webDU 2008

June 12th - 13th, 2008
Sydney, Australia

FITC
FITC Chicago 2008

June 22nd - 23rd, 2008
Chicago, US

July 2008

none

August 2008

Flashforward
Flashforward 2008

August 20th - 22nd, 2008
San Francisco, US

Flex Camp London 08
FlexCamp
August 28th, 2008
London, UK

September 2008

Flash on the Beach
Flash on the Beach 2008

September 28th - October 1st, 2008
Brighton, UK

October 2008

Flash on Tap
Flash on Tap
October 7th - 9th, 2008
Rescheduled: May 28th - 30th, 2009
Boston, US

Flashpitt08
Flashpitt 2008
October 10th, 2008
Pittsburgh, US

The Actionscript Conference
The Actionscript Conference
October 19th, 2008
Singapore

Singularity
Singularity 08

October 24th - 26th, 2008
Online

November 2008

MAX
Adobe MAX 2008 North America
November 16th - 19th, 2008
San Francisco, US

December 2008

MAX
Adobe MAX 2008 Europe
December 1st - 4th, 2008
Milan, Italy

January 2009


Adobe MAX 2008 Japan
January 29th - 30th, 2009
Tokyo, Japan

Adobe on AIR Tour Europe
Don’t forget that the Adobe on AIR Tour is coming to Europe this spring. Starting off in Madrid, Spain on March 31st, and then running through to June 13th in Milan, Italy. Check the website to see if it is coming to a European city near you (it is in London on April 9th at The Brewery).

One other Flash conference that has happened in the past, but it doesn’t look like it is happening any more is Spark Europe.

Posted in AIR, Adobe, Conferences and Events, Flash, Flex | No Comments »

Displaying alternate Flash movies using SWFObject

March 27th, 2008 by Adrian Parr

I use SWFObject regularly to embed my SWFs in the HTML page. But was not sure how to display alternate SWFs depending on the Flash Player version installed on the end user’s machine. However, I have just come across a blog entry by David Stiller that clearly explains how to do it.

http://www.quip.net/blog/2008/flash/using-swfobject-for-more

Posted in Flash, HTML | No Comments »

Test post from Google Docs

March 13th, 2008 by Adrian Parr

This is a test post from Goolge Docs.

I have just read about doing this on the Web Worker Daily website.

Let’s see if it works.

Posted in WordPress | No Comments »

Setting framerate and stage size in AS3 project using Flex

March 10th, 2008 by Adrian Parr

UPDATE 29/07/2010: Flash CS4 and CS5 now support this metadata, and will override the stage properties that are set in the IDE.

If you are creating an AS3 only project in Flex then at some point you will want to set the framerate, stage size, and stage colour. This is not obvious to find and can be done in one of two ways.

The first method is by providing this information as compiler arguments in the Flex IDE. Go to Project > Properties > ActionScript Compiler. And in the ‘Additional compiler arguments:’ textfield you could enter the following …

-default-frame-rate 25 -default-background-color #FFFFFF
-default-size 800 600

The second method is by putting this information in to your main AS3 class as metadata. For example …

package {
     import flash.display.Sprite;

     [SWF(width='800',height='600',backgroundColor='#ffffff',frameRate='25')]

     public class Test extends Sprite {
          public function Test() {

          }
     }
}

Make sure you put the SWF Metadata AFTER any import statements.

Here are a couple of other blog entries on the subject …

Posted in ActionScript 3.0, Flex | 2 Comments »