PDA

View Full Version : Problem with visibility of handCursor below the TextFields.



SrihariCh
June 16th, 2009, 09:41 AM
Hi All,
I am working with handCursor on text-field instances using Flash and ActionScript 3.0.

But, here, I am getting a problem to the following code:
import fl.containers.ScrollPane;



var myClip:MovieClip=new MovieClip();
var sp:ScrollPane = new ScrollPane();
var noteTitle:Array = new Array();

//creating 3 text-fields with respective properties.
var a:TextField=new TextField();
a.text="dffd";
a.width=40;
var b:TextField=new TextField();
b.text="rdsf";
b.width=40;
var c:TextField=new TextField();
c.text="fsdf";
c.width=40;

//Pushing the textfields' values to noteTitle array
noteTitle.push(a);
noteTitle.push(b);
noteTitle.push(c);

var newClip:MovieClip;

//Creating an hyperlink.
var myHyperlinkFormat:TextFormat = new TextFormat();

myHyperlinkFormat.color = 0x0000FF;
myHyperlinkFormat.underline = true;

var num:int=noteTitle.length;
trace(num);

for (var i=0; i<num; i++) {
newClip=new MovieClip();

// format the hyperlink within the TextField
noteTitle[i].y = 20+25*i;
noteTitle[i].x = 20;
trace("swathi");

noteTitle[i].addEventListener(MouseEvent.MOUSE_MOVE,onHyperLin kRollover);
noteTitle[i].setTextFormat(myHyperlinkFormat, 0,4);
function onHyperLinkRollover(e:MouseEvent):void {

trace('mouse is over hyperlink');
e.currentTarget.parent.buttonMode = true;
e.currentTarget.parent.useHandCursor = true;
e.currentTarget.parent.mouseChildren = false;

}

newClip.addChild(noteTitle[i]);
addChild(newClip);

newClip.addEventListener(MouseEvent.CLICK,onCircul atoryClick);
function onCirculatoryClick(evnt:MouseEvent):void {
newClip.removeChild(DisplayObject(evnt.target));

trace("inside the function");
}


Create a new Flash file and add the above AS3 code into the ActionsPanel of Layer-1 and execute it.

The output consists of 3 hyperlinks one upon other(in line). When, we place the mouse-cursor on the hyperlinks, then the cursor disappears and the "handCursor" appears.

It works fine when we place our mouse cursor on the 3 hyperlinks.
But the issue is: still it displays the HandCursor even if we place the mouse-cursor down these three hyper-links(i.e., in white space below these 3 hyperlinks.Also, it displays handCursor only to some extent,not whole).

WHY IT IS SHOWING LIKE THAT?
(OR)
WHAT SHOULD I DO IN ORDER TO MAKE HANDCURSOR INVISIBLE BENEATH THE 3 TEXT-FIELDS?

Reply me...
Waiting for your replies....

Thanks in advance..


Srihari.Ch

SrihariCh
June 17th, 2009, 03:40 AM
Hi all,
I had found the solution.

The sample example for this issue is as follows:

<textfield-instance>.autoSize=TextFieldAutoSize.LEFT
.RIGHT
.CENTER
.NONE [default]

Example:

... ...
... ...

var text1:TextField = new TextField();
text1.text="Hello";
text1.autoSize=TextFieldAutoSize.LEFT;

//Now you can add the code for handCursors and event handlers on this TextField instance.
//It works fine...
...bla ...bla ...bla



Srihari.Ch