Main

February 25, 2008

New blog on using Flash, and AIR as it pertains to Flash CS3

A quick public service announcement that I have started up a new blog at a new domain (Flashthusiast.com). I'll be blogging about Flash authoring tool there (now that I re-joined the Flash team... by the way), instead of here.

Also, I just blogged about the AIR update as it pertains to Flash CS3 (mostly - where can you get that update??)

February 28, 2006

New Resources on Adobe Labs - AS3 Class Libraries

As learnt at FlashForward keynote(http://weblogs.macromedia.com/dehaan/archives/2006/02/notes_from_flas.cfm), new class libraries up on Adobe Labs as follows:

1 corelib (basic utilities)
2 FlexUnit
3 Flickr
4 Mappr
5 RSS and Atom libraries
6 Odeo
7 YouTube


Check out the details, and download the open source libraries from here:

http://labs.macromedia.com/wiki/index.php/ActionScript_3:resources:apis:libraries

January 31, 2006

Flash Player version penetration: new stats are up for Flash Player 8

The new NPD survey results are online for Flash Player 8. Please take a look at the amazing results here:

http://www.macromedia.com/software/player_census/flashplayer/version_penetration.html

Worldwide Ubiquity of Macromedia Flash Player by Version - December 2005

For Flash Player 8, note:

US: 45.2%
Canada: 56% (!!!)
Europe: 55.1%

Way to go, Player 8!

May 18, 2005

Event Listeners in Flash Macrochat

So many Macrochats!! Here's another, on Flash this time!



Event Listeners in Flash Macrochat
Tuesday, June 7, 2005
1:00 PM - 2:00 PM US/Eastern

To Register:
www.macromedia.com/cfusion/event/index.cfm?event=detail&id=223992&loc=en_us

Event Listeners in Flash: From OnHandlers to Listener Objects--the right way! Many Flash developers are still using outdated event handlers to catch events. This was fine for ActionScript 1.0, but ActionScript 2.0 users and v2.0 components users should be using Listener Objects to catch events. Macromedia Product Support Engineer Bentley Wolfe will lead this live discussion on how to migrate away from On Event handlers and towards the correct use of listeners.

What You Will Learn

Using event handlers and click handlers
Where event handlers won’t work
Why listeners are better
Where listeners don’t work
Creating a listener
Listening for one event from multiple locations

Who Should Attend?
MacroChats are live, hour-long in-depth Macromedia product technical discussions geared towards teaching customers new technical skills. These presentations are free to attend. Please make sure the subject matter is of interest to you as participation is limited to 200 customers.

Questions
For Macromedia community information, please e-mail community@macromedia.com.



May 06, 2005

MediaPlayback scrubbing event

1. Drag a MediaPlayback instance onto the Stage.
2. Open the Component Inspector panel and enter an instance name of my_mp
3. Type in a URL to some FLV video of yours.
4. Open the Actions panel and paste the following code:

my_mp.addEventListener("scrubbing", scrubbingListener);
function scrubbingListener(evt_obj:Object):Void {
trace(evt_obj.type+" @ "+getTimer()+" ms (isScrubbing="+evt_obj.detail+")");
trace;
}

5. Ctrl+Enter to test.
6. Scrub that video (that means drag the playhead). The Output panel will open and tell you where you scrub and true/false.

Don't know if that'll be useful to any of you or not, but there you are.

May 05, 2005

Flash player statistics updated

To read the latest Flash Player statistics, head to:

www.macromedia.com/software/player_census/flashplayer/version_penetration.html

To read about how the survey is conducted, see:

www.macromedia.com/software/player_census/npd/

March 09, 2005

Avoiding sandbox messages

You might notice that, inconsistently, you see security sandbox errors when you create things in Flash. To clarify 'odd time' -- if I load a JPEG into a Loader I don't see the message, but if I load a JPEG into the ScrollPane I might see the message every 4/5 tests. Note: You only see the message in the Output panel (ie: in the test environment - when you Ctrl+Enter) - the SWF works in the test environment despite the message, and there is no message outside of the test environment.

I didn't pay it much attention, but did run across this blog post recently:

http://www.visible-form.com/blog/000085.html

Therefore, if I load a JPEG from flash-mx.com and want to avoid seeing the message, I can add the following to the code:

System.security.allowDomain("http://www.flash-mx.com");

Then you won't see anything in the Output panel.

So yes, pre-blogged but worthwhile nonetheless.

February 08, 2005

satellite images in Flash

Loosely staying with the theme of maps, this time check out a really cool Flash implementation of a satellite image viewer. You might be able find and zoom into your house (I did!)

Check it out the top 10 images here:

http://www.spaceimaging.com/gallery/top10_2004/

You could even catch an image of a building, such as our new office here.

Just need another zoom level to spot those pedestrians ;)

January 31, 2005

Using XPath with Flash

A blog post of mine from yesteryear, but the issue came up recently (and the class is undocumented) so I thought I'd reblog it.

Flash MX 2004 introduced the XPathAPI class which allows you to do simple XPath searches within Flash. This can be very useful for searching XML packets based on node names and attribute values.

In order to use XPath searches within Flash you first need to include the XPathAPI class into your Flash library by including the DataBindingClass if it hasn't been included already. If you've already set up bindings this class may have been included automatically, otherwise you'll need to select the class from the common libraries by selecting Window > Other Panels > Common Libraries > Classes. From the Classes.fla library panel you can simply drag a copy of the DataBindingClasses component into your current Flash document's library. Now you can import the class by typing "import mx.xpath.XPathAPI;" or by using the classes fully qualified name when accessing its methods by prefixing the class' methods with mx.xpath.XPathAPI.".

The XPath class has two methods; selectNodeList and selectSingleNode. The selectNodeList method returns an array of XML nodes matching the XPath expression, whereas the selectSingleNode returns only the first matching node.

You can see an example of the XPath API in ActionScript below, before you can test the movie you have to make sre that you have a copy of the DataBindingClasses component in your movie's library by dragging it from Common Libraries > Classes into your current Flash movie's library.

import mx.xpath.XPathAPI;
var rssfeed_xml:XML = new XML();
rssfeed_xml.ignoreWhite = true;
rssfeed_xml.load("http://www.markme.com/dehaan/index.rdf");
rssfeed_xml.onLoad = function(success:Boolean) {
  if (success) {
    var titlePath:String = "/rdf:RDF/item/title";
    var title_array:Array = XPathAPI.selectNodeList(this.firstChild, titlePath);
    for (var i = 0; i<title_array.length; i++) {
      trace(title_array[i].firstChild.nodeValue);
    }
  } else {
    trace("error loading XML");
  }
};

If you want more info on this class, check out Nate Weiss' book here.

January 04, 2005

Tweening with ActionScript

So the Tween/Transition stuff wasn't put in the Flash documentation. Good news is that there's now an article on the Developer Center about using the classes. Bad news is the article came from me ;)

If you haven't used the classes yet, check the article out out anyway, see if it helps you with your Flash work. Fairly simple article (had to keep that word count in check...)

macromedia.com/devnet/mx/flash/articles/tweening.html


If you have any ideas for expanding the content, or wish to share some of your own tips, please comment below.

December 23, 2004

How big can your Flash be? See this TechNote...

I just noticed a great TechNote about how big your Flash SWF files can be.

Flash TechNote: How big can a Flash movie be?

The TechNote reviews how big your files can be, how much memory they should use, a bit about math, and so forth. It's certainly worth a read, particularly if you live on the wild side and ever approach these (logical) limitations.

December 14, 2004

Sorting and the DataGrid component

Another Tuesday LiveDocs day! The following example continues the theme of DataGrids and sorting.

The following example sorts columns either numerically or alphabetically. By default columns are sorted alphanumerically, so if you had a DataGrid with "1, 213, 11, 7" it would sort as "1,11,213,7". By writing a custom sorting function that uses Array.sortOn, you can sort the dataProvider yourself using a numeric or text sort (even sort text as case insensitive).

1. Make sure you have DataGrid in Library
2. Add following ActionScript to frame 1 of the Timeline:

import mx.controls.gridclasses.DataGridColumn;
var my_dp:Array = new Array({name:'Grissom, M.', avg:0.279}, {name:'Bonds, B.', avg:0.362}, {name:'Cruz, D.', avg:0.292}, {name:'Snow, J.', avg:0.327});
var dg = this.createClassObject(mx.controls.DataGrid, "my_dg", 999, {dataProvider:my_dp});
dg.setSize(240, 180);
var name_dgc:DataGridColumn = new DataGridColumn("name");
name_dgc.headerText = "Name:";
name_dgc.width = 160;
dg.addColumn(name_dgc);
var avg_dgc:DataGridColumn = new DataGridColumn("avg");
avg_dgc.headerText = "Avg:";
avg_dgc.width = 60;
dg.addColumn(avg_dgc);
//
var myListener:Object = new Object();
myListener.headerRelease = function(evt:Object) {
var sortOrder:String = evt.target.sortDirection;
var sortColumn:String = evt.target.columnNames[evt.columnIndex];
switch (sortColumn) {
case 'name' :
sortArray(my_dp, sortColumn, "TEXTNOCASE", sortOrder);
break;
case 'avg' :
sortArray(my_dp, sortColumn, "NUMERIC", sortOrder);
break;
}
};
my_dg.addEventListener("headerRelease", myListener);
//
function sortArray(my_array:Array, sortColumn:String, sortType:String, sortOrder:String) {
var sortOptions:Number = 0;
switch (sortType.toUpperCase()) {
case 'NUMERIC' :
sortOptions |= Array.NUMERIC;
break;
case 'TEXTNOCASE' :
sortOptions |= Array.CASEINSENSITIVE;
break;
}
if (sortOrder.toUpperCase() == 'DESC') {
sortOptions |= Array.DESCENDING;
}
my_array.sortOn(sortColumn, sortOptions);
}

3. Format the code (press the Auto Format button).
4. Test.