Home » Actionscripts library » Selection Object
|




ClickManager
![]() |
![]() |
/** * @author: Eric Feminella * @url: http://www.ericfeminella.com * @copyright: (c)2004 - 2006 code.ericfeminella.com */ import com.dataProviders.IntervalMethodCall; class com.dataProviders.ClickManager { private var global_mouseTimer:Number = 0; private var doubleClickTime:Number = 300; public var singleClick:Boolean = false; public var initInterval:Boolean = false; public var intervalMethodCall:IntervalMethodCall; public function ClickManager() { this.intervalMethodCall = new IntervalMethodCall(this, "validateSingleClick", null, 1, 1) } public function detectDoubleClick():Boolean { var time:Date = new Date(); var now:Number = time.getTime(); if (now - this.global_mouseTimer < this.doubleClickTime) { return true; } else { this.global_mouseTimer = now; return false; } } public function detectSingleClick():Boolean { this.checkIntervalCall(); if (this.singleClick) { this.singleClick = false; return true; } else { return false; } } public function checkIntervalCall():Void { if (!this.initInterval) { this.intervalMethodCall.beginInterval(); this.initInterval = true; } } public function validateSingleClick():Void { this.initInterval = false; this.singleClick = true; } } Posted by: Eric Feminella | website http://www.ericfeminella.com |
![]() |
![]() |
![]() |

![]() |
![]() |
/*OK so everyone's been going on about how to use the standard Windows copy and paste keys within Flash. Well here's my solution.*/ // Win. Copy and Paste Functionality, V1 // Jesse Stratford, www.actionscript.org onClipEvent (enterFrame) { if (Key.isDown(Key.CONTROL) and Key.isDown(67)) { if (Selection.getFocus() != null) { copy = Selection.getFocus(); } } else if (Key.isDown(Key.CONTROL) and Key.isDown(86)) { if (Selection.getFocus() != null) { _root[Selection.getFocus()] = eval(copy); } } } /*This goes on a controller clip somewhere off stage. To copy click inside a text field and press Ctrl C, to paste, click the target field and press Crtl V.*/ Posted by: Jesse Stratford | website http://www.actionscript.org |
![]() |
![]() |
![]() |

![]() |
![]() |
onClipEvent (enterFrame) { if (Key.isDown(17) && Key.isDown(67)) { Selection.setFocus("_root.text") && Selection.setFocus("_root.text2"); } else if (Key.isDown(17) && Key.isDown(86)) { Selection.setFocus("_root.text2"); _root.text2 = _root.text; } } The above example works in HTML and gets around the focus problem by setting the focus at the begining. Unfortuanately it's not very practical as it doesn't set the focus on the first textfield properly. Maybe when I've a little more time I'll try and work it out. Posted by: No name | website http:// |
![]() |
![]() |
![]() |

![]() |
![]() |
In the following example I load my movie with the text boxes into level5. All the actions focusing the text boxes are in the level 5 movie: Level 5 Movie: 1) First set the focus of your text box in frame 1: Selection.setFocus("box1"); on (keyPress "<Tab>") { if (Selection.getFocus() == "_level5.box1") { Selection.setFocus("box2"); } else if (Selection.getFocus() == "_level5.box2") { Selection.setFocus("box3"); } else if (Selection.getFocus() == "_level5.box3") { Selection.setFocus("box4"); } else if (Selection.getFocus() == "_level5.box4") { Selection.setFocus("box1"); } } Posted by: No name | website http:// |
![]() |
![]() |
![]() |

![]() |
![]() |
//randomis's the picture number n = Math.round(Math.random() * 2); //for selective pictures so that the other windows dont have the same //picture on at the same time if there arnt any other windows just delete //this section if (n <= 0) { gotoAndPlay(1); } else if (n >= 3) { n = 2; } //selects the image that you want to load else { loadMovie ('...\images\contact\image' + n + '.jpg', 'loadMovie'); } //checkout www.copirite.com.au to see it in action if there are any other //scripts that you might find interesting on there please dont hesitate to //email me on travis@copirite.com.au Posted by: Travis Fitzgerald | website http://www.copirite.com.au |
![]() |
![]() |
![]() |