AC_RunActiveContent.js and Click to Activate

It seems like the AC_RunActiveContent.js will no longer be necessary. Looks like MS will be taking the "Click to Activate" requirement out of IE. read more Here.

Testing navigateToURL locally

I noticed that navigateToURL (this replaces getURL in AS2) doesn't seem to work locally, if you want to open a link in the same window (_self). I found this note on the Adobe site. It seems that you need to set "allowScriptAccess" to "always" in the HTML parameters. This needs to be set in both the param tags as below: <param name="allowScriptAccess" value="always" /> and in the embed tag: <embed allowScriptAccess="always" />

SimpleScrollBar class AS3

Here's an AS3 class that creates a simple scroll bar. Set this as the Base Class for any movie clip. The container clip must have two movie clips named drag_mc and track_mc. These clips act as the dragger and track for the scroll bar

Add an event listener to call a handler when the scroll bar is dragged. SimpleScrollBar dispatches the ScrollBarEvent.UPDATE which includes the property scroll_value. This property holds a value from 0 to 1 representing the position of the dragger.

Here's some example code. Assume that scroll_mc is a movie clip that contains two clips drag_mc and track_mc. This clip has SimpleScrollBar set as it's base class.

scroll_mc.addEventListener( ScrollBarEvent.UPDATE, on_update );
function on_update( e:ScrollBarEvent ):void {
	var n:Number = e.scroll_value; // Get the value of scroll bar
	scroll_txt.scrollV = Math.round( ( scroll_txt.maxScrollV - 1 ) * n ) + 1;
}
 

Download the sample: simplescrollbar-class

Comunication between classes

Here's a few ideas from a thread on Actionscript.org about communicating between two classes:

(root as MyDocClass).my_doc_method();
MyDocClass(root).my_doc_method();

http://www.actionscript.org/forums/showthread.php3?t=152676

Here's some more info on this subject: http://www.actionscript.org/forums/showthread.php3?t=163265

Need to know when the mouse leaves the stage?

Ever need to know when the cursor leaves the stage? This comes up every once in a while and is useful to know. First there is Event.MOUSE_LEAVE which is:

Dispatched by the Stage object when the mouse pointer moves out of the Flash Player window area.

According to Flash Help.

stage.addEventListener( Event.MOUSE_LEAVE, mouseLeaveListener );
 function mouseLeaveListener (e:Event):void {
         trace("mouse left the stage");
         stage.addEventListener( Event.MOUSE_MOVE, mouseMoveListener );
 }
 function mouseMoveListener (e:Event):void {
         trace("mouse re-entered the stage");
         // remove the listener until the next time the mouse exits the stage.
         stage.removeEventListener(Event.MOUSE_MOVE, mouseMoveListener);
}

Then there is also Event.ACTIVATE and Event.DEACTIVATE. These events are dispatched when Flash gains and loses focus. In other words when the cursors leaves the area of the movie.

A link to a discussion of the subject on Ationscript.orghere