Advertisement

03.19.2008 at 03:13AM PDT, ID: 23253064
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.4

datagrid, setFocus, and focus ring

Asked by jockmahon01 in Macromedia Flash

Tags:

I want to move from different components using enter, this is fine, the problem i have is i also need the focus ring on the current component to follow like with tab,  either the focus ring works and the datagrids scrolling using the up/down doesnt  or there is no focus ring but the scrolling works

the example is where the ring works but the scrolling doesnt, i guess that by overriding the setFocus i am not calling the right function that sets up keyListeners for the datagrid

anyone know what i need to do

create a fla , make a new mc set linkage / as class to test1Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
import mx.utils.Delegate;
import mx.controls.*;
import mx.*
 
class test1 extends MovieClip
{
	var keyListener:Object;
	var formFocusManager:Object;
	
	var a:TextInput;
	var b:TextInput;	
	var c:DataGrid;	
	
	public function onLoad()
	{
		
		var a1 = ["w"]
		c.columnNames = a1;
		
		_global.style.setStyle("themeColor", "HaloBlue");
				a.tabIndex = 1;
		b.tabIndex = 2;
		c.tabIndex = 3;
 
		a.onSetFocus     	= Delegate.create(this, onInputFocus);
		a.onKillFocus    	= Delegate.create(this, onInputLoseFocus);
		b.onSetFocus     	= Delegate.create(this, onInputFocus);
		b.onKillFocus    	= Delegate.create(this, onInputLoseFocus);
		c.onSetFocus  		= Delegate.create(this, onInputFocus2);
		c.onKillFocus       = Delegate.create(this, onInputLoseFocus2);
 
		var ro = new Array();
		ro["w"] = 112;
		c.addItem(ro);
		c.addItem(ro);
		c.addItem(ro);
		c.addItem(ro);
		c.addItem(ro);c.addItem(ro);
 
		formFocusManager = new Object();
		formFocusManager =  a.getFocusManager();
		keyListener = new Object();
		keyListener.onKeyDown = Delegate.create(this, keyDownListener);
		Key.addListener(keyListener);
		a.setFocus();
 
		
		
	}
	
	private function onInputFocus(event):Void
	{
		//[dmahon : 20/02/08] -	Set up global color for maintainability
		formFocusManager.getFocus().setStyle("backgroundColor", 0xFFFF99);
		formFocusManager.getFocus().drawFocus(true);
	}	
	
	private function onInputLoseFocus(event):Void
	{
		formFocusManager.getFocus().setStyle("backgroundColor",0xFFFFFF );
		formFocusManager.getFocus().drawFocus(false);
	}
 
	private function onInputFocus2(event):Void
	{
		formFocusManager.getFocus().drawFocus(true);
 
	}	
	
	private function onInputLoseFocus2(event):Void
	{
formFocusManager.getFocus().drawFocus(false);
	}	
 
	
	public function keyDownListener():Void
	{
 
		if(Key.getCode() == Key.ENTER)
		{
			if(formFocusManager.getFocus() == a)
			{
				b.setFocus();
				return;
			}
			if(formFocusManager.getFocus() == b)
			{
				c.setFocus();
				return;
			}
			if(formFocusManager.getFocus() == c)
			{
				a.setFocus();
				return;
			}
		}
	}
}
 
 
[+][-]04.15.2008 at 11:07PM PDT, ID: 21365114

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Macromedia Flash
Tags: Flash 8 actionscript 2
Sign Up Now!
Solution Provided By: jockmahon01
Participating Experts: 0
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628