상세 컨텐츠

본문 제목

플래시 액션스크립트 tab 포커스 관련 ie 브라우져 관련

ADOBE/Flash

by AlrepondTech 2020. 9. 15. 22:27

본문

반응형

 

 

 

 

=================================

=================================

=================================

 

 

 

 

 

 

 

출처: http://stackoverflow.com/questions/3657309/how-to-create-multiple-tab-loops-in-as3-by-using-fl-managers-focusmanager

How to create multiple tab loops in AS3 by using fl.managers.FocusManager?

 

 

 

2down votefavorite

I want to create a tab-enabled popup window in an AS3 Air project. Currently, when I press tab several times, the focus goes through all the components in my popup window and then starts focusing the buttons and TextFields from the components that are behind the popup. I have tried to solve this problem in two ways, but none of them worked. I will explain both of the methods here
  1. The official method
    I have read adobe's documentation from here and it describes what I should do in my case like this:
    • I have tried creating an instance of the FocusManager in each of my view component classes by putting the code below in the constructor, but it didn't work:
    _focusManager = new FocusManager(this);
    • What do they mean by "modal Window component" ?
  2. The workaround method
    Another thing I've tried is to manually set the tabEnabled property to true or false on each button and TextField when the Parent component dispatches a FOCUS_IN or FOCUS_OUT event. This worked on a simple example that I created on a new flash file, but it doesn't work on my large project, and I don't know how to debug it. However I would be very glad to dump this and go back to method number 1.
Has anyone encountered these problems before? Have you used multiple tab cycles in any other way? Any hint is welcome right now, because I've been wasting too much time on this problem. Thank you [Edit] I was getting a lot of views for this question, but no relevant answers, so I edited it and tried to simplify it
flash actionscript-3 actionscript focusmanager
add comment

3 Answers

activeoldestvotes

up vote1down vote Yeah tabbing can be a real pain.
I had a similar problem, where tabbing stopped working after I had a popup open. Problem was that the popup was alive in the background and hijacked the tabbing.
This solved my problem, with individual tabcycles now working for main app and popups:
add comment

Did you find this question interesting? Try our newsletter

Sign up for our newsletter and get our top new questions delivered to your inbox (see an example).

 

up vote0down vote Depending on what you are trying to achieve, you maybe able to use tabIndex instead of the FocusManager.
http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/InteractiveObject.html#tabIndex


show 2 more comments
up vote0down voteaccepted I ended up writing my own FocusManager which does what I need. It turned out to be easier than I initially thought. I'm sorry to say that I can't post the code here, but I'll give you a short description of what I did and hope that it helps:
  • I implemented the fl.managers.IFocusManager interface, but I didn't entirely respect the way the old manager worked
  • The constructor of my CustomFocusManager requires an array of the tabbable children as parameter, and the children have to be in the order that they will appear in the loop. In this way I did not have to care about the type of the children (is it tabbable or not?) or ask myself if tabIndexes exist or not.
  • I ignored the tabIndex properties
  • I created a new interface called IFocusManagerContainer, inspired from the Flex interface with the same name
  • I created a static class similar to Flex's SystemManager which knows when to activate/deactivate the FocusManagers depending on the children found on the stage.
I took a peek into the mx.managers.FocusManager code, and from what I saw, most of their effort was put into handling all the possible cases where the FocusManager might be used, this is why it's so long and complicated. I can only assume that fl.managers.FocusManagers looks similar. I bet that mine still has a lot of problems, and it isn't as portable as the ones from Adobe, but it's very simple and it does what I need it to do.
I would still like to see some guidelines on how to correctly use the existing FocusManager.

 

 

 

반응형

 

728x90

 

 

=================================

=================================

=================================

 

 

 

출처: http://stackoverflow.com/questions/7849864/somewhat-basic-as-3-0-quest-please-help-asap

 

somewhat basic AS 3.0 quest, please help asap

 

What is the best way to navigate through an actionscript swf using arrows?
actionscript-3 actionscript flash-cs4 flash-cs5
add comment

1 Answer

activeoldestvotes

up vote0down voteaccepted set the tabIndex property of the TextInput. That should allow you to tab through the form.
It is inadvisable to override the default functionality for arrow keys because they are used to move the text insertion point within the textInput
As for enter, you'll have to listen for the keyUp event and, if you detect an enter key, move to the next field.
EDIT
For Flash CS5, this code should work:
important: first drag a component from the "User Interface" group onto the stage and delete it. This should put all the required components in the library ready for you to use
EDIT2
Change
in your code to this:


show 18 more comments

 

 

=================================

=================================

=================================

 

 

 

출처: http://stackoverflow.com/questions/7849864/somewhat-basic-as-3-0-quest-please-help-asap

 

For instance, if I have an ordered set of objects [a, b, c, d, e] with their tabIndex property correctly assigned, and the focus is currently on object c, I want to change the focus so that:
a) Nothing is focused;
b) Next time I press tab, object a gets focused.
stage.focus = null solves (a), however it remembers the current index causing object d to be focused when tab is pressed.
flash actionscript-3
add comment

3 Answers

activeoldestvotes

up vote1down voteaccepted Instead of trying to change the index , you could switch the tabEnabled property of the remaining objects to false, when the focus is on the first objet , enabled it again.
This example is not structured in functions, it's just demo code to clarify what I mean
Press tab again, focus is on a


add comment

 

up vote0down vote the easiest way imho is to set focus to e and then to null


add comment
up vote0down vote I'm not sure that this is the best way to go about it, but it definitely works. Basically you keep track of the UI element that is in focus. Then before nulling the focus you store the element currently in focus. Have a look - I tested this with a few TextInputs and a Button:

 

=================================

=================================

=================================

 

 

 

반응형


관련글 더보기

댓글 영역