-
-
.
Hi,
I shall take a look now, the tab key will work if you publish swf and then select Control -> disable keyboards shortcuts
-
.
I understand it but what on earth is all sw / 3 - bw / 3,.57 * sh - bh / 2,bw - 50,bh this about??, I'm sure you have your reasons though.
-
.
Hi,
Without really knowing what your trying to achieve!!
If you add the extra frame 10 to your file with a stop(); and maybe an image or box to show that it is frame 10.
PHP Code:
stop();
var sw = 550;
var sh = 400;
var bw = 200;
var bh = 80;
createTextFields()
function createTextFields():Void
{
this.createTextField("TypeA",10,sw / 3 - bw / 3,.57 * sh - bh / 2,bw - 50,bh);
this["TypeA"].tabIndex = 1;
this["TypeA"].border = true;
this["TypeA"].borderColor = 0xFF0000;
this["TypeA"].background = true;
this["TypeA"].type = "input";
this["TypeA"].maxChars = 5;
this["TypeA"].restrict = "A-z";
this.createTextField("TypeB",11,2 * (sw / 3) - bw / 3,.57 * sh - bh / 2,bw - 50,bh);
this["TypeB"].tabIndex = 2;
this["TypeB"].border = true;
this["TypeB"].borderColor = 0xFF0000;
this["TypeB"].background = true;
this["TypeB"].type = "input";
this["TypeB"].maxChars = 4;
this["TypeB"].restrict = "A-z";
var tfInptxt:TextFormat = new TextFormat();
tfInptxt.size = 28;
tfInptxt.font = "Arial";
tfInptxt.align = "center";
this["TypeB"].setNewTextFormat(tfInptxt);
this["TypeA"].setNewTextFormat(tfInptxt);
boxID = setInterval(write, 500);
}
function write()
{
clearInterval(boxID);
if (TypeA.text == "end")
{
clearInterval(writeID);
clearInterval(boxID);
gotoAndStop(10);
return;
}
TypeA.text = "Go";
Selection.setFocus(TypeA);
writeID = setInterval(ans_rem_box, 8000);
}
function ans_rem_box()
{
clearInterval(writeID);
boxID = setInterval(write, 500);
}
and remember to disable Keyboard shortcuts in the cntrl-enter swf
-
.
Hi,
I'm still a little confused as to why you used all the formula to place your textfields?
was just playing around, the code is essentially the same as above , just with the formula stuff added
PHP Code:
stop();
var sw:Number = 550;
var sh:Number = 400;
var bw:Number = 200;
var bh:Number = 80;
createTextFields();
function createTextFields():Void
{
var tx1:Number = Math.floor((sw / 3) - (bw / 3));
var tx2:Number = Math.floor(2 * (sw / 3) - (bw / 3));
var ty:Number = Math.floor((.57 * sh) - (bh / 2));
var tw:Number = bw - 50;
var th:Number = bh;
trace("TypeA._x = " + tx1);
trace("TypeB._x = " + tx2);
trace("Both._y = " + ty);
trace("Both._width = " + tw);
trace("Both._height = " + th);
// *** End of mess
//this.createTextField("TypeA",10, Math.floor((sw / 3) - (bw / 3)),Math.floor((.57 * sh) - (bh / 2)),bw - 50,bh);
//this.createTextField("TypeA", 10, tx1, ty, tw, th);
this.createTextField("TypeA",10,116,187,150,80);
this["TypeA"].tabIndex = 1;
this["TypeA"].border = true;
this["TypeA"].borderColor = 0xFF0000;
this["TypeA"].background = true;
this["TypeA"].type = "input";
this["TypeA"].maxChars = 5;
this["TypeA"].restrict = "A-z";
//this.createTextField("TypeB",11, Math.floor(2 * (sw / 3) - (bw / 3)),Math.floor((.57 * sh) - (bh / 2)),bw - 50,bh);
//this.createTextField("TypeB", 11, tx2, ty, tw, th);
this.createTextField("TypeB",11,300,187,150,80);
this["TypeB"].tabIndex = 2;
this["TypeB"].border = true;
this["TypeB"].borderColor = 0xFF0000;
this["TypeB"].background = true;
this["TypeB"].type = "input";
this["TypeB"].maxChars = 4;
this["TypeB"].restrict = "A-z";
var tfInptxt:TextFormat = new TextFormat();
tfInptxt.size = 28;
tfInptxt.font = "Arial";
tfInptxt.align = "center";
this["TypeB"].setNewTextFormat(tfInptxt);
this["TypeA"].setNewTextFormat(tfInptxt);
boxID = setInterval(write, 500);
}
function write()
{
clearInterval(boxID);
if (TypeA.text == "end")
{
clearInterval(writeID);
clearInterval(boxID);
gotoAndStop(10);
return;
}
TypeA.text = "Go";
Selection.setFocus(TypeA);
writeID = setInterval(ans_rem_box, 8000);
}
function ans_rem_box()
{
clearInterval(writeID);
boxID = setInterval(write, 500);
}
-
Hi fruitbeard,
Once again I am logging in late bcoz I knew you would have replied and well you have 4 times !! Thanks loads, Will do as you suggested and revert tomorrow.
The reason for all these sw / 3 - bw / 3,.57 * sh - bh / 2,bw - 50,bh was just to find the right placement for the boxes and to maintain the relative spacing if the screen size was to be changed later. These co-ordinates kindl of divide the screen into near 3 halves and place the two boxes near equally along the width of the screen. If you think that these are not great please suggest something better.
Will revert with the results of your suggestions here.
Have a nice day & thanks loads.
-
.
Hi,
No. 5
Your calculations were wrong and it did not stay where you wanted it to upon changing swf dimensions, central basically.
You can put the text inside a container and apply x,y to the container, anyway here is the file for you to plunder.
Why so many little test type things, you must have some very odd little project going on.
P.s remember the disable Keyboard shortcuts if it hasn't already sank in.
-
Hi fruitbeard,
Thanks again for the reply.
I admit I had not tested the co-ordinates. It's a very rare phenomenon that a piece of complex code at times achieves exactly what is desired at the first go and that's what happened with these co-ordinates. I would like to look into them in detail later though. Thanks for checking it.
The file for plunder did not let me do so. I got an invalid file format. I have Flash CS3. Kindly resend it.
Thanks loads !! You are the best !
-
.
Hi,
Unfortunately I use CS6 and can only save as low as CS5
Here is the code I have used with an empty clip with AS Linkage of textContainer
PHP Code:
stop();
var sw:Number = 550; var sh:Number = 400; var bw:Number = 150; var bh:Number = 80; var textSpacer:Number = 30;
var textType:Array = new Array("TypeA", "TypeB"); var maxChar:Array = new Array(5, 4); var xPos:Array = new Array(0, (bw + textSpacer));
createTextFields();
function createTextFields():Void { var tfInptxt:TextFormat = new TextFormat(); tfInptxt.size = 28; tfInptxt.font = "Arial"; tfInptxt.align = "center";
attachMovie("textContainer","textContainer",0); var textRef = this["textContainer"];
for (var i:Number = 0; i < textType.length; i++) { textRef.createTextField(textType[i],i,xPos[i],0,bw,bh); textRef[textType[i]].tabIndex = i; textRef[textType[i]].border = true; textRef[textType[i]].borderColor = 0xFF0000; textRef[textType[i]].background = true; textRef[textType[i]].type = "input"; textRef[textType[i]].maxChars = maxChar[i]; textRef[textType[i]].restrict = "A-z"; textRef[textType[i]].setNewTextFormat(tfInptxt); }
textRef._x = Math.floor((sw - textRef._width) / 2); textRef._y = Math.floor((sh - textRef._height) / 2 + (textRef._height / 3)); //textRef._y = Math.floor((sh - textRef._height) / 2);// for central;
write(); }
function write() { clearInterval(boxID); if (textContainer.TypeA.text == "end") { clearInterval(writeID); gotoAndStop(10); return; }
textContainer.TypeA.text = "Go"; Selection.setFocus(textContainer.TypeA); writeID = setInterval(ans_rem_box, 8000); }
function ans_rem_box() { clearInterval(writeID); boxID = setInterval(write, 500); }
Last edited by fruitbeard; 09-06-2014 at 04:35 AM.
-
Hi fruitbeard & all,
Thanks again for the reply. So i created the textContainer, converted it to a movie and ran the program. It ran fine though the boxes were displaced out of the clip. One was inside it while the other divided the right side, lying half inside the box and half outside. I'll check the rest in detail later.
The "end" worked fine and stopped the triggers completely. This "controls in containers is a great idea by fruitbeard" I shall explore it in length but later. For now this solves most of my issue and so a huge thanks again to fruitbeard for his awesome help, guidance and working examples. Will come back soon with more problems.
Thanks !
-
.
Hi,
Im not sure why you have problems with the placing and stuff,
This is CS3, perhaps you did something different!!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|