Hi Andreas,
I've got round this in the past by getting the selection when it is made rather
than when the button is pushed.
Something like (you may need to fiddle with the scopes):
richText_txt.onMouseDown = function(){
if((this._parent._xmouse > this._x) && (this._parent._xmouse < (this._x
+ this._width)) && (this._parent._ymouse > this._y) && (this._parent._ymouse <
(this._y + this._height))){
ref.selecting = true;
}
};
richText_txt.onMouseUp = function(){
if(ref.selecting == true){
//Store the selection info at this point!!!
}
ref.selecting = false;
};
Hope that helps,
Giles
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andreas Rønning
Sent: 02 October 2006 12:13
To: Flashcoders mailing list
Subject: [Flashcoders] Selection class makes me want to kick someone in theface
...which is, i gather, somewhat of a general consensus.
I'm working on a tablet pc application that requires the user to be able to
select text and transfer this text to other parts of the application.
The ideal way is as such:
1. The user makes a selection from *any selectable text field* 2. A button
appears near the selected text 3. The user taps the button 4. The selected text
is copied to a buffer 5. The selection is cleared 6. An event is broadcast
Now my problem is, this is what happens:
1. The user makes a selection
2. A button appears near the selected text 3. The user taps the button 4. The
text field loses focus, launching Selection.onSetFocus, which checks if the
current selection, now "null", is an editable textfield. Naturally, null is
not, so the button becomes hidden.
5. The user releases the now invisible button 6. Selection.onSetFocus gathers
that the new selection is "null", and uh, returns focus to the text field,
which retains its selection.
7. Now that the textfield, which is "valid" in terms of this purpose, the
button is shown again.
Hmm.. Infinite cycle. Not cool.
The big issue here is that Selection.onSetFocus is called prior to
MovieClip.onPress. This basically means there's no way i can make changes to
the current selection before onSetFocus is called. With this in mind: How the
bloody hell is it possible to make changes to a selection with a button?
The more i kick this horse around, the more contrived the AS looks, and it's
becoming seriously demoralizing.
Any input is appreciated.
- A
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com